diff --git a/packages/automerge-repo-react-hooks/src/useLocalAwareness.ts b/packages/automerge-repo-react-hooks/src/useLocalAwareness.ts index 0bd3e7e55..ba1e82c34 100644 --- a/packages/automerge-repo-react-hooks/src/useLocalAwareness.ts +++ b/packages/automerge-repo-react-hooks/src/useLocalAwareness.ts @@ -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])