Fix frontend UX: debounce saves, Zustand selectors, init race, dialog
- Debounce project config saves: use local state + save-on-blur instead of firing IPC requests on every keystroke in text inputs - Add Zustand selectors to all store consumers to prevent full-store re-renders on any state change - Fix initialization race: chain checkImage after checkDocker resolves - Fix DockerSettings setTimeout race: await checkImage after save - Add console.error logging to all 11 empty catch blocks in ProjectCard - Add keyboard support to AddProjectDialog: Escape to close, click-outside-to-close, form submit on Enter, auto-focus Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useCallback } from "react";
|
||||
import { useShallow } from "zustand/react/shallow";
|
||||
import { useAppState } from "../store/appState";
|
||||
import * as commands from "../lib/tauri-commands";
|
||||
|
||||
@@ -10,7 +11,16 @@ export function useProjects() {
|
||||
setSelectedProject,
|
||||
updateProjectInList,
|
||||
removeProjectFromList,
|
||||
} = useAppState();
|
||||
} = useAppState(
|
||||
useShallow(s => ({
|
||||
projects: s.projects,
|
||||
selectedProjectId: s.selectedProjectId,
|
||||
setProjects: s.setProjects,
|
||||
setSelectedProject: s.setSelectedProject,
|
||||
updateProjectInList: s.updateProjectInList,
|
||||
removeProjectFromList: s.removeProjectFromList,
|
||||
}))
|
||||
);
|
||||
|
||||
const selectedProject = projects.find((p) => p.id === selectedProjectId) ?? null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user