Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
return type === 'dotnetjs'
? `${defaultUri}?customizedbootresource=true`
: fetch(defaultUri, { integrity: integrity, cache: 'no-cache', headers: { 'customizedbootresource': 'true' } });
},
configureRuntime: function (builder) {
builder.withConfig({
cachedResourcesPurgeDelay: 0
});
}
});
</script>
Expand Down
12 changes: 10 additions & 2 deletions src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,17 @@ public async Task IncrementallyUpdatesCache()
requestedDll => Assert.Contains("/Microsoft.AspNetCore.Components.wasm", requestedDll),
requestedDll => Assert.Contains("/dotnet.native.wasm", requestedDll));

// We also update the cache (add new items, remove unnecessary items)
await Task.Delay(10500); // wait for cache purge, which is 10 seconds delayed after app start
var cacheEntryUrls3 = GetCacheEntryUrls();
// wait until the cache was cleaned, max 500ms
for (var i = 0; i < 5; i++)
{
if (!cacheEntryUrls3.Contains(cacheEntryForDotNetWasmWithChangedHash))
{
break;
}
await Task.Delay(100); // wait for cache purge
cacheEntryUrls3 = GetCacheEntryUrls();
}
Assert.Contains(cacheEntryForComponentsDll, cacheEntryUrls3);
Assert.Contains(cacheEntryForDotNetWasm, cacheEntryUrls3);
Assert.DoesNotContain(cacheEntryForDotNetWasmWithChangedHash, cacheEntryUrls3);
Expand Down