Skip to content

feat(prompts): add every listed suggestion at once with Add All - #1299

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/prompt-suggestions-add-all
Oct 21, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/prompt-suggestions-add-all

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Prompt Suggestions gets an Add All button, between New and Clear All. It adds every suggestion on the list to Tracked Prompts, and the added ones leave the list. Like Clear All, it acts on what's listed, so a source filter or search narrows it.

How it adds (_suggestions-card.tsx)

  • It reuses trackSuggestions (Insights › Opportunities' "Track N"), in calls of up to 25.
  • Each prompt goes through addPromptToSet, so it passes the same plan check as the single +.
  • A run stops at the first failure.
  • Suggestions already accepted or dismissed elsewhere are skipped and leave the list.
  • On success: a toast "N prompts added to your tracked list" and the usage cards and table reload (onAccepted).

When the prompt limit stops it, an amber note sits above the list. Example: 25 listed, 10 slots left.

15 suggestions couldn't be added
10 were added before your plan's prompt limit was reached. Upgrade your plan, or pause 15 prompts in Tracked Prompts first and try again.

  • Buttons: Go to Tracked Prompts and the page's own PromptLimitActions (Starter: Upgrade plan + Contact us; others: Contact us). These are passed down through SuggestionsTab as limitActions.
  • Wording: Growth and Enterprise read "Contact us to raise your limit" instead of "Upgrade your plan".
  • Closing: the note can be closed. It clears on a brand switch or the next Add All.
  • Why pausing N prompts is enough: a new prompt takes one location, and pausing a prompt frees at least one.

Other errors show as a toast; whatever was added stays added. All copy is in en.json (prompts.suggestions.*).

Related issue

Product request (2026-10-21). No issue.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. With NEXT_PUBLIC_IS_CLOUD=true, put an organization on Starter (50 prompt locations) with 40 in use, and have 25 suggestions listed.
  2. Prompts › Prompt Suggestions → Add All. The button reads "Adding…".
    • Expected: "10 prompts added to your tracked list", 15 suggestions left, and the note "15 suggestions couldn't be added".
  3. Add All again. Expected: "Your plan's prompt limit is reached. Upgrade your plan, or pause 15 prompts…".
  4. Go to Tracked Prompts opens the tracked list (50 / 50). Pause 15 prompts, come back and press Add All: the other 15 are added.
  5. Self-hosted: no limit, so everything listed is added.

Checked locally with the demo organization on Starter, 15 temporary filler prompts and 25 temporary suggestions, all removed afterwards and the plan set back. Checked in light and dark, and at 1024 px, where the note's buttons sit under the text.

Speed: the first call (11 adds, the 11th hitting the limit) took about 7.5 s against the hosted dev database. Each add reads the plan and usage again on its own. It's the same path as Opportunities' Track N.

Tests: _suggestions-card.test.tsx (new, 7 tests) checks:

  • the button order;
  • that all listed suggestions are added and leave;
  • batches of 25 for 30;
  • the limit note: counts, wording, the Tracked Prompts link and the limit actions;
  • that it stops after the batch that hit the limit and closes the note;
  • other errors as a toast;
  • the "already handled" toast.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/) (0 errors; the 6 warnings are in untouched files, as on main)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Web: yarn test (1,915 tests) and yarn build pass. Web only, no migration, no new dependency.

🤖 Generated with Claude Code

Prompt Suggestions gets an Add All button between New and Clear All. It
tracks every suggestion on screen through trackSuggestions, 25 a call, so
each prompt passes the same plan check as a single add. What was added
leaves the list. When the plan's prompt limit stops the run, a note says
how many couldn't be added and how to make room: upgrade (or contact us),
or pause that many tracked prompts and try again, with a link to Tracked
Prompts and the page's own limit actions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

@gkhngyk A small product request from today: Add All on Prompt Suggestions, between New and Clear All. It's from main and independent of the open stacks.

It reuses trackSuggestions (Opportunities' Track N) in calls of 25, so every prompt passes the same plan check as the single +. When the limit stops the run, a note says how many couldn't be added. It offers "upgrade, or pause N prompts in Tracked Prompts and try again", with the page's own Upgrade / Contact us buttons.

One thing worth a look: each add re-reads the plan and usage. Against the hosted dev DB, 11 adds took ~7.5 s. If you'd like Add All faster on big lists, a follow-up could read the usage once per call and insert the room that's left in one go.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Add All goes through trackSuggestions in batches of 25, so each prompt passes the same plan check as a single add, and the limit note keeps what's left on the list.

@gkhngyk
gkhngyk merged commit 8edd198 into ansvisor:main Oct 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants