diff --git a/app/src/components/navigation/WorkspaceSwitcher.tsx b/app/src/components/navigation/WorkspaceSwitcher.tsx index 21f0f4d..9042ca5 100644 --- a/app/src/components/navigation/WorkspaceSwitcher.tsx +++ b/app/src/components/navigation/WorkspaceSwitcher.tsx @@ -110,10 +110,10 @@ const WorkspaceSwitcher: React.FC = () => { ) : ( workspaces.map((workspace) => { - const isSelected = workspace.name === currentWorkspace?.name; + const isSelected = workspace.id === currentWorkspace?.id; return ( diff --git a/app/src/components/settings/workspace/WorkspaceSettings.tsx b/app/src/components/settings/workspace/WorkspaceSettings.tsx index e02390e..73598ff 100644 --- a/app/src/components/settings/workspace/WorkspaceSettings.tsx +++ b/app/src/components/settings/workspace/WorkspaceSettings.tsx @@ -75,11 +75,9 @@ const WorkspaceSettings: React.FC = () => { const { currentWorkspace, updateSettings, updateColorScheme, colorScheme } = useWorkspace(); const { settingsModalVisible, setSettingsModalVisible } = useModalContext(); const [state, dispatch] = useReducer(settingsReducer, initialState); - const isInitialMount = useRef(true); useEffect(() => { - if (isInitialMount.current && currentWorkspace) { - isInitialMount.current = false; + if (currentWorkspace && settingsModalVisible) { const settings: Partial = { name: currentWorkspace.name, theme: currentWorkspace.theme, @@ -96,7 +94,7 @@ const WorkspaceSettings: React.FC = () => { }; dispatch({ type: SettingsActionType.INIT_SETTINGS, payload: settings }); } - }, [currentWorkspace]); + }, [currentWorkspace, settingsModalVisible]); const handleInputChange = useCallback( (key: K, value: Workspace[K]): void => {