hot-module-reload
hot-module-reload copied to clipboard
Hidden Views do not reload
This includes Views which are conditionally hidden (e.g. with if.bind
), not the ones that are simply not shown (hidden via CSS).
To reproduce:
- hide a View so that it's removed from the DOM
- change the template of that View
- unhide the View
The View will still contain old data, and its ViewFactory and template fragment will be out of date with the module, thus any further HMR on that Element will fail until the View is fully re-created (e.g. by switching routes).
To fix this we'll need to switch the way we traverse Controllers in search for Views matching a given template. We need to match all the Views, whether they're attached and present in the DOM or not.
If that still does not make it possible to access all the created View instances, we can think of alternative solutions, such as storing old fragments, or tracking Views with afterCreated
hook and then replacing the ViewFactories in a beforeBind
hook. However, this would not be a great solution because this would cause a memory-leak, as the memory consumption of the site would grow with every hot-reload of any View.