Hashless assets (#4312)

* add support for external assets

* fix playwright tests

* add more documentation to with_hash_suffix

* restore external asset hashing tests

* Update gtk workflow dependencies

* fix doc test

* multiple versions of libgtk

* clear dx in playwright tests

* fix fullstack caching test

* try without apt cache

* cache everything except libxdo-dev

* revert ci changes

* fix wasm asset options

* fix merge conflict

* recommend the used attribute instead

* Move options to AssetOptionsBuilder

* Don't deprecate non-canonical new asset options functions

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2025-06-30 19:21:49 -07:00
1 parent 0bd376b873
commit e74c838441
22 files changed
+569 -316

No files matched your search

+27 -20
View File
@@ -75,6 +75,13 @@ test("assets cache correctly", async ({ page }) => {
console.log("Response URL:", resp.url());
return resp.url().includes("/assets/image-") && resp.status() === 200;
});
const assetImageFuture = page.waitForResponse(
(resp) => resp.url().includes("/assets/image.png") && resp.status() === 200
);
const nestedAssetImageFuture = page.waitForResponse(
(resp) =>
resp.url().includes("/assets/nested/image.png") && resp.status() === 200
);
// Navigate to the page that includes the image.
await page.goto("http://localhost:3333");
@@ -86,27 +93,27 @@ test("assets cache correctly", async ({ page }) => {
console.log("Cache-Control header:", cacheControl);
expect(cacheControl).toContain("immutable");
// TODO: raw assets support was removed and needs to be restored
// https://github.com/DioxusLabs/dioxus/issues/4115
// // Wait for the asset image to be loaded
// const assetImageResponse = await page.waitForResponse(
// (resp) => resp.url().includes("/assets/image.png") && resp.status() === 200
// );
// // Make sure the asset image cache control header does not contain immutable
// const assetCacheControl = assetImageResponse.headers()["cache-control"];
// console.log("Cache-Control header:", assetCacheControl);
// expect(assetCacheControl).not.toContain("immutable");
// Wait for the asset image to be loaded
const assetImageResponse = await assetImageFuture;
console.log("Asset Image Response:", assetImageResponse);
// Make sure the asset image cache control header does not contain immutable
const assetCacheControl = assetImageResponse.headers()["cache-control"];
console.log("Cache-Control header:", assetCacheControl);
// Expect there to be no cache control header
expect(assetCacheControl).toBeFalsy();
// // Wait for the nested asset image to be loaded
// const nestedAssetImageResponse = await page.waitForResponse(
// (resp) =>
// resp.url().includes("/assets/nested/image.png") && resp.status() === 200
// );
// // Make sure the nested asset image cache control header does not contain immutable
// const nestedAssetCacheControl =
// nestedAssetImageResponse.headers()["cache-control"];
// console.log("Cache-Control header:", nestedAssetCacheControl);
// expect(nestedAssetCacheControl).not.toContain("immutable");
// Wait for the nested asset image to be loaded
const nestedAssetImageResponse = await nestedAssetImageFuture;
console.log(
"Nested Asset Image Response:",
nestedAssetImageResponse
);
// Make sure the nested asset image cache control header does not contain immutable
const nestedAssetCacheControl =
nestedAssetImageResponse.headers()["cache-control"];
console.log("Cache-Control header:", nestedAssetCacheControl);
// Expect there to be no cache control header
expect(nestedAssetCacheControl).toBeFalsy();
});
test("websockets", async ({ page }) => {