From f4c33ad96e5c64a8be1f6fa2043686ac8f34517e Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Thu, 31 Jul 2025 22:40:34 +0400 Subject: [PATCH] fix: always disable browser while it is updating --- src/app/page.tsx | 1 + src/components/profile-data-table.tsx | 4 ++-- src/components/profile-selector-dialog.tsx | 4 +++- src/hooks/use-browser-support.ts | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 4a39ea7..c7eb9d9 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -833,6 +833,7 @@ export default function Home() { ); }} url={pendingUrl.url} + isUpdating={isUpdating} runningProfiles={runningProfiles} /> ))} diff --git a/src/components/profile-data-table.tsx b/src/components/profile-data-table.tsx index 42b6529..38aeb4e 100644 --- a/src/components/profile-data-table.tsx +++ b/src/components/profile-data-table.tsx @@ -68,7 +68,7 @@ interface ProfilesDataTableProps { onChangeVersion: (profile: BrowserProfile) => void; onConfigureCamoufox?: (profile: BrowserProfile) => void; runningProfiles: Set; - isUpdating?: (browser: string) => boolean; + isUpdating: (browser: string) => boolean; onReloadProxyData?: () => void | Promise; onDeleteSelectedProfiles?: (profileNames: string[]) => Promise; onAssignProfilesToGroup?: (profileNames: string[]) => void; @@ -87,7 +87,7 @@ export function ProfilesDataTable({ onChangeVersion, onConfigureCamoufox, runningProfiles, - isUpdating = () => false, + isUpdating, onDeleteSelectedProfiles: _onDeleteSelectedProfiles, onAssignProfilesToGroup, selectedGroupId, diff --git a/src/components/profile-selector-dialog.tsx b/src/components/profile-selector-dialog.tsx index 565c1ed..2611de6 100644 --- a/src/components/profile-selector-dialog.tsx +++ b/src/components/profile-selector-dialog.tsx @@ -34,6 +34,7 @@ import type { BrowserProfile, StoredProxy } from "@/types"; interface ProfileSelectorDialogProps { isOpen: boolean; onClose: () => void; + isUpdating: (browser: string) => boolean; url?: string; runningProfiles?: Set; } @@ -43,6 +44,7 @@ export function ProfileSelectorDialog({ onClose, url, runningProfiles = new Set(), + isUpdating, }: ProfileSelectorDialogProps) { const [profiles, setProfiles] = useState([]); const [selectedProfile, setSelectedProfile] = useState(null); @@ -51,7 +53,7 @@ export function ProfileSelectorDialog({ const [storedProxies, setStoredProxies] = useState([]); // Use shared browser state hook - const browserState = useBrowserState(profiles, runningProfiles); + const browserState = useBrowserState(profiles, runningProfiles, isUpdating); // Helper function to check if a profile has a proxy const hasProxy = useCallback( diff --git a/src/hooks/use-browser-support.ts b/src/hooks/use-browser-support.ts index a63cce4..b727b9d 100644 --- a/src/hooks/use-browser-support.ts +++ b/src/hooks/use-browser-support.ts @@ -1,5 +1,6 @@ import { invoke } from "@tauri-apps/api/core"; import { useCallback, useEffect, useState } from "react"; +import { getBrowserDisplayName } from "@/lib/browser-utils"; import type { BrowserProfile } from "@/types"; export function useBrowserSupport() { @@ -168,7 +169,7 @@ export function useBrowserState( } if (isBrowserUpdating) { - return `${profile.browser} is being updated. Please wait for the update to complete.`; + return `${getBrowserDisplayName(profile.browser)} is being updated. Please wait for the update to complete.`; } if (