Skip to content

Commit

Permalink
don't broadcast null userIds
Browse files Browse the repository at this point in the history
  • Loading branch information
pvh committed Feb 6, 2024
1 parent 6b19210 commit ca40caa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/automerge-repo-react-hooks/src/useLocalAwareness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export const useLocalAwareness = ({
}

useEffect(() => {
// Don't broadcast if userId isn't set: this avoids bogus broadcasts
// during the loading of a userId document.
if (!userId) {
return
}

// Send periodic heartbeats
const heartbeat = () =>
void handle.broadcast([userId, localStateRef.current])
Expand Down

0 comments on commit ca40caa

Please sign in to comment.