Unverified Commit a6df8603 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

[turbopack] use a single query parameter for cache busting (#92214)

No need to mention `next` here, and we can just add the random noise to the timestamp
parent 9e150930
......@@ -85,12 +85,11 @@ let DEV_BACKEND: DevRuntimeBackend
// Replace or add a fresh `ts` cache-busting param without
// discarding other query parameters that may already be present.
const url = new URL(chunkUrl, location.origin)
url.searchParams.set('ts', String(Date.now()))
// Reduced timer precision in some browers could lead to an update getting dropped
// in firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// So trust that the server is only updating us when it is important and use a
// random number to bust the cache.
url.searchParams.set('_next_rand', String(Math.random()))
url.searchParams.set('ts', `${Date.now()}.${Math.random()}`)
link.href = url.pathname + url.search
} else {
link.href = chunkUrl
......
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="d770a5d4-1204-13a9-f97e-0b13896fee56")}catch(e){}}();
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="6b1795ec-fb11-0e38-172d-ade7ceac0e54")}catch(e){}}();
(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([
"output/1i9t_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js",
{"otherChunks":["output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_03ibyvs.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/input/index.js [test] (ecmascript)"]}
......@@ -2192,12 +2192,11 @@ let DEV_BACKEND;
// Replace or add a fresh `ts` cache-busting param without
// discarding other query parameters that may already be present.
const url = new URL(chunkUrl, location.origin);
url.searchParams.set('ts', String(Date.now()));
// Reduced timer precision in some browers could lead to an update getting dropped
// in firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// So trust that the server is only updating us when it is important and use a
// random number to bust the cache.
url.searchParams.set('_next_rand', String(Math.random()));
url.searchParams.set('ts', `${Date.now()}.${Math.random()}`);
link.href = url.pathname + url.search;
} else {
link.href = chunkUrl;
......@@ -2244,5 +2243,5 @@ chunkListsToRegister.forEach(registerChunkList);
})();
//# debugId=d770a5d4-1204-13a9-f97e-0b13896fee56
//# debugId=6b1795ec-fb11-0e38-172d-ade7ceac0e54
//# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map
\ No newline at end of file
......@@ -2191,12 +2191,11 @@ let DEV_BACKEND;
// Replace or add a fresh `ts` cache-busting param without
// discarding other query parameters that may already be present.
const url = new URL(chunkUrl, location.origin);
url.searchParams.set('ts', String(Date.now()));
// Reduced timer precision in some browers could lead to an update getting dropped
// in firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// So trust that the server is only updating us when it is important and use a
// random number to bust the cache.
url.searchParams.set('_next_rand', String(Math.random()));
url.searchParams.set('ts', `${Date.now()}.${Math.random()}`);
link.href = url.pathname + url.search;
} else {
link.href = chunkUrl;
......
......@@ -2191,12 +2191,11 @@ let DEV_BACKEND;
// Replace or add a fresh `ts` cache-busting param without
// discarding other query parameters that may already be present.
const url = new URL(chunkUrl, location.origin);
url.searchParams.set('ts', String(Date.now()));
// Reduced timer precision in some browers could lead to an update getting dropped
// in firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// So trust that the server is only updating us when it is important and use a
// random number to bust the cache.
url.searchParams.set('_next_rand', String(Math.random()));
url.searchParams.set('ts', `${Date.now()}.${Math.random()}`);
link.href = url.pathname + url.search;
} else {
link.href = chunkUrl;
......
......@@ -2191,12 +2191,11 @@ let DEV_BACKEND;
// Replace or add a fresh `ts` cache-busting param without
// discarding other query parameters that may already be present.
const url = new URL(chunkUrl, location.origin);
url.searchParams.set('ts', String(Date.now()));
// Reduced timer precision in some browers could lead to an update getting dropped
// in firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// So trust that the server is only updating us when it is important and use a
// random number to bust the cache.
url.searchParams.set('_next_rand', String(Math.random()));
url.searchParams.set('ts', `${Date.now()}.${Math.random()}`);
link.href = url.pathname + url.search;
} else {
link.href = chunkUrl;
......
......@@ -2191,12 +2191,11 @@ let DEV_BACKEND;
// Replace or add a fresh `ts` cache-busting param without
// discarding other query parameters that may already be present.
const url = new URL(chunkUrl, location.origin);
url.searchParams.set('ts', String(Date.now()));
// Reduced timer precision in some browers could lead to an update getting dropped
// in firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// So trust that the server is only updating us when it is important and use a
// random number to bust the cache.
url.searchParams.set('_next_rand', String(Math.random()));
url.searchParams.set('ts', `${Date.now()}.${Math.random()}`);
link.href = url.pathname + url.search;
} else {
link.href = chunkUrl;
......
......@@ -2191,12 +2191,11 @@ let DEV_BACKEND;
// Replace or add a fresh `ts` cache-busting param without
// discarding other query parameters that may already be present.
const url = new URL(chunkUrl, location.origin);
url.searchParams.set('ts', String(Date.now()));
// Reduced timer precision in some browers could lead to an update getting dropped
// in firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// in Firefox if it happens fast enough (in firefox precision is sometimes 100ms!).
// So trust that the server is only updating us when it is important and use a
// random number to bust the cache.
url.searchParams.set('_next_rand', String(Math.random()));
url.searchParams.set('ts', `${Date.now()}.${Math.random()}`);
link.href = url.pathname + url.search;
} else {
link.href = chunkUrl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment