Skip to content
Snippets Groups Projects
Unverified Commit e8baaecd authored by Guilherme Gazzo's avatar Guilherme Gazzo Committed by GitHub
Browse files

fix: prevent uiInteraction to invalidate multiple times (#33216)

parent 532f0881
No related branches found
Tags 6.12.0
No related merge requests found
---
"@rocket.chat/meteor": patch
---
Prevented uiInteraction to subscribe multiple times
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]);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment