feat: live multiuser data propagation (#11) - #19
Merged
Conversation
Owner
Author
|
Update (GitFlow): re-based onto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11.
When one session mutates a table, every other session currently BROWSE-ing that same table refreshes automatically — no manual re-query. Type in one browser window, watch another repaint.
How it works
ServerDatabaseBridge.closeDatabase()is now detach-only — it no longer closes the SQLite handle shared across sessions (one user closing a DB previously broke everyone else's queries).exec()fires anonMutatehook →Sessionmarks itself dirty → after the message it calls anotifyChangecallback injected bySessionManager. Every write path (REPLACE/APPEND/DELETE/PACK/grid edits) routes throughexec(), so no per-command bookkeeping.SessionManager.broadcast(db, table, except)sends a newdata-changedmessage only to sessions whose current view matches (server-side relevance filter), debounced per table so a burst coalesces into one refresh.data-changedand, if aGridis open on that table, triggers the existing F5 refresh path (repaints in place, preserves selection).Tests
onMutate+ shared-handle regression;SessionManagerbroadcast filters by view, skips originator, coalesces a burst.tests/propagation.spec.ts): two browser contexts both BROWSE the same table; edit in one, assert the other repaints with no re-query. Passes live.tsc --noEmitclean.Ships as v0.9.0. Design/plan under
docs/superpowers/.