fix(tab-naming): cancel automatic naming when manual rename is triggered

When user opens the rename modal, clear isGeneratingName flag to stop
showing the spinner. Also clear the flag when the rename is confirmed
to prevent any race conditions with the automatic naming completing.
This commit is contained in:
Pedram Amini
2026-02-02 23:23:05 -06:00
parent 3a56648fc1
commit c2f4afe2cd

View File

@@ -5971,6 +5971,18 @@ You are taking over this conversation. Based on the context above, provide a bri
if (!session) return;
const tab = session.aiTabs?.find((t) => t.id === tabId);
if (tab) {
// Cancel automatic tab naming if in progress (user is manually renaming)
if (tab.isGeneratingName) {
setSessions((prev) =>
prev.map((s) => {
if (s.id !== activeSessionIdRef.current) return s;
return {
...s,
aiTabs: s.aiTabs.map((t) => (t.id === tabId ? { ...t, isGeneratingName: false } : t)),
};
})
);
}
setRenameTabId(tabId);
setRenameTabInitialName(getInitialRenameValue(tab));
setRenameTabModalOpen(true);
@@ -8752,7 +8764,8 @@ You are taking over this conversation. Based on the context above, provide a bri
return {
...s,
aiTabs: s.aiTabs.map((tab) =>
tab.id === renameTabId ? { ...tab, name: newName || null } : tab
// Clear isGeneratingName to cancel any in-progress automatic naming
tab.id === renameTabId ? { ...tab, name: newName || null, isGeneratingName: false } : tab
),
};
})