Skip to content

Commit 7616e37

Browse files
fix(toast): bug fixes
1 parent 00812d5 commit 7616e37

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib/components/Toast/useToast.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ export function ToastProvider({ children }) {
184184
});
185185
}
186186
}, [toasts.length]);
187-
187+
const windowExists = typeof window !== 'undefined';
188+
if (!windowExists) {
189+
return null;
190+
}
188191
return (
189192
<ToastContext.Provider value={{ present }}>
190193
{children}
@@ -207,7 +210,7 @@ export function ToastProvider({ children }) {
207210
))}
208211
</AnimatePresence>
209212
</div>,
210-
typeof document !== 'undefined' ? document.body : null
213+
document.body
211214
)}
212215
</ToastContext.Provider>
213216
);

0 commit comments

Comments
 (0)