Repository navigation
v2.0.0-beta.2
Pre-release
Pre-release
·
0 commits
to main
since this release
Fixes from an audit of 2.0.0-beta.1, and parity with sonner 2.0.8. Still needs @qwik.dev/core 2.0.0-beta.37 or later.
Breaking changes
toast.dismiss()dismisses only the toasts still on screen and marks them dismissed, so a Toaster mounted later doesn't show them again.toast.dismiss("")no longer dismisses every toast (sonner 2.0.8).classes.default(andtoastOptions.classes.default) applies only to toasts without a type (sonner 2.0.8).toast.getHistory()keeps at most 100 toasts, dropping the oldest dismissed ones first, and no longer lists the same toast twice (sonner 2.0.8).
Features
- More exported types, from both
qwik-sonnerandqwik-sonner/headless:Position,Theme,Direction,SwipeDirection,ToastIcons,ToastTypes,OffsetandPromiseData.
Fixes
- A
<Toaster>oruseSonner()first rendered on the client (behind a condition, or after a<Link>navigation) receives toasts, and stops listening when it unmounts. - Toasts fired before the Toaster subscribes, e.g. on a click right after the page loads, are no longer lost.
topLayer: each Toaster opens its popover only for its own toasts, and its next toast brings it back above a modal opened after it.- With several Toasters, collapsing the stack and returning focus depend only on the Toaster's own toasts.
theme="system"follows changes to the OS color scheme, and stops listening when the prop changes or the Toaster unmounts.- A toast with
id: 0can be updated and dismissed. - A swipe still dismisses a toast that re-renders mid-drag, and only a swipe towards an allowed direction dismisses it (sonner 2.0.8).
toast(),toast.message()andtoast.custom()reset the type of the toast they update, so a loading toast can become a plain one. Re-creating a dismissed id starts a fresh toast (sonner 2.0.8).- A loading toast shows its custom
icon, the built-in icons are hidden from assistive technology, and the toast content fills the remaining width (sonner 2.0.8). - The npm package no longer ships Qwik build manifests (
q-manifest.json,bundle-graph.json).
Deprecated
importantandAction.actionButtonStyle: they have no effect, as in sonner 2, and stay only for compatibility.