From 5343e236d1523645b9203487d481b081fb6027e0 Mon Sep 17 00:00:00 2001 From: Andrew Bulat Date: Wed, 29 May 2024 02:48:11 +0100 Subject: [PATCH] Make `updateStatus` in react-hooks async Resolves #1612 --- src/platform/react-hooks/src/hooks/usePresence.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/react-hooks/src/hooks/usePresence.ts b/src/platform/react-hooks/src/hooks/usePresence.ts index 7713b18fe..c4c7caf8f 100644 --- a/src/platform/react-hooks/src/hooks/usePresence.ts +++ b/src/platform/react-hooks/src/hooks/usePresence.ts @@ -7,7 +7,7 @@ import { useStateErrors } from './useStateErrors.js'; import { useConnectionStateListener } from './useConnectionStateListener.js'; export interface PresenceResult { - updateStatus: (messageOrPresenceObject: T) => void; + updateStatus: (messageOrPresenceObject: T) => Promise; connectionError: Ably.ErrorInfo | null; channelError: Ably.ErrorInfo | null; } @@ -71,8 +71,8 @@ export function usePresence( }, [shouldNotEnterPresence, channel, ably]); const updateStatus = useCallback( - (messageOrPresenceObject: T) => { - channel.presence.update(messageOrPresenceObject); + async (messageOrPresenceObject: T) => { + await channel.presence.update(messageOrPresenceObject); }, [channel], );