fix: solve eslint errors
This commit is contained in:
parent
d72fd9cd91
commit
c46163f525
@ -51,7 +51,7 @@ interface ToastBody extends Omit<VariantProps<typeof toastVariant>, "preset"> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
let toasts: Record<
|
const toasts: Record<
|
||||||
`${number}`,
|
`${number}`,
|
||||||
ToastBody & Partial<ToastOption> & { subscribers: (() => void)[] }
|
ToastBody & Partial<ToastOption> & { subscribers: (() => void)[] }
|
||||||
> = {};
|
> = {};
|
||||||
@ -161,7 +161,7 @@ const ToastTemplate = ({
|
|||||||
subscribeSingle(id)(() => {
|
subscribeSingle(id)(() => {
|
||||||
setToast(getSingleSnapshot(id)());
|
setToast(getSingleSnapshot(id)());
|
||||||
});
|
});
|
||||||
}, []);
|
}, [id]);
|
||||||
|
|
||||||
const toastData = {
|
const toastData = {
|
||||||
...globalOption,
|
...globalOption,
|
||||||
@ -225,7 +225,7 @@ const ToastTemplate = ({
|
|||||||
}, calculatedTransitionDuration);
|
}, calculatedTransitionDuration);
|
||||||
return () => clearTimeout(timeout);
|
return () => clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
}, [toastData.life, toastData.closeTimeout, toastData.closeButton]);
|
}, [id, toastData.life, toastData.closeTimeout, toastData.closeButton]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -280,10 +280,9 @@ const Toaster = React.forwardRef<HTMLDivElement, ToasterProps>((props, ref) => {
|
|||||||
const internalRef = useRef<HTMLDivElement | null>(null);
|
const internalRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const unsubscribe = subscribe(() => {
|
return subscribe(() => {
|
||||||
setToastList(getSnapshot());
|
setToastList(getSnapshot());
|
||||||
});
|
});
|
||||||
return unsubscribe;
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const option = React.useMemo(() => {
|
const option = React.useMemo(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user