mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +08:00
Optimize PWA state restoration and loading experience
Co-authored-by: jxxghp <jxxghp@163.com>
This commit is contained in:
+10
-2
@@ -60,6 +60,8 @@ export default defineConfig({
|
||||
revision: null,
|
||||
},
|
||||
],
|
||||
// 启用导航预加载
|
||||
navigationPreload: true,
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: /\.(?:js|css|html)$/,
|
||||
@@ -115,10 +117,16 @@ export default defineConfig({
|
||||
},
|
||||
{
|
||||
urlPattern: ({ request }) => request.destination === 'document',
|
||||
handler: 'NetworkFirst',
|
||||
handler: 'StaleWhileRevalidate',
|
||||
options: {
|
||||
cacheName: 'pages-cache',
|
||||
networkTimeoutSeconds: 10,
|
||||
cacheKeyWillBeUsed: async ({ request }) => {
|
||||
// 忽略状态参数,提高缓存命中率
|
||||
const url = new URL(request.url)
|
||||
url.searchParams.delete('restored')
|
||||
url.searchParams.delete('t')
|
||||
return url.toString()
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user