Closed rluba closed 5 years ago
Is there any reason why this fix has been unmerged for almost a full year?
@rluba Somehow this must have gone under the radar. I'm merging now and adding to my release task list for this week. Apologies!
@EisenbergEffect Much appreciated, thanks!
recreateView
creates a new container but did not copy the resolvers from the old container. This caused local DI instances (eg. injected into the controller viaNewInstance.of
) to be missing.This fixes aurelia/validation#469, at least the HMR issue described by @alexdresko.
Here's a concrete example using a state component (for routing) and it’s view:
Component
View
This state initially loads correctly, but when modifying the view,
ValidateBindingBehaviorBase
throws because it can’t locate theValidationController
because the corresponding resolver is missing from the view’s new container that’s created by HMR.I’m relatively new to Aurelia, so I don’t know if the resolvers were not copied on purpose. @EisenbergEffect probably knows whether this was intended or not. If the resolvers should not be copied, then we need a different way to keep local DI instances during HMR.