Skip to content

Commit

Permalink
fix: prevent uiInteraction to invalidate
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Sep 5, 2024
1 parent e4e8541 commit 1011030
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/meteor/client/hooks/useAppUiKitInteraction.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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]);
};

0 comments on commit 1011030

Please sign in to comment.