Skip to content

Commit

Permalink
fix toast
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Oct 25, 2023
1 parent c266821 commit 4951906
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/src/components/home/ChatWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger
Expand Down
4 changes: 3 additions & 1 deletion app/src/components/ui/use-toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function dispatch(action: Action) {

type Toast = Omit<ToasterToast, "id">;

function toast({ ...props }: Toast) {
function toast({ ...props }: Toast, timeout?: number) {
const id = genId();

const update = (props: ToasterToast) =>
Expand All @@ -147,6 +147,8 @@ function toast({ ...props }: Toast) {
});
const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id });

setTimeout(dismiss, timeout ?? 5000);

dispatch({
type: "ADD_TOAST",
toast: {
Expand Down

0 comments on commit 4951906

Please sign in to comment.