diff --git a/packages/beacon-ui/src/ui/toast/index.tsx b/packages/beacon-ui/src/ui/toast/index.tsx index c86590b1e..cd36f12af 100644 --- a/packages/beacon-ui/src/ui/toast/index.tsx +++ b/packages/beacon-ui/src/ui/toast/index.tsx @@ -11,13 +11,16 @@ const show$ = new Subject() const createToast = (config: ToastConfig) => { const el = document.createElement('beacon-toast') document.body.prepend(el) - setTimeout(() => createRoot(el).render(), 50) + setTimeout(() => createRoot(el).render(), 50) initDone = true } const openToast = (config: ToastConfig) => { - !initDone && createToast(config) - config$.next(config) + if (initDone) { + config$.next(config) + } else { + createToast(config) + } if (config.state !== 'finished') { show$.next(true)