-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When I publish my Blazor WASM project, the old client side DLLs are cached, and the cache does not seem to be busted. I have scanned through a few examples/issues/documents looking for the correct approach to accomplish busting the caches on new publishes, including:
- Blazor WebAssembly - very aggressive caching #29095
- Host and deploy ASP.NET Core Blazor WebAssembly
- URL Rewriting Middleware
- Bypass HTTP browser cache when using HttpClient in Blazor WebAssembly
- Cache Busting in Blazor WASM
But I'm still unsure what the "correct"/"recommended" route is here. I suggested adding this to the Host and deploy ASP.NET Core Blazor WebAssembly document, and was referred here to request the recommendation from the product unit.
What is the "correct"/"expected" approach to bust cache for Blazor WASM projects? Please also note this information may be / is likely out there somewhere, but I have not yet figured out where (though I have spent significant time researching).
cc: @guardrex dotnet/AspNetCore.Docs#24748
Expected Behavior
When deploying a new publish of a project, somehow indicate to client browsers to redownload the DLLs/runtime code.
Steps To Reproduce
- Create the default Blazor WASM project using the current 6.0.0 templates. I'm using Identity Hosted and set the project as a PWA.
- Publish & deploy it (by any means, I'm deploying to AWS using Docker containers).
- Make a change to Counter.razor (make it count by 2 or something).
- Publish & deploy once more.
- Visit your site. See that the client side component is cached, and clicking the Counter button, that the count still goes up by 1, not 2. Once a "hard refresh" has been done (
Ctl+Shift+F
) then the counter will grow by 2 on each click.
Exceptions (if any)
No response
.NET Version
6.0.0
Anything else?
No response