mui / mui/base-ui

[toast] queue added toasts when there is no listener

Open
#4,986 2 comments 0 reactions 0 assignees View on GitHub
component: toast
Dominant language
TypeScript
Stars
10.9k
Forks
543
Avg merge
1d 20h
Merged PRs (30d)
101

Description

# Feature request

## Summary

This is probably a bit niche but we use the Toast component in a project where we use react-islands, which means that the `Toast.Provider` might not have been rendered when a toast is added to the global manager. When this is the case, the toast never reaches the store and thus never appears, even after the "Toaster" island has rendered.

Im thinking a solution is to add toasts to a queue when there is no listeners, and when a listener is added dump the queue into it, and skip the queue afterwards.

This is doable by writing a small wrapper, but I think it would be nice to have builtin!

If this is something you'd like to support, if so, let me know and I'll (try to, atleast) help however I can 😄

## Examples in other libraries

n/a?

## Motivation

The motivation for me, is to be able to add toasts before the `ToastManager` has received any subscribers, which our island/adhoc-toaster-rendering-system would "need".

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.