aurelia / hot-module-reload

Core functionality for Aurelia's hot-module-reolad (HMR) capabilities, which is shared by all loaders and tools.
MIT License
25 stars 8 forks source link

ViewModels are being patched, not re-created #2

Open niieani opened 7 years ago

niieani commented 7 years ago

Currently, we only switch out the prototype of the ViewModels, from the old ones to the new ones. It would be best if we could re-create them and then copy their state over to the new object. This also creates problems of its own, because we'll need to de-register old instances in the DI Containers and re-register new ones in their places. That will be quite challenging, since Containers do not expose any such capabilities.

A possible solution would be to add a "proxy" feature to Aurelia DI, so that, if enabled, resolved instances could be globally overwritable with a user-defined proxy function.

Alexander-Taran commented 6 years ago

Stale since 2016