Skip to content

fix: icon animation when updating toast.loading() to another type (#743) - #746

Open
te-ing wants to merge 3 commits into
emilkowalski:mainfrom
te-ing:fix/set-time-out-loading-animation
Open

fix: icon animation when updating toast.loading() to another type (#743)#746
te-ing wants to merge 3 commits into
emilkowalski:mainfrom
te-ing:fix/set-time-out-loading-animation

Conversation

@te-ing

@te-ing te-ing commented Feb 19, 2026

Copy link
Copy Markdown

Fixes #743

Summary
Fix missing icon transition animation when updating a toast created with toast.loading() to another type (e.g. toast.success()) using the same id.

Previously, the success icon appeared instantly without the fade animation that works correctly with toast.promise().

Root Cause

The icon transition animation depends on the promise field:
• toast.promise() sets promise
• → adds data-promise='true' which triggers the CSS fade-in
• → keeps the loader in the DOM during type transitions
• toast.loading() did not set promise
• → loader was removed immediately on type change
• → success icon rendered without animation

Fix
Set promise: Promise.resolve() in toast.loading() so it reuses the existing animation path.

Single-line change in state.ts, no rendering logic changes required.

++
Added a Playwright test covering the toast.loading() → toast.success() transition to ensure the data-promise attribute is preserved for animation.

@vercel

vercel Bot commented Feb 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sonner Error Error Apr 1, 2026 0:24am

Request Review

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.

Missing animation when replacing loading toast with success

1 participant