Repository navigation
fix(prompts): Generate by topic adds prompts to the topic by its id - #2479
Merged
Merged
Conversation
Add selected sent only the topic's name, so a topic renamed between generating and adding could put the prompts under another topic of that name, or make a new one. It now sends the topic's id too (the name alone only when there is none). importPrompts takes an id only when it is one of this brand's topics, and files the row under that topic's current name; any other id counts as none and the row goes by its name, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
gkhngyk
approved these changes
Nov 17, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good: topicId is honored only for this brand's topics, under their current name, otherwise the row falls back to the name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2473 (Generate by topic on Prompt Suggestions), from the review note there.
Problem
Add selected sent each prompt's topic by name only, although the review list already holds the topic's id. If a topic was renamed between Generate and Add selected, the prompts could land under another topic that now has the old name, or
importPromptswould create a new topic with the old name.Fix
_topic-prompts.tsx: each row now carriestopicIdalong with the topic's name. The name is used alone only when there is no id.importPrompts(lib/actions/prompt.ts): already tooktopicId, but passed it straight toimport_promptswithout checking it. It now uses an id only when the id is one of this brand's topics. The brand's topics are read bybrand_idwith the person's own client, so the id belongs to the same brand and organization. The row is then filed under the topic's current name, socategorymatches the renamed topic. Any other id is treated as no id, and the row goes by its name as before. That covers another brand's topic, another organization's topic, and a topic deleted since. Chat'sadd_prompts(addTopicPrompts) already checked its topic and works the same as before.'use server'and still exports only async functions. There is no migration and no new dependency.Tests
_topic-prompts.test.tsx: rows carry each topic's id (the rename case), and a topic with no id sends its name and notopicId.prompt-wait-on-add.test.ts:tsc, the Prompts page tests,src/lib/actions/prompt*,src/lib/chat,src/lib/mcp,src/components/chat,src/lib/help,src/i18n,use-server-exports,subscription-guard(-coverage).git merge-treeagainst current main: clean.Generated by Claude Code