vue-meta
vue-meta copied to clipboard
Callback-influenced values reset via HMR
Hey :wave:
data values that are manipulated via a callback function are (wrongly) changed to their original values when HMR kicks in.
Reproduction:
- Fork https://codesandbox.io/s/codesandbox-nuxt-exyst
- See that
isStripeLoadedis "no" first and then turns to "yes" when the script is loaded - Write something in the template and save
- See that it turns to "no" again and stays at "no" even though the script is (still) loaded.
Solution
Re-execute callbacks after HMR (might have some false positives related to the value of skip ?)
Have been thinking about the best way to solve this issue. The main difficulty with the proposed solution is to know when after HMR is. There arent any global hmr events available it seems, so we'd have to subscribe to all hmr events using a new hmr client. We could mitigate that a bit by only providing a method to re-apply callbacks which users would need to call themselves on hmr. The other difficulty I guess is that adding dev-only stuff like this to the client build means that it will also be included in production builds, which needlessly increases the bundle size.
Thanks for your contribution to vue-meta! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you would like this issue to remain open:
- Verify that you can still reproduce the issue in the latest version of vue-meta
- Comment the steps to reproduce it
Issues that are labeled as
pendingwill not be automatically marked as stale.