Repository navigation
fix(prompts): clear every listed suggestion after a confirmation, measured ones included - #1793
Merged
Merged
Conversation
…ying what it will hide
Clear All kept the Search Console and Analytics suggestions on purpose,
so a list of only those did nothing but show a toast, which read as a
bug. It now asks first, in a dialog: how many suggestions it dismisses,
and how many of them come from Search Console or Analytics, which stay
hidden for 30 days once dismissed. Confirmed, it dismisses every one
listed, each through the route one by one uses, so the same 30-day rule
applies; cancelled, nothing changes.
- dismissSuggestions(ids): a few at a time, answers { ok } with what
couldn't be dismissed and never throws (ansvisor#1777). The ones that failed
come back to the list with a toast; a call that couldn't run puts
them all back.
- The roles stay as they are: Clear All is for those who may dismiss
(Admins, Managers and Analysts), not Agency partners. There is no Undo
to keep.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Oct 29, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good.
What I checked
dismissSuggestionssends each id through the same/api/prompts/suggestions/:id/dismissroute as a single dismiss, 10 at a time. So the API's role check, its read-only 402 and its demo-brand refusal all still apply, and measured suggestions get the 30-day rule. A refused id comes back asfailedand the card puts it back in the list.- Read-only gate: the action writes through the API, like
dismissSuggestion.subscription-guard-coverage.test.tspasses on the PR merged with main. - The confirmation counts what is actually listed (
visible, after the search filter) and says how many are measured. Cancel changes nothing. - The old
measuredSuggestionsKeptkey is gone, with no references left. Onlyen.jsonexists. - No embeds and no migration. Merges cleanly with main.
Follow-ups (not blocking)
dismissSuggestionstakes an unbounded id array. A cap (e.g. 500) would keep one call from sending thousands of API requests.- Suggestions that couldn't be dismissed are appended to the end of the list, so its order changes. Calling
load()after a partial failure would restore the server's order.
Tests (PR merged with main): web vitest _suggestions-card.test.tsx, prompt-suggestions.test.ts and subscription-guard-coverage.test.ts: 49 passed. tsc --noEmit clean; eslint and prettier clean on the touched files.
4 of 5 tasks
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.
Summary
Customer feedback: on Prompt Suggestions, Clear All removed nothing and only said "Search Console and Analytics suggestions were kept — dismiss them individually to hide them for 30 days." Bulk clear deliberately kept suggestions measured from Search Console and Analytics. When every suggestion on screen came from them, nothing happened, which read as a bug.
Now
en.json(prompts.suggestions.clearAllConfirm.*):dismissSuggestions(ids)dismisses them./api/prompts/suggestions/:id/dismiss), in groups of 10, so measured suggestions get the same 30-day rule.{ ok: true, dismissed, failed }or{ ok: false, failure: 'failed' }and never throws (the fix(prompts): show suggestions' load failures plainly and retry once, instead of React #441 #1777 pattern).measuredSuggestionsKepttoast is removed.dismissSuggestion(used by Chat's registry and A4's Undo) is untouched.Related issue
None (customer feedback).
Type of change
fix— Bug fixHow to test
cd web && yarn vitest run 'src/app/[locale]/(dashboard)/dashboard/prompts/_suggestions-card.test.tsx' src/lib/actions/prompt-suggestions.test.ts. 7 new tests cover:Checklist
🤖 Generated with Claude Code