mrpmorris / Fluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.
MIT License
1.25k stars 144 forks source link

.NET 6 Hot Reload stops working when Fluxor is added #230

Closed ryandle closed 2 years ago

ryandle commented 2 years ago

First, thanks so much for your work on Fluxor! It's a great library that I enjoy using in my personal projects.

I have been upgrading some projects to .NET 6 and I noticed that hot reload of .razor files stops working when I'm using Fluxor.

Repro repo: https://github.com/ryandle/FluxorHotReloadRepro

The first commit 00a851a is a vanilla net6 blazor wasm hosted app. Hot reload works as expected on all pages. The second commit a591116 is me adding the Fluxor Counter example to the Counter page.

When running the second commit, observe that:

When running on the first commit (i.e. no Fluxor) this issue does not repo. You can navigate between pages and hot reload keeps working.

I'm using VS 2022 (17.0.0) and .NET SDK 6.0.100 and launching hot reload using the "Start without debugging" button.

I'm not even sure where to begin trying to debug this one, so hoping you might have some ideas.

mrpmorris commented 2 years ago

I created a new project and added Fluxor and changing CSS still worked. I downloaded your repro, checked out 00a851a and changing CSS didn't work.

ryandle commented 2 years ago

Ah, I was looking at the new hot reload support for .razor file edits. I did not check CSS. Updated my original comment to be more specific. I also left out that I'm using SDK 6.0.100 (should have put a global.json in the repro, oops!)

Could you share your repo? Wondering if razor hot reload worked there too.

mrpmorris commented 2 years ago

Visual Studio -> Options -> Debugging -> .NET / C++ Hot Reload -> Apply Hot Reload on File Save

Do you have that checked?

ryandle commented 2 years ago

Yes, I have that checked. As I mentioned, on the first commit hot reload works as expected, but once fluxor is added it only works on the first page and stops working after you navigate/change routes to and 2nd page.

@mrpmorris was your new project using browser link for css syncing? I had not enabled that in my above repo.

The hot reload I'm referring to is here: https://docs.microsoft.com/en-us/aspnet/core/test/hot-reload?view=aspnetcore-6.0#blazor-webassembly

Note that for VS hot reload of blazor wasm requires running without the debugger - which I think means browser-link of css syncing wouldn't work, but blazor scoped css syncing would work because it goes through hot reload an not browser link.

ryandle commented 2 years ago

@mrpmorris - I cloned my own repo from above to double-check and this time was not able to reproduce the issue. Ugh 😞 I went through this several times yesterday before I reported it, testing the two commits to ensure it reproduced. But it seems to have been something local to my project. Thanks for looking and sorry to have wasted your time.

mrpmorris commented 2 years ago

I don't mind. Just glad you got it to work.

If you diff two projects it might be interesting to know what is different.