From 7176d3e513edb059cabc92b91fa627f81258806d Mon Sep 17 00:00:00 2001 From: webdevcody Date: Wed, 7 Jan 2026 15:54:17 -0500 Subject: [PATCH] fix: enhance sandbox compatibility checks in sdk-options and improve login view effect handling - Added additional cloud storage path patterns for macOS and Linux to the checkSandboxCompatibility function, ensuring better compatibility with sandbox environments. - Revised the login view to simplify the initial server/session check logic, removing unnecessary ref guard and improving responsiveness during component unmounting. --- apps/server/src/lib/sdk-options.ts | 7 +++++++ apps/ui/src/components/views/login-view.tsx | 12 +++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/server/src/lib/sdk-options.ts b/apps/server/src/lib/sdk-options.ts index e0edcb91..4d3e670f 100644 --- a/apps/server/src/lib/sdk-options.ts +++ b/apps/server/src/lib/sdk-options.ts @@ -60,14 +60,21 @@ export function checkSandboxCompatibility( // Check for cloud storage paths that may not be compatible with sandbox const cloudStoragePatterns = [ + // macOS mounted volumes /^\/Volumes\/GoogleDrive/i, /^\/Volumes\/Dropbox/i, /^\/Volumes\/OneDrive/i, /^\/Volumes\/iCloud/i, + // macOS home directory /^\/Users\/[^/]+\/Google Drive/i, /^\/Users\/[^/]+\/Dropbox/i, /^\/Users\/[^/]+\/OneDrive/i, /^\/Users\/[^/]+\/Library\/Mobile Documents/i, // iCloud + // Linux home directory + /^\/home\/[^/]+\/Google Drive/i, + /^\/home\/[^/]+\/Dropbox/i, + /^\/home\/[^/]+\/OneDrive/i, + // Windows /^C:\\Users\\[^\\]+\\Google Drive/i, /^C:\\Users\\[^\\]+\\Dropbox/i, /^C:\\Users\\[^\\]+\\OneDrive/i, diff --git a/apps/ui/src/components/views/login-view.tsx b/apps/ui/src/components/views/login-view.tsx index 4d436f09..87a5aef0 100644 --- a/apps/ui/src/components/views/login-view.tsx +++ b/apps/ui/src/components/views/login-view.tsx @@ -11,7 +11,7 @@ * checking_setup → redirecting */ -import { useReducer, useEffect, useRef } from 'react'; +import { useReducer, useEffect } from 'react'; import { useNavigate } from '@tanstack/react-router'; import { login, getHttpApiClient, getServerUrlSync } from '@/lib/http-api-client'; import { Button } from '@/components/ui/button'; @@ -232,13 +232,12 @@ export function LoginView() { const navigate = useNavigate(); const setAuthState = useAuthStore((s) => s.setAuthState); const [state, dispatch] = useReducer(reducer, initialState); - const initialCheckDone = useRef(false); - // Run initial server/session check once on mount + // Run initial server/session check on mount. + // IMPORTANT: Do not "run once" via a ref guard here. + // In React StrictMode (dev), effects mount -> cleanup -> mount. + // If we abort in cleanup and also skip the second run, we'll get stuck forever on "Connecting...". useEffect(() => { - if (initialCheckDone.current) return; - initialCheckDone.current = true; - const controller = new AbortController(); checkServerAndSession(dispatch, setAuthState, controller.signal); @@ -272,7 +271,6 @@ export function LoginView() { // Handle retry button for server errors const handleRetry = () => { - initialCheckDone.current = false; dispatch({ type: 'RETRY_SERVER_CHECK' }); const controller = new AbortController(); checkServerAndSession(dispatch, setAuthState, controller.signal);