feat: improve collab error notification (#7741)

* identify cause

* toast after dialog for error messages in collab

* remove comment

* shake tooltip instead for repeating collab errors

* clear collab error

* empty commit

* simplify & fix reset race condition

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Ryan Di
2024-03-04 20:43:44 +08:00
committed by GitHub
co-authored by dwelle
parent f207bd0a1c
commit 160440b860
8 changed files with 168 additions and 20 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useRef } from "react";
import { CSSProperties, useCallback, useEffect, useRef } from "react";
import { CloseIcon } from "./icons";
import "./Toast.scss";
import { ToolButton } from "./ToolButton";
@@ -11,11 +11,13 @@ export const Toast = ({
closable = false,
// To prevent autoclose, pass duration as Infinity
duration = DEFAULT_TOAST_TIMEOUT,
style,
}: {
message: string;
onClose: () => void;
closable?: boolean;
duration?: number;
style?: CSSProperties;
}) => {
const timerRef = useRef<number>(0);
const shouldAutoClose = duration !== Infinity;
@@ -43,6 +45,7 @@ export const Toast = ({
className="Toast"
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
style={style}
>
<p className="Toast__message">{message}</p>
{closable && (