Skip to content

Product Unit Recommendation On How To Cache Bust Blazor WASM Files #39791

@taylorchasewhite

Description

@taylorchasewhite

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:

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

  1. 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.
  2. Publish & deploy it (by any means, I'm deploying to AWS using Docker containers).
  3. Make a change to Counter.razor (make it count by 2 or something).
  4. Publish & deploy once more.
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor Componentsfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyquestion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions