core icon indicating copy to clipboard operation
core copied to clipboard

[Bug report] Event lost when navigating to a visited page

Open Mister-Hope opened this issue 3 years ago • 3 comments

Description

In the below demo, dev server is working as expected. (Attr and dataset are not preserved)

In production, when modifying dom, attrs and dataset are preserved when revisiting a page ( which I personally think is an unexpected behavior), while the event handlers are not preserved.

So that this can lead to unexpected behavior (such as feature broken, as dom are rendered, while they do not have any event handlers).

This should be a bug because the behaviors are not constant, and I am not sure how it happends and whether it belongs to vue or just vuepress.

Reproduction

https://github.com/Mister-Hope/vuepress-demo

Used Package Manager

npm

System Info

...

Mister-Hope avatar Jun 18 '22 14:06 Mister-Hope

This issue is marked as stale because it has not had recent activity. Issues marked with stale will be closed if they have no activity within 3 days.

github-actions[bot] avatar Jun 26 '22 01:06 github-actions[bot]

Steps to reproduce:

  1. Visit homepage first time( render), button is working
  2. Visit to the other page
  3. Navigate to homepage again or just navigate back(rerender), button is not working.

This only happens in production

Why: attrs, dataset modification is preserved while event is lost. However, the element is not be reused in the other page. The element is likely to be "cached" and reused, as a recreation should drop the pending attr. This is not behavior in vue2, also not the behavior in devserver

Mister-Hope avatar Jun 30 '22 03:06 Mister-Hope

Seems like an issue of vue core.

meteorlxy avatar Jun 30 '22 05:06 meteorlxy