Skip to content

refactor(components/ToastProvider): remove 'durationMs' and numeric 'id' left from Sonner - #1625

Merged
sukvvon merged 1 commit into
mainfrom
refactor/toast-options-sonner-leftovers
Nov 23, 2026
Merged

sukvvon merged 1 commit into
mainfrom
refactor/toast-options-sonner-leftovers

Conversation

@sukvvon

@sukvvon sukvvon commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Removes options from ToastOptions that were left from Sonner:

  • durationMs: no caller passes it, so add() always received timeout: undefined and Base UI fell back to the provider's timeout={2500}. The Infinity mapping was dead code.
  • id is narrowed from number | string to string and the .toString() call is dropped; every caller passes a string literal or template string.

Behavior doesn't change.

Verification

  • Checked all 64 notify calls across 21 files: none pass durationMs, and the 20 that pass id all pass strings.
  • tsc, oxlint and pnpm knip pass.
  • Locally on a docs page, copying a code block shows the "Copied code" toast, clicking again doesn't stack a second toast, and it closes after about 2.5 seconds.

Summary by CodeRabbit

  • Updates
    • Toast notifications now follow the provider’s configured timeout instead of accepting individual duration settings.
    • Toast IDs can be provided as optional strings; numeric IDs are no longer supported.

@sukvvon sukvvon self-assigned this Nov 23, 2026
@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5460395

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The toast options contract now accepts only an optional string ID. notify passes that ID directly to add and relies on the provider’s timeout configuration.

Changes: Toast options

Layer / File(s) Summary
Toast options and notify behavior
src/components/ToastProvider.tsx
ToastOptions no longer includes durationMs and limits id to strings. notify no longer sets a per-toast timeout or converts IDs to strings.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Refactor

Possibly related PRs

Suggested reviewers: tannerlinsley, manudeli

Merge Risk: Minimal · up to 54603

This change removes unused toast options and keeps toast behavior the same, using the provider's default timeout. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title matches the change. The PR removes the unused durationMs option from ToastOptions and narrows id from number | string to an optional string in src/components/ToastProvider.tsx. The title nam…
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.
Full details: Title check

Explanation

The title matches the change. The PR removes the unused durationMs option from ToastOptions and narrows id from number | string to an optional string in src/components/ToastProvider.tsx. The title names both removals and the Sonner leftover context. The title is 89 characters long, which is longer than ideal but still readable and specific.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c36bc270-fd9a-4922-9f2a-a9c6aecb5b2d
Commits

Reviewing files that changed from the base of the PR and between 77e721b and 5460395.

Files selected for processing: 1

  • src/components/ToastProvider.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@github-actions

Copy link
Copy Markdown
Asset Main PR merge build Change
JavaScript 19580.04 KiB 19580.00 KiB 🟢 -0.04 KiB (-0.00%)
JavaScript (gzip) 6444.21 KiB 6443.69 KiB 🟢 -0.52 KiB (-0.01%)
CSS 823.62 KiB 823.62 KiB 0.00 KiB (0.00%)
CSS (gzip) 126.08 KiB 126.08 KiB 0.00 KiB (0.00%)
Page Main (gzip) PR merge build (gzip) Change
/ 595.13 KiB 595.10 KiB 🟢 -0.03 KiB (-0.01%)
/libraries 537.98 KiB 537.96 KiB 🟢 -0.02 KiB (-0.00%)
/start/latest 562.79 KiB 562.75 KiB 🟢 -0.04 KiB (-0.01%)
/router/latest 563.10 KiB 563.06 KiB 🟢 -0.04 KiB (-0.01%)
/query/latest 561.53 KiB 561.50 KiB 🟢 -0.04 KiB (-0.01%)
/table/latest 594.35 KiB 594.31 KiB 🟢 -0.04 KiB (-0.01%)
/charts/latest 643.63 KiB 643.60 KiB 🟢 -0.03 KiB (-0.01%)
/ai/latest 588.48 KiB 588.44 KiB 🟢 -0.04 KiB (-0.01%)
Docs article 549.04 KiB 549.01 KiB 🟢 -0.03 KiB (-0.01%)
Framework docs article 549.05 KiB 549.02 KiB 🟢 -0.03 KiB (-0.01%)
/blog 542.20 KiB 542.17 KiB 🟢 -0.03 KiB (-0.01%)
/maintainers 541.29 KiB 541.26 KiB 🟢 -0.03 KiB (-0.00%)
/showcase 539.24 KiB 539.21 KiB 🟢 -0.03 KiB (-0.01%)
/chat 537.71 KiB 537.69 KiB 🟢 -0.02 KiB (-0.00%)
/chat/c/:conversationId 538.43 KiB 538.41 KiB 🟢 -0.02 KiB (-0.00%)

Page sizes sum the JS and CSS in the TanStack Start manifest for each route and its layouts. Shared files count once per page.

Compared with main at 77e721b. Gzip sizes are summed per file. Build run

@sukvvon
sukvvon merged commit 4796209 into main Nov 23, 2026
11 checks passed
@sukvvon
sukvvon deleted the refactor/toast-options-sonner-leftovers branch November 23, 2026 14:49
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