Skip to content

An opinionated toast component for React.

fix: remove repeat effect hook to resolve mix up (#392)

tzyoo5159aec0508b
diff --git a/src/index.tsx b/src/index.tsx
index c7a4859..7df9d76 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -210,20 +210,6 @@ const Toast = (props: ToastProps) => {
isDocumentHidden,
]);
- React.useEffect(() => {
- const toastNode = toastRef.current;
-
- if (toastNode) {
- const height = toastNode.getBoundingClientRect().height;
-
- // Add toast height tot heights array after the toast is mounted
- setInitialHeight(height);
- setHeights((h) => [{ toastId: toast.id, height, position: toast.position }, ...h]);
-
- return () => setHeights((h) => h.filter((height) => height.toastId !== toast.id));
- }
- }, [setHeights, toast.id]);
-
React.useEffect(() => {
if (toast.delete) {
deleteToast();