You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the discussion we add on Slack yesterday about the feasibility of such an improvement, I'm taking the liberty of opening this issue to easily track progress as well as coordinate efforts should some benevolent soul try and take a shot at this.
It can definitely be fixed (PRs welcome). At the time, I just wanted to get something out the door, and I hadn’t yet seen changes to rtfeldman’s SPA example. So it seemed like a reasonable compromise. But now that that example is out there, it’s less tenable of a solution.
The core problem is that Browser.Navigation.Key is not plain-old data: it’s actually a function that closes over the Elm runtime’s sendToApp function. So unlike all of the other data in your model, the navigation key cannot be reused in the new app. So we need to be able to find it in the old model and swap it out with the new app’s key.
My implementation just looks one level deep in your model. We could certainly crawl the model recursively to try to find all instances of the nav key and update them in the new app’s model.
The text was updated successfully, but these errors were encountered:
klazuka
changed the title
Improvement: lift requirement to have Browser.Navigation.Key at the root of the Model
Handle Browser.Navigation.Key that is not at the root of the app model
Sep 6, 2018
Based on the discussion we add on Slack yesterday about the feasibility of such an improvement, I'm taking the liberty of opening this issue to easily track progress as well as coordinate efforts should some benevolent soul try and take a shot at this.
Some relevant information from @klazuka :
Unless I'm mistaken, the relevant code should be around here : https://github.com/klazuka/elm-hot/blob/master/resources/hmr.js#L303-L325
The text was updated successfully, but these errors were encountered: