fix(desktop): serve packaged index.html with no-store
The openchamber-ui:// handler returned index.html without cache headers, so the renderer disk cache could keep a freshly installed build loading the previous version's hashed bundles. Hashed assets stay cacheable; only the document that names them must not be.
This commit is contained in:
@@ -1240,7 +1240,15 @@ const registerPackagedUiProtocol = () => {
|
|||||||
if (filePath.endsWith('.html')) {
|
if (filePath.endsWith('.html')) {
|
||||||
const html = await fsp.readFile(filePath, 'utf8');
|
const html = await fsp.readFile(filePath, 'utf8');
|
||||||
const body = injectRuntimeConfigIntoHtml(html);
|
const body = injectRuntimeConfigIntoHtml(html);
|
||||||
return new Response(body, { headers: { 'Content-Type': 'text/html; charset=utf-8' } });
|
// index.html must never be cached: it names the hashed asset
|
||||||
|
// bundles, and a cached copy keeps a freshly installed build
|
||||||
|
// loading the previous version's UI from the renderer disk cache.
|
||||||
|
return new Response(body, {
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'text/html; charset=utf-8',
|
||||||
|
'Cache-Control': 'no-store',
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return electronNet.fetch(pathToFileURL(filePath).toString());
|
return electronNet.fetch(pathToFileURL(filePath).toString());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user