Skip to content

A local-first personal finance app

:iphone: Fallback to direct worker on ios (#7971)

Michael Clarkd12ee3a45e6a
diff --git a/packages/desktop-client/src/browser-preload.js b/packages/desktop-client/src/browser-preload.js
index c91e93a6ac..7ed41fe6b5 100644
--- a/packages/desktop-client/src/browser-preload.js
+++ b/packages/desktop-client/src/browser-preload.js
@@ -260,9 +260,14 @@ function createBackendWorker() {
// Each budget gets its own leader tab running a dedicated Worker. All other
// tabs on the same budget are followers — their messages are routed through
// the SharedWorker to the leader's Worker.
- // The SharedWorker never touches SharedArrayBuffer, so this works on all
- // platforms including iOS/Safari.
- if (typeof SharedWorker !== 'undefined' && !Platform.isPlaywright) {
+ // iOS is excluded: navigation to an OIDC provider and back creates a new
+ // SharedWorker port connection, leaving the returning tab stuck as UNASSIGNED
+ // with no backend Worker. The direct Worker fallback avoids this entirely.
+ if (
+ typeof SharedWorker !== 'undefined' &&
+ !Platform.isPlaywright &&
+ !Platform.isIOS
+ ) {
try {
const sharedWorker = new SharedBrowserServerWorker({
name: 'actual-backend',
@@ -303,8 +308,12 @@ function createBackendWorker() {
}
}
- // Fallback: regular Worker (Playwright, no SharedWorker support, or failure)
- console.log('[WorkerBridge] No SharedWorker available, using direct Worker');
+ // Fallback: regular Worker (Playwright, iOS, no SharedWorker support, or failure)
+ console.log(
+ Platform.isIOS
+ ? '[WorkerBridge] iOS detected, using direct Worker'
+ : '[WorkerBridge] No SharedWorker available, using direct Worker',
+ );
worker = new Worker(backendWorkerUrl);
initSQLBackend(worker);
diff --git a/packages/loot-core/src/shared/platform.electron.ts b/packages/loot-core/src/shared/platform.electron.ts
index 0d6b8b2723..6c44ede662 100644
--- a/packages/loot-core/src/shared/platform.electron.ts
+++ b/packages/loot-core/src/shared/platform.electron.ts
@@ -19,3 +19,4 @@ export const env: typeof T.env = 'unknown';
export const isBrowser: typeof T.isBrowser = false;
export const isIOSAgent: typeof T.isIOSAgent = false;
+export const isIOS: typeof T.isIOS = false;
diff --git a/packages/loot-core/src/shared/platform.ts b/packages/loot-core/src/shared/platform.ts
index f4bc5f57f6..3088aec2df 100644
--- a/packages/loot-core/src/shared/platform.ts
+++ b/packages/loot-core/src/shared/platform.ts
@@ -18,3 +18,5 @@ export const isBrowser: boolean = true;
const agent = UAParser(navigator.userAgent);
export const isIOSAgent = agent.browser.name === 'Mobile Safari';
+// True for all browsers on iOS (iPhone/iPad/iPod) — not macOS.
+export const isIOS = agent.os.name === 'iOS';
diff --git a/upcoming-release-notes/7971.md b/upcoming-release-notes/7971.md
new file mode 100644
index 0000000000..762b118f29
--- /dev/null
+++ b/upcoming-release-notes/7971.md
@@ -0,0 +1,6 @@
+---
+category: Bugfixes
+authors: [MikesGlitch]
+---
+
+Fix OIDC login on iOS