mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 15:44:21 +00:00
Fix workspace selection logic and update settings initialization conditions
This commit is contained in:
@@ -110,10 +110,10 @@ const WorkspaceSwitcher: React.FC = () => {
|
||||
</Center>
|
||||
) : (
|
||||
workspaces.map((workspace) => {
|
||||
const isSelected = workspace.name === currentWorkspace?.name;
|
||||
const isSelected = workspace.id === currentWorkspace?.id;
|
||||
return (
|
||||
<Paper
|
||||
key={workspace.name}
|
||||
key={workspace.id}
|
||||
p="xs"
|
||||
withBorder
|
||||
style={(theme) =>
|
||||
|
||||
@@ -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<boolean>(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (isInitialMount.current && currentWorkspace) {
|
||||
isInitialMount.current = false;
|
||||
if (currentWorkspace && settingsModalVisible) {
|
||||
const settings: Partial<Workspace> = {
|
||||
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(
|
||||
<K extends keyof Workspace>(key: K, value: Workspace[K]): void => {
|
||||
|
||||
Reference in New Issue
Block a user