From 10110308540ae9dce3420b153aac4392c0e52814 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Fri, 26 Jul 2024 02:31:06 -0300 Subject: [PATCH 1/2] fix: prevent uiInteraction to invalidate --- apps/meteor/client/hooks/useAppUiKitInteraction.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/meteor/client/hooks/useAppUiKitInteraction.ts b/apps/meteor/client/hooks/useAppUiKitInteraction.ts index 55741b1961b4..56d984c709e6 100644 --- a/apps/meteor/client/hooks/useAppUiKitInteraction.ts +++ b/apps/meteor/client/hooks/useAppUiKitInteraction.ts @@ -1,3 +1,4 @@ +import { useEffectEvent } from '@rocket.chat/fuselage-hooks'; import { useStream, useUserId } from '@rocket.chat/ui-contexts'; import type * as UiKit from '@rocket.chat/ui-kit'; import { useEffect } from 'react'; @@ -6,13 +7,12 @@ export const useAppUiKitInteraction = (handleServerInteraction: (interaction: Ui const notifyUser = useStream('notify-user'); const uid = useUserId(); + const handle = useEffectEvent(handleServerInteraction); useEffect(() => { if (!uid) { return; } - return notifyUser(`${uid}/uiInteraction`, (interaction) => { - handleServerInteraction(interaction); - }); - }, [notifyUser, uid, handleServerInteraction]); + return notifyUser(`${uid}/uiInteraction`, handle); + }, [notifyUser, uid, handle]); }; From 4d8ba8fbf12630567ca0b553441af3a485c82b20 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Thu, 5 Sep 2024 14:02:52 -0400 Subject: [PATCH 2/2] Create rich-toes-bow.md --- .changeset/rich-toes-bow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/rich-toes-bow.md diff --git a/.changeset/rich-toes-bow.md b/.changeset/rich-toes-bow.md new file mode 100644 index 000000000000..a670f0756f1e --- /dev/null +++ b/.changeset/rich-toes-bow.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Prevented uiInteraction to subscribe multiple times