Guard commitRename cleanup against concurrent renames

After the async dispatch, only clear renamingThreadId if it still
matches the thread being renamed, preventing a second rename's
input from being cleared by the first's completion.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Opus 4.6 authored and Julius Marminge committed 2026-03-02 13:49:04 -08:00
1 parent 674720c6cd
commit c530e5d50f
1 file changed
+5 -1
+5 -1
View File
@@ -543,7 +543,11 @@ export default function Sidebar() {
description: error instanceof Error ? error.message : "An error occurred.",
});
}
cancelRename();
setRenamingThreadId((current) => {
if (current !== threadId) return current;
renamingInputRef.current = null;
return null;
});
},
[cancelRename],
);