diff --git a/web/app/components/base/toast/index.tsx b/web/app/components/base/toast/index.tsx index 1b9ae4eedb..59b40ec249 100644 --- a/web/app/components/base/toast/index.tsx +++ b/web/app/components/base/toast/index.tsx @@ -77,11 +77,11 @@ const Toast = ({
-
{message}
+
{message}
{customComponent}
{!!children && ( -
+
{children}
)} @@ -149,25 +149,26 @@ Toast.notify = ({ if (typeof window === 'object') { const holder = document.createElement('div') const root = createRoot(holder) + let timerId: ReturnType | undefined - toastHandler.clear = () => { - if (holder) { + const unmountAndRemove = () => { + if (timerId) { + clearTimeout(timerId) + timerId = undefined + } + if (typeof window !== 'undefined' && holder) { root.unmount() holder.remove() } onClose?.() } + toastHandler.clear = unmountAndRemove + root.render( { - if (holder) { - root.unmount() - holder.remove() - } - onClose?.() - }, + close: unmountAndRemove, }} > @@ -176,7 +177,7 @@ Toast.notify = ({ document.body.appendChild(holder) const d = duration ?? defaultDuring if (d > 0) - setTimeout(toastHandler.clear, d) + timerId = setTimeout(unmountAndRemove, d) } return toastHandler diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json index 3282630fef..f23ae2f757 100644 --- a/web/eslint-suppressions.json +++ b/web/eslint-suppressions.json @@ -1856,11 +1856,6 @@ "count": 4 } }, - "app/components/base/file-uploader/utils.spec.ts": { - "ts/no-explicit-any": { - "count": 2 - } - }, "app/components/base/file-uploader/utils.ts": { "ts/no-explicit-any": { "count": 3 @@ -2033,11 +2028,6 @@ "count": 1 } }, - "app/components/base/input/index.spec.tsx": { - "ts/no-explicit-any": { - "count": 1 - } - }, "app/components/base/input/index.stories.tsx": { "no-console": { "count": 2 @@ -2590,9 +2580,6 @@ "app/components/base/toast/index.tsx": { "react-refresh/only-export-components": { "count": 2 - }, - "tailwindcss/enforce-consistent-class-order": { - "count": 2 } }, "app/components/base/tooltip/index.tsx": { @@ -2618,11 +2605,6 @@ "count": 4 } }, - "app/components/base/with-input-validation/index.spec.tsx": { - "ts/no-explicit-any": { - "count": 2 - } - }, "app/components/base/with-input-validation/index.stories.tsx": { "no-console": { "count": 1