Skip to content

fix(components): dedupe copy toasts across the remaining copy affordances - #1100

Open
sukvvon wants to merge 9 commits into
mainfrom
fix/dedupe-remaining-copy-toasts
Open

fix(components): dedupe copy toasts across the remaining copy affordances#1100
sukvvon wants to merge 9 commits into
mainfrom
fix/dedupe-remaining-copy-toasts

Conversation

@sukvvon

@sukvvon sukvvon commented Aug 3, 2026

Copy link
Copy Markdown
Member

Follow-up to #1095, which fixed the stacking reported in #960 for the code-block copy button. The same stacking is reachable from every other copy affordance on the site.

ToastProvider already accepts an id, so this only sets it at the remaining call sites.

Changes

Call site id Why
CopyPageDropdown ×3 page-copied Three bodies behind one button — the cache / GitHub / URL-fallback paths — so repeat clicks stack differently-worded toasts
FrameworkCard package-name-copied One card per framework on a page; copying several in a row is normal
BrandContextMenu svg-copied / svg-copy-failed Six logo assets, all emitting the same toast text, so stacked copies are indistinguishable
$packageName install-prompt-copied / install-prompt-copy-failed See below
useApplicationBuilder builder-copied-${kind} Keyed by kind because the body interpolates it; command and prompt are different messages
ds/BrandAssets brand-asset-copied / brand-asset-copy-failed Arrived via a merge of main (#1105) — a gallery of logo × colour × format buttons, same shape as BrandContextMenu

Failure toasts are included, and that matters

My first pass left failure toasts alone, reasoning that clipboard failures are too rare to bother with. That was wrong, and the preview deploy showed why:

Copy failed / Try again or copy the prompt manually   ×3

Failure is precisely the path that produces repeat clicks — the toast itself says "Try again", and a user who follows that advice stacks a new toast each time. A rare event that invites retries stacks more readily than a common one that doesn't.

Success and failure get distinct ids so neither silently overwrites the other.

Verification

Stacking is not observable from static analysis, so each case was exercised in a browser (dev server for the first three, preview deploy for the registry):

Case Before After
"Copy page" ×3 3 toasts 1 toast, body updates GitHub → cache
React → Vue → Svelte cards 3 toasts 1 toast, body updates to the latest package
Logo menu, 3 assets in a row 3 toasts 1 toast
Install prompt ×3 3 toasts 1 toast
"Copy CLI Command" ×3 (builder) 3 toasts 1 toast
Brand asset gallery, 3 assets 3 toasts 1 toast

The install-prompt case was verified in both directions: three stacked Copy failed toasts before the fix, one Copied install prompt toast after.

Note for anyone re-running these checks: the clipboard API rejects with NotAllowedError whenever the tab loses focus, and the handler throws before notify is reached — so a missing toast in an automated run is usually a focus artefact, not a regression.

Scope

Every clipboard call site that raises a toast is now covered. Call sites that copy without notifying (DsKit, SearchModal, NPMStatsChart, ds.iconography, game/ui/*, LandingCopyPromptButton, account/integrations) use an inline check-mark and need nothing.

The ~40 non-copy toasts (account settings, form submissions, uploads, moderation) are untouched — they are not repeat-fire actions and would need a separate judgement.

Note on FrameworkCard

Cards on the same page now replace one another's toast instead of stacking. The body includes the package name, so nothing is lost — the latest copy is still identified. Flagging it since it is a behaviour change beyond simple double-click dedupe.

Testing

pnpm test (tsc, oxlint, unit tests) passes, plus the browser checks above.

Summary by CodeRabbit

  • Bug Fixes
    • Improved consistency and reliability of copy-success and copy-failure notifications across SVGs, brand assets, page content, URLs, package names, installation prompts, and application builder content.
    • Copy actions now provide more dependable confirmation feedback across supported workflows.
    • Standardized notification behavior helps ensure the correct success or failure message is displayed after copying content.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a6aee43a-df85-4672-934f-b9f4dc669c9b

📥 Commits

Reviewing files that changed from the base of the PR and between a0e2b1d and 74dedbe.

📒 Files selected for processing (1)
  • src/components/ds/BrandAssets.tsx

📝 Walkthrough

Walkthrough

The change adds stable identifiers to copy success and failure notifications for pages, URLs, SVGs, package names, application-builder values, brand assets, and install prompts.

Changes

Copy toast identifiers

Layer / File(s) Summary
Page copy notification identifiers
src/components/CopyPageDropdown.tsx
Page content and URL copy-success notifications now use page-copied.
Component and install-prompt identifiers
src/components/BrandContextMenu.tsx, src/components/FrameworkCard.tsx, src/components/application-builder/useApplicationBuilder.tsx, src/components/ds/BrandAssets.tsx, src/routes/intent/registry/$packageName.tsx
SVG, package-name, application-builder, brand-asset, and install-prompt notifications now use stable success and failure identifiers.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: abeuty

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: deduplicating copy-related toast notifications across the remaining components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dedupe-remaining-copy-toasts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 74dedbe Commit Preview URL

Branch Preview URL
Aug 04 2026, 02:25 AM

@sukvvon sukvvon self-assigned this Aug 3, 2026
@sukvvon sukvvon changed the title fix(components): dedupe copy toasts in 'CopyPageDropdown' and 'FrameworkCard' fix(components): dedupe copy toasts across the remaining copy affordances Aug 3, 2026
@sukvvon
sukvvon marked this pull request as ready for review August 4, 2026 00:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/routes/intent/registry/`$packageName.tsx:
- Line 353: Update the failure toast containing the `install-prompt-copy-failed`
symbol to remove its explicit `id` option, allowing each copy failure to create
an independent notification while leaving success-toast deduplication unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 812f367b-dcef-4e32-83dc-3f2fa3a85b77

📥 Commits

Reviewing files that changed from the base of the PR and between 781f646 and a0e2b1d.

📒 Files selected for processing (2)
  • src/components/BrandContextMenu.tsx
  • src/routes/intent/registry/$packageName.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/BrandContextMenu.tsx

Try again or copy the prompt manually
</div>
</div>,
{ id: 'install-prompt-copy-failed' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the failure toast on its default ID.

The PR objective limits deduplication to success toasts. This explicit ID causes repeated copy failures to replace the existing failure toast instead of creating independent notifications. Remove the id option from this failure toast.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/routes/intent/registry/`$packageName.tsx at line 353, Update the failure
toast containing the `install-prompt-copy-failed` symbol to remove its explicit
`id` option, allowing each copy failure to create an independent notification
while leaving success-toast deduplication unchanged.

@sukvvon
sukvvon requested a review from a team August 4, 2026 01:36
@sukvvon
sukvvon requested a review from tannerlinsley August 4, 2026 02:58
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.

1 participant