Sonner: replace the JS runtime with a pure Rust/Leptos toast system#33
Open
krishpranav wants to merge 4 commits intorust-ui:mainfrom
Open
Sonner: replace the JS runtime with a pure Rust/Leptos toast system#33krishpranav wants to merge 4 commits intorust-ui:mainfrom
krishpranav wants to merge 4 commits intorust-ui:mainfrom
Conversation
…ions to bust poisoned cache add_cache_headers was applying long cache headers to SSR HTML fallback responses when static files were temporarily missing during rebuild, causing browsers to cache HTML as JS for up to 7 days. Guard added to skip caching on text/html responses.
Remove sonner.js, sonner.min.js, sonner.css, and lazy_load_sonner.js entirely. Toast state, auto-dismiss timers, stacking, and position logic now live in a RwSignal<Vec<ToastData>> provided via Leptos context. SonnerTrigger no longer reads data-* attributes on click — it calls show_toast() directly. SonnerToaster renders toasts as Leptos components with CSS-only enter/exit animations. No JS runtime dependency remains in this component. Fixes rust-ui#29
a27dbde to
d35d843
Compare
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.
Description:
The Sonner docs were still hanging off a bundled JS runtime and lazy loader.
This patch moves the toast state machine, rendering, timers, stacking, and interaction flow into Rust/Leptos and cleans up the demo wiring around it.
What changed:
app_crates/registry/src/ui/sonner.rsapp/src/shell.rspublic/components/sonner.js,sonner.min.js,sonner.css, andlazy_load_sonner.jsValidation:
The long full-file Playwright run against
tests/components/sonner.spec.tsis still unstable in this local runner after extended sequential execution, but the Rust implementation, demo wiring, and the targeted Sonner slices above pass cleanly.Fixes #29