-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[browser] Cache identity per query string #85775
Comments
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsThe cache in the Therefore the cache is not loaded when user arrived from external deep link If we fully migrate to assets hashes in the asset name, we could drop @maraf suggested that we could generate Application GUID during build. I guess we would put it into the
|
cc @javiercn thoughts ? |
I believe the cache key could/should be similar to what @pavelsavara implemented for memory snapshot cache - hash of all configuration params + assets hashes |
I think we could still do this in net8 after #89435 |
It may improve situation for dotnet/aspnetcore#41353 |
I think we are close to be able to drop the custom |
After the last discussion, this is not the case ATM. Keeping this open |
We agreed to drop the cache in Net10, what is holding us back now ? |
The cache is important for blazor standalone scenario (where you don't have hosting server under control). |
Putting my thoughts here just to reflect the current state of things:
With this last bit, I think we can effectively rely on the browser HTTP cache and avoid the need for a second cache. |
After asset cache is gone, we should also improve the location of cache for |
For the auto interactive we can store some flag after we finished downloading all assets. Possibly indexDB |
Rewrite index.html? What about scenarios where you want to package a .net library as an npm package? |
@onionhammer In those cases there are probably other tools in the consuming pipeline, like webpack. NPM packages typically don't contain fingerprinted assets and fingerprintg/bundling/etc is done by the consumer. Am I missing something? |
@maraf more and more, bundlers are able to work with wasm assets, and yes there is some javascript bootstrapping that comes along for the ride when you build a package; the best thing dotnet could do here is bundle the generated assets in a way that javascript bundlers are pretty much all designed to work with - think webpack, bun, vite, deno, etc. I have a project that I am attempting to get open-sourced that creates a simple interpreted scripting/expression language - like NCalc, but it works both from .NET and the browser. I had to write a huge vite plugin for our (internal) purposes in order to bootstrap the output of the _framework directory in because the dotnet compiler's output does not provide a good starting point - I fear this direction of trying to generate the html will make things even worse. I haven't worked on it in 10 months, so I would need to brush up on things a bit to provide a more detailed analysis - but we still rely on this project heavily, and I would like to open source it. This issue just set off some alarm bells. IMO, the simplest way to improve the cache-bustability is just to name output files with a hash in them i.e. dotnet.runtime.123feewf.js Even with my huge vite plugin, it still doesnt cache-bust properly, hence my interest in this issue. |
@onionhammer I'm sorry for late reply. There are several things.
For integration with bundlers (and/or distribution as npm package), I would assume that fingerprinting on .NET side would be turned off and the javascript bundler would do the work of combining/splitting/fingerprinting/etc with the rest of the JS app. Is that assumption correct? Anyway, this issue is just about custom cache that we currently have and whether fingerprinting can make it obsolete/removed. |
IMO the best approach would just to be to have a build flag that can be set on the compiler, and perhaps also minify/obfuscation preferences, which just switches everything over to generate normal bundler friendly ES module code rather than obfuscated/minified... whatever is going on inside of dotnet.js
Yes, thats the best case scenario, if you could import the library generated directly into something like node/vite/rollup/bun/deno etc. Some of these may have different ways of handling wasm. I just upgraded my project to .net 9 to play with it, and it is indeed an improvement to have the filenames hashed (other than blazor.boot.json), so I'm also subscribing to the #blaazorboo issue. |
The cache in the
WebAssemblyResourceLoader
and also the memory snapshot creates different cache for each app.The current logic takes
index.html?item=123
out ofhttp://localhost:53504/index.html?item=123
as cache name.Therefore the cache is not loaded when user arrived from external deep link
item=123
or if the same app has multiple html pages.If we fully migrate to assets hashes in the asset name, we could drop
WebAssemblyResourceLoader
.But the problem would stay for memory snapshot.@maraf suggested that we could generate Application GUID during build. I guess we would put it into the
boot.config.json
?The text was updated successfully, but these errors were encountered: