Skip to content

[Blazor] Prepare for custom cache removal #61666

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

maraf
Copy link
Member

@maraf maraf commented Apr 24, 2025

In the dotnet/runtime#114901 we are removing custom cache. The current auto render mode detection is based on assumption "has user previously used the current version (hash) of application?". Whether custom cache was used or not should not matter, as proper HTTP cache should ensure all the assets are cached.

  • Disable custom cache in tests
  • Update custom cache related tests to just test subsequent app visit results in 304 for all requests

@maraf maraf added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly labels Apr 24, 2025
@maraf maraf added this to the 10.0-preview5 milestone Apr 24, 2025
@maraf maraf self-assigned this Apr 24, 2025
@maraf maraf marked this pull request as ready for review April 30, 2025 15:57
@maraf maraf requested a review from a team as a code owner April 30, 2025 15:57
pavelsavara
pavelsavara previously approved these changes May 2, 2025
@maraf
Copy link
Member Author

maraf commented May 4, 2025

As discovered in #61790, we need to update tests

@maraf maraf added the * NO MERGE * Do not merge this PR as long as this label is present. label May 4, 2025
@maraf maraf marked this pull request as draft May 6, 2025 13:07
@javiercn
Copy link
Member

javiercn commented May 6, 2025

@maraf auto used that to determine when it needed to start in wasm mode vs when it needed to start in server mode. How are we handling that?

@maraf
Copy link
Member Author

maraf commented May 6, 2025

Both tests failing on CI passed locally, re-trying

  • CanPersistMultiplePrerenderedStateDeclaratively_Auto_PersistsOnWebAssembly
  • AutoRenderMode_UsesBlazorServerOnFirstLoad_ThenWebAssemblyOnSuccessiveLoads

@maraf
Copy link
Member Author

maraf commented May 6, 2025

@maraf auto used that to determine when it needed to start in wasm mode vs when it needed to start in server mode. How are we handling that?

@javiercn It has it's own local storage item with value of assemblies hash. The check for cacheBootResources eliminated WebAssembly if cacheBootResources was disabled and the client relied on HTTP cache only

@javiercn
Copy link
Member

javiercn commented May 6, 2025

@javiercn It has it's own local storage item with value of assemblies hash. The check for cacheBootResources eliminated WebAssembly if cacheBootResources was disabled and the client relied on HTTP cache only

If I understood this correctly, we are putting a hash on local storage to track this? who's putting the hash (Blazor? the wasm runtime?) Where does it get it from? (since there's no longer a blazor.boot.json file)

@maraf
Copy link
Member Author

maraf commented May 6, 2025

https://github.com/dotnet/aspnetcore/blob/main/src/Components/Web.JS/src/Services/WebRootComponentManager.ts#L473-L479

I didn't need to touch this implementation. Blazor already did it this way.
It fetches dotnet.js which now already contains boot config. The hash is present on embedded config. BLazor compares new hash with previous and if matches, it uses WebAssembly.

@maraf maraf changed the title [Blazor] Remove the check for cacheBootResources from Auto render mode detection [Blazor] Prepare for custom cache removal May 7, 2025
@maraf maraf marked this pull request as ready for review May 7, 2025 18:40
@maraf maraf removed the * NO MERGE * Do not merge this PR as long as this label is present. label May 7, 2025
@maraf maraf requested a review from a team May 7, 2025 18:42
@maraf maraf dismissed pavelsavara’s stale review May 8, 2025 05:40

New updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants