🐛 BUG: HMR destroy scripts (and changes made) because they don't re-run on HMR update #3556
Labels
- P4: important
Violate documented behavior or significantly impacts performance (priority)
feat: hmr
Related to HMR (scope)
What version of
astro
are you using?v1.0.0-beta.42
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
Inserting scripts that make changes to the page (DOM), like this...
...are lost on HMR because HMR reloads the entire page and scripts are not re-run because they hasn't changed.
As discussed on discord, a solution could be a new directive like <script is:fixed> that re-runs the script on HMR and is stripped off on building. HMR algorithm should just re-run those scripts like if they were changed
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-rqmsac-zbs3uf
Participation
The text was updated successfully, but these errors were encountered: