A local-first personal finance app
:bug: Fix app failing to start when opened offline (#9025)
Michael Clark09c47beb6665
diff --git a/packages/desktop-client/vite.config.mts b/packages/desktop-client/vite.config.mtsindex cab3ce3bc9..b27a364839 100644--- a/packages/desktop-client/vite.config.mts+++ b/packages/desktop-client/vite.config.mts@@ -125,6 +125,10 @@ async function stagePluginsService(): Promise<void> {await cp(pluginsServiceDistDir, serviceWorkerDir, { recursive: true });}+// Extensions of data files served to the backend worker. Keep in sync+// with the workbox `globPatterns` below so every listed file is precached.+const DATA_FILE_EXTENSIONS = new Set(['.sql', '.js', '.sqlite']);+async function stagePublicData(): Promise<void> {const migrationsDest = path.resolve(publicDataDir, 'migrations');await mkdir(publicDataDir, { recursive: true });@@ -146,10 +150,10 @@ async function stagePublicData(): Promise<void> {.relative(publicDataDir, path.join(e.parentPath, e.name)).replaceAll(path.sep, '/'),)- // Skip dotfiles (e.g. legacy `.force-copy-windows` marker). They have no- // matching extension in the workbox precache globs, so a PWA opened- // offline would fail to fetch them and break startup (issue #7886).+ // Only list files the backend needs and the workbox precache globs+ // cover; anything else fails to load offline and breaks startup..filter(file => !file.split('/').some(part => part.startsWith('.')))+ .filter(file => DATA_FILE_EXTENSIONS.has(path.extname(file))).sort();await writeFile(path.resolve(publicDir, 'data-file-index.txt'),diff --git a/upcoming-release-notes/fix-offline-startup.md b/upcoming-release-notes/fix-offline-startup.mdnew file mode 100644index 0000000000..34a7ae624d--- /dev/null+++ b/upcoming-release-notes/fix-offline-startup.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [MikesGlitch]+---++Fix the app failing to start when opened offline in the browser