From cb8d116b2d3be0fcdf499a8f867b5cc33f91dfdf Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Fri, 24 Jul 2026 23:31:11 -0700 Subject: [PATCH] FN-8568: apply new tags to open chats Assign context-menu-created tags to their open conversations immediately. - Return the created chat tag from the chat hook. - Preserve existing session tags while assigning the new tag through either creation control. - Cover Enter, Add, existing-tag, and blank-name paths. - Add a patch changeset for the chat-tag behavior fix. Files changed: .changeset/fn-8568-chat-tag-creation.md | 7 ++ packages/dashboard/app/components/ChatView.tsx | 36 ++++++++- .../__tests__/ChatView.core-interactions.test.tsx | 90 ++++++++++++++++++++++ packages/dashboard/app/hooks/useChat.ts | 4 +- 4 files changed, 133 insertions(+), 4 deletions(-) Fusion-Task-Id: FN-8568 Fusion-Task-Lineage: 38ee0e02-adbb-4b21-9058-486310da2190 Co-authored-by: Fusion (runfusion.ai) --- .changeset/fn-8568-chat-tag-creation.md | 7 ++ .../dashboard/app/components/ChatView.tsx | 36 +++++++- .../ChatView.core-interactions.test.tsx | 90 +++++++++++++++++++ packages/dashboard/app/hooks/useChat.ts | 4 +- 4 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 .changeset/fn-8568-chat-tag-creation.md diff --git a/.changeset/fn-8568-chat-tag-creation.md b/.changeset/fn-8568-chat-tag-creation.md new file mode 100644 index 0000000000..d3cdc53b82 --- /dev/null +++ b/.changeset/fn-8568-chat-tag-creation.md @@ -0,0 +1,7 @@ +--- +"@runfusion/fusion": patch +--- + +summary: Apply a newly created chat tag to the open conversation immediately. +category: fix +dev: Chat context-menu tag creation now returns and assigns the new tag ID. diff --git a/packages/dashboard/app/components/ChatView.tsx b/packages/dashboard/app/components/ChatView.tsx index 1c62c6b8cf..0184b980e6 100644 --- a/packages/dashboard/app/components/ChatView.tsx +++ b/packages/dashboard/app/components/ChatView.tsx @@ -3167,6 +3167,38 @@ export function ChatView({ projectId, addToast, floating = false, compactLayout ? filteredSessions.find((session) => session.id === contextMenu.sessionId) ?? (activeSession?.id === contextMenu.sessionId ? activeSession : undefined) : undefined; + /** + * FNXC:ChatTags 2026-07-24-23:19: + * A tag created from a session context menu must be assigned to that open session immediately, + * preserving its existing tags so the user never has to select the newly created tag twice. + */ + const handleCreateTagForSession = useCallback(async () => { + const name = newTagName.trim(); + if (!name) return; + + let tag; + try { + tag = await createTag(name); + } catch { + addToast(t("chat.failedToCreateTag", "Failed to create tag"), "error"); + return; + } + + if (contextMenu?.sessionId) { + const tagIds = (contextMenuSession?.tags ?? []).map((candidate) => candidate.id); + if (!tagIds.includes(tag.id)) { + try { + await setSessionTags(contextMenu.sessionId, [...tagIds, tag.id]); + } catch { + addToast(t("chat.failedToUpdateTags", "Failed to update tags"), "error"); + return; + } + } + } + + setNewTagName(""); + }, [addToast, contextMenu, contextMenuSession, createTag, newTagName, setSessionTags, t]); + const mobileDirectSessionSwitcher = showMobileSessionSwitcher ? (
+ setNewTagName(event.target.value)} onKeyDown={(event) => { if (event.key === "Enter") { event.preventDefault(); void handleCreateTagForSession(); } }} /> +