Skip to content

Refactor SyncManager to remove stale queue and ready signal useEffects#46

Merged
SCdF merged 1 commit intomainfrom
refactor-sync-manager-useeffects
Jan 20, 2026
Merged

Refactor SyncManager to remove stale queue and ready signal useEffects#46
SCdF merged 1 commit intomainfrom
refactor-sync-manager-useeffects

Conversation

@SCdF
Copy link
Owner

@SCdF SCdF commented Jan 20, 2026

Summary

  • Create socketRegistry to make socket accessible outside React components
  • Add syncMiddleware that emits docUpdate when markStale action is dispatched
  • Move socket ready signal directly into handleFullSync completion using socketRef
  • Remove two reactive useEffects that were causing cascading state updates

This completes the fifth priority from the useEffect elimination plan.

Test plan

  • Verify sync still works when connecting to server
  • Verify document updates are emitted to other clients
  • Verify ready signal is sent after sync completes
  • Run existing tests

🤖 Generated with Claude Code

- Create socketRegistry to make socket accessible outside React components
- Add syncMiddleware that emits docUpdate when markStale action is dispatched
- Move socket ready signal directly into handleFullSync completion using socketRef
- Remove two reactive useEffects that were causing cascading state updates

This makes the sync flow more explicit: docs are emitted immediately when
marked stale (if connected), and the ready signal is emitted as part of
sync completion rather than as a reactive cascade.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@SCdF SCdF merged commit 34f50df into main Jan 20, 2026
2 checks passed
@SCdF SCdF deleted the refactor-sync-manager-useeffects branch January 20, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant