Skip to content

Commit

Permalink
fix: duplicated toasts when connection lost
Browse files Browse the repository at this point in the history
  • Loading branch information
DahnM20 committed Dec 3, 2023
1 parent 8c7dfb7 commit 089b205
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ui/src/hooks/useFlowSocketListeners.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const useSocketListeners = (

function defaultOnDisconnect(reason: string) {
if (reason === 'transport close') {
toastInfoMessage(t('socketConnectionLost'));
toastInfoMessage(t('socketConnectionLost'), 'socket-connection-lost');
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/utils/toastUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { FaGithub } from "react-icons/fa";
import { IconType } from "react-icons/lib";
import { toast } from "react-toastify";

export function toastInfoMessage(message: string) {
export function toastInfoMessage(message: string, id?: string) {
toast.info(message, {
toastId: id,
position: "top-center",
autoClose: 5000,
hideProgressBar: false,
Expand Down

0 comments on commit 089b205

Please sign in to comment.