Ding 0.0.7

Changes in Ding 0.0.7: toast IDs, actions and motion cleanup.

All releases ·

Old IDs leave newer messages alone Fixed

toast.dismiss(id) still accepts the ID returned by a toast call, but an older call can no longer dismiss the message that took over its slot. Repeated toasts return a usable caller ID; generated IDs avoid collisions with custom IDs.

Open a loading toast, replace it, then try the old caller ID and the visible item's close control.

Start with Loading.

Async actions close on click Fixed

A synchronous action can still return a patch to morph the toast. An async action starts closing the old toast when clicked; its resolved value is not treated as a patch. Show its result as another toast, or use toast.promise() to morph a loading toast to its result. An action that opens a new toast no longer accidentally closes it.

Drag and animation cleanup Fixed

pointercancel now resets a drag instead of flinging the toast. Unmounting stops its animation work, and two mounted Toasters both receive layout updates in the same frame. Escape and Alt+T keep working when one of two mounted Toasters unmounts, including React.

Upgrading a custom renderer Changed

toast.dismiss(id) and toast.dismiss() remain available. If your custom close button used toast.dismiss(item.id), switch it to toast.close(item.id): the visible item's physical ID may differ from its newest caller ID. The built-in React, Svelte, Vue and plain DOM renderers are already updated. See the API reference. Thanks to Jens for the close(id) distinction and repeat-ID regression.