-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
❓[SUPPORT]: Angular 11 already supports hmr, is ngxs considering following up? #1711
Comments
We are very interested in this feature too, HMR is a key to faster development on huge web application. |
I have asked @splincode to look into it. |
@Y2zz works for me, if something doesn't work for you, please provide an example to reproduce |
Hello, I had a HMR setup that worked well with Angular 10 using the After removing the code related to the HMR plugin, the error was gone, but my states weren't saved through reload. What are the steps to make everything work as before ? |
@krtek4 Is it possible to provide a small reproduction of your issue? |
@markwhitfeld not sure it is an issue per se, probably more of a "how to do things now that Angular has HMR" Not on my work computer right now and stackblitz doesn't seem to properly support HMR, will try to get back to you in the next few days with a repo. |
Hello @splincode , @markwhitfeld I created a repository with various branches : https://github.com/krtek4/hmr-tests
The steps to reproduce are in the Happy to help further if I can. |
Hey @splincode , @markwhitfeld, Any news on this ? I can probably work on this if you don't have time, just that I don't want to waste time if you already have something planned. Just tell me how I can help :) |
@krtek4 have not watched yet, you can study this moment yourself |
I think this may be different from what we understand HMR |
@Y2zz what do you mean ? HMR itself works fine in Angular 11, with or without NGXS. The thing that changed is that in Angular 10 and below, using the HMR plugin, data in the stores were restored upon reload, now the plugin does not work, for logical reasons. What is your issue ? |
It's funny to have a comment on this today as I spent the morning trying to fix the issue for me :) I have a "kinda working setup" currently:
So in a way, it works just fine. The only issue I have to solve now is Object instances. The storage plugin serialise data as JSON, and thus when they are deserialied, the aren't objects anymore, just data. Is there any interest from the community to "rewrite" the HMR plugin to manage this issue ? Or write another Storage plugin to keep the object instances ? what do you think is the best option ? |
@krtek4 persist object into storage not good idea, because HMR should be work in only runtime |
@splincode fair enough, but it is the recommended workaround on the plugin page ;) Also, I set up in such a way that it only loads when dev mode is active. I would say the better approach would be to rewrite the HMR plugin to keep the lifecycle part alongside the persistence of the state but letting Angular manage the HRM part. What do you say ? |
In the first versions our hmr plugin, we did so (keep the lifecycle part alongside the persistence of the state), but then we realized that this was an overhead |
So what would be your proposed approach ? |
we are waiting for the Angular team to fix the hmr (Ivy) |
It works outside of JIT, slowly, but it works. I think the discussion around how should ngxs will manage now that Angular 11 has HRM in the core can already take place as I don't see how any bugfix on their side will change something. What am I missing ? On the other hand, I am not the one that opened this issue, and I can implement a solution on my own, just wanted for it to benefit everyone. So if you say you prefer to wait, it works for me too :) |
@splincode what would we still need in order in terms of angular support to re-introduce this plugin? |
FYI, I was able to add some kind of hackish solution to restore the state upon HMR reload base on this old blitz : https://stackblitz.com/edit/angular-hmr-wth-ngxs
Couldn't use the blitz code directly as the module reference is already destroy in Angular 11. I can share the code if someone is interested. |
need investigate |
@markwhitfeld @splincode any updates about the case? |
Still issue with Angular 15 and ngxs hmr plugin ; also the doc say it will be deprecated in angular 10 (https://www.ngxs.io When reload happen :
|
https://blog.angular.io/version-11-of-angular-now-available-74721b7952f7
The text was updated successfully, but these errors were encountered: