diff --git a/apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx b/apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx index e644cd77129..2126016845b 100644 --- a/apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx +++ b/apps/desktop/src/renderer/components/NewWorkspaceModal/NewWorkspaceModal.tsx @@ -27,7 +27,6 @@ import { SelectValue, } from "@superset/ui/select"; import { toast } from "@superset/ui/sonner"; -import debounce from "lodash/debounce"; import { useEffect, useMemo, useRef, useState } from "react"; import { GoGitBranch } from "react-icons/go"; import { HiCheck, HiChevronDown, HiChevronUpDown } from "react-icons/hi2"; @@ -63,8 +62,6 @@ export function NewWorkspaceModal() { const [selectedProjectId, setSelectedProjectId] = useState( null, ); - // Use local title for immediate input feedback, debounce updates to derived state - const [localTitle, setLocalTitle] = useState(""); const [title, setTitle] = useState(""); const [branchName, setBranchName] = useState(""); const [branchNameEdited, setBranchNameEdited] = useState(false); @@ -75,25 +72,6 @@ export function NewWorkspaceModal() { const [showAdvanced, setShowAdvanced] = useState(false); const titleInputRef = useRef(null); - // Debounced title update to reduce re-renders from derived state calculations - const debouncedSetTitle = useMemo( - () => debounce((value: string) => setTitle(value), 150), - [], - ); - - // Cleanup debounced function on unmount - useEffect(() => { - return () => { - debouncedSetTitle.cancel(); - }; - }, [debouncedSetTitle]); - - const handleTitleChange = (e: React.ChangeEvent) => { - const value = e.target.value; - setLocalTitle(value); // Immediate update for responsive typing - debouncedSetTitle(value); // Debounced update for derived state - }; - const { data: recentProjects = [] } = electronTrpc.projects.getRecents.useQuery(); const { @@ -141,7 +119,6 @@ export function NewWorkspaceModal() { const resetForm = () => { setSelectedProjectId(null); - setLocalTitle(""); setTitle(""); setBranchName(""); setBranchNameEdited(false); @@ -188,8 +165,7 @@ export function NewWorkspaceModal() { const handleCreateWorkspace = async () => { if (!selectedProjectId) return; - // Use localTitle for the actual value (in case debounce hasn't fired yet) - const workspaceName = localTitle.trim() || undefined; + const workspaceName = title.trim() || undefined; const customBranchName = branchName.trim() || undefined; try { @@ -285,15 +261,15 @@ export function NewWorkspaceModal() { id="title" className="h-9 text-sm" placeholder="Feature name (press Enter to create)" - value={localTitle} - onChange={handleTitleChange} + value={title} + onChange={(e) => setTitle(e.target.value)} /> - {localTitle && !showAdvanced && ( + {title && !showAdvanced && (

- {branchName || generateBranchFromTitle(localTitle)} + {branchName || generateBranchFromTitle(title)} from {effectiveBaseBranch} @@ -323,8 +299,8 @@ export function NewWorkspaceModal() { id="branch" className="h-8 text-sm font-mono" placeholder={ - localTitle - ? generateBranchFromTitle(localTitle) + title + ? generateBranchFromTitle(title) : "auto-generated" } value={branchName}