Skip to content

Commit

Permalink
Make updateStatus in react-hooks async
Browse files Browse the repository at this point in the history
Resolves #1612
  • Loading branch information
VeskeR committed May 29, 2024
1 parent a3270b3 commit 5343e23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/platform/react-hooks/src/hooks/usePresence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useStateErrors } from './useStateErrors.js';
import { useConnectionStateListener } from './useConnectionStateListener.js';

export interface PresenceResult<T> {
updateStatus: (messageOrPresenceObject: T) => void;
updateStatus: (messageOrPresenceObject: T) => Promise<void>;
connectionError: Ably.ErrorInfo | null;
channelError: Ably.ErrorInfo | null;
}
Expand Down Expand Up @@ -71,8 +71,8 @@ export function usePresence<T = any>(
}, [shouldNotEnterPresence, channel, ably]);

const updateStatus = useCallback(
(messageOrPresenceObject: T) => {
channel.presence.update(messageOrPresenceObject);
async (messageOrPresenceObject: T) => {
await channel.presence.update(messageOrPresenceObject);
},
[channel],
);
Expand Down

0 comments on commit 5343e23

Please sign in to comment.