core
core copied to clipboard
[Bug report] Event lost when navigating to a visited page
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
...
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.
Steps to reproduce:
- Visit homepage first time( render), button is working
- Visit to the other page
- 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
Seems like an issue of vue core.