-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Hot Reload for Blazor #5456
Comments
See dotnet/blazor#193 for status updates on this work item. |
For now, we can use |
We've hit a snag with live reload for 0.2.0, so moving this out until we can work through a more robust design. |
Hi, I'm using dotnet sdk 2.2.100-preview1-009349 and blazor 0.5.1 under Mac. |
@danroth27, what's #4056 then? Should it be closed? |
Few questions! |
Yes
For .NET Core 3.0 we expect to support auto rebuild based on file changes, but you will still need to manually refresh the browser.
We don't currently have a plan for supporting hot module replacement in a way that preserves client state. |
At least, not automagically. Theoretically if you follow a Redux-like architecture, or anything else that strictly decouples state from display, then you could serialize that state out before unload and restore on reload. However this isn't something we're planning to bake in as a feature, as not everyone wants to follow that kind of architecture. |
Thanks. Please, once ready, would you be able to document the appropriate hooks (before unload / reload etc) provided in the design to facilitate this. I'd like to start on an implementation / helper nuget package to enable this pattern for those that want it! |
Couldn't get the
Just ended up with the following crude solution using
|
I thought i was supposed to run: If I used: With the following in the project BlazorTest.Server.csproj file:
It picked up changes in the BlazorTest.Client project and restarted the server, so I only had to do a manual refresh in the browser. |
Does that mean the server restarts everytime there is a a |
@dazinator, yes :-) |
.. ok just checking but that is a bad thing right? I.e server restart should be unnecessary for a html or css file change as a browser refresh (with cache invalidated) should suffice? |
You are right, that is not necessary. Just add or remove the file extensions you are interested in within the |
Sorry if off-topic, is there anyway to live reload from Visual Studio right now (Blazor client-side)? Right now for every change excluding wwwroot files, I have to Build the project (Ctrl Shift B) and reload the browser. Would be wonderful if VS can auto build on saving changes. |
For what its worth, we are very excited about Blazor and props to the development team. But we are waiting until stateful hot reload is available. |
@MussaratAziz Do you also see similar issues if you run your project from the command-line using If the auto refresh functionality is still not working for you in VS, please file a VS feedback issue so it gets tracked appropriately on the VS side. |
@danroth27 Thanks for the reply |
PM> dotnet watch run -16.8.2 .NET also not working in VS |
@hannespreishuber that is a terrible way to provide feedback if that was your intent. Try opening an issue and following the template. |
Just small feedback regarding this statement. For me and using "Auto build and refresh option" (what @porkopek suggested) is taking more like 5 secs. Yes, it is not 1 sec as with Livesharp but it is quite fast and it is working :) I did try Livesharp, but for me it was breaking the external JS on the site (I did have some slider revolution part and after livesharp was sending an update, the js on the site was broken) |
@pranavkm @jongalloway Possible to update the VS Mac roadmap? |
Hmmm, auto-refreshing the browser in .NET 5 using |
@szalapski Have you noticed if the browser isn't refreshing before the server finishes starting up? I've seen that happen a few times. I don't know if it is by design. |
@szalapski Does auto refresh work if you start from a new project? Have you set |
|
For folks hitting issues with |
Closing this issue as we're done with the work we planned to deliver for 6.0. |
dotnet watch
The text was updated successfully, but these errors were encountered: