Skip to content

Commit 1ec5870

Browse files
t3dotggclaude
andcommitted
fix(web): clear stale header rename draft on thread change
Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 4928d2d commit 1ec5870

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/web/src/components/chat/ChatHeader.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,13 @@ export const ChatHeader = memo(function ChatHeader({
131131
const updateThreadMetadata = useAtomCommand(threadEnvironment.updateMetadata, {
132132
reportFailure: false,
133133
});
134-
// Inline rename, keyed by thread: navigating away silently drops an
135-
// in-progress rename instead of committing stale text to the new thread.
134+
// Inline rename, keyed by thread: navigating away drops an in-progress
135+
// rename instead of committing stale text. Cleared on thread change (not
136+
// just hidden) so returning to the thread doesn't revive the old draft.
136137
const [renaming, setRenaming] = useState<{ threadId: ThreadId; title: string } | null>(null);
138+
if (renaming !== null && renaming.threadId !== activeThreadId) {
139+
setRenaming(null);
140+
}
137141
const renamingTitle = renaming?.threadId === activeThreadId ? renaming.title : null;
138142
const renameCommittedRef = useRef(false);
139143
const startRename = useCallback(() => {

0 commit comments

Comments
 (0)