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.
This commit is contained in:
webdevcody
2026-01-07 15:54:17 -05:00
parent b9fcb916a6
commit 7176d3e513
2 changed files with 12 additions and 7 deletions

View File

@@ -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,

View File

@@ -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);