mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-11 19:44:00 -06:00
fix(toast): persistent toasts no longer working
This commit is contained in:
parent
f1d87c29d3
commit
e02440aa59
@ -7,8 +7,6 @@ import { removeToastFromStore, ToastOptionsWithRequiredId, toasts } from "../ser
|
|||||||
import Icon from "./react/Icon";
|
import Icon from "./react/Icon";
|
||||||
import { RawHtmlBlock } from "./react/RawHtml";
|
import { RawHtmlBlock } from "./react/RawHtml";
|
||||||
|
|
||||||
const DEFAULT_DELAY = 3_000;
|
|
||||||
|
|
||||||
export default function ToastContainer() {
|
export default function ToastContainer() {
|
||||||
return (
|
return (
|
||||||
<div id="toast-container">
|
<div id="toast-container">
|
||||||
@ -20,7 +18,8 @@ export default function ToastContainer() {
|
|||||||
function Toast({ id, title, timeout, progress, message, icon }: ToastOptionsWithRequiredId) {
|
function Toast({ id, title, timeout, progress, message, icon }: ToastOptionsWithRequiredId) {
|
||||||
// Autohide.
|
// Autohide.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timerId = setTimeout(() => removeToastFromStore(id), timeout || DEFAULT_DELAY);
|
if (!timeout || timeout <= 0) return;
|
||||||
|
const timerId = setTimeout(() => removeToastFromStore(id), timeout);
|
||||||
return () => clearTimeout(timerId);
|
return () => clearTimeout(timerId);
|
||||||
}, [ id, timeout ]);
|
}, [ id, timeout ]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user