aurelia / aurelia/hot-module-reload

ViewModels are being patched, not re-created

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
TypeScript
Stars
26
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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 `Container`s 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.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the current ViewModel hot-reload flow and the Aurelia DI Container API, which the issue identifies as lacking de-registration and re-registration capabilities. Define whether the work should recreate ViewModels and copy their state, add proxy support, or both, then verify that old instances are replaced without breaking dependency injection.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.