[experiment] Online Optimism#7
Draft
stevensJourney wants to merge 4 commits into
Draft
Conversation
|
Hi! I'm the It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃 |
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.
This PR is an experiment to investigate dropping the optimistic state after TanStackDB collection mutations have been applied to the backend database and synced back to clients via PowerSync (and then back to the TanStackDB collection).
For context: The current integration works in an offline-first mode. Where optimistic state is resolved once mutations have reflected in the PowerSync SQLite DB.
This adds a new mode to the
PowerSyncTransactorwhich handles TanStackDB collection mutations.The logic here is achieve by tapping in to the PowerSyncDatabase Write Checkpoint targeting and application state. This is currently achieved by spying on the internal
ps_bucketsstate with temporary SQLite triggers. The implementation here is LAZY and cuts many corners for the sake of experimentation. In an ideal world, this would use therequestCheckpointlogic from https://github.com/orgs/powersync-ja/discussions/324. TheCheckpointObserveris also currently probably over-engineered, we might be able to use a simple watched query onps_bucketsfor this functionality - the method here was eager to avoid missing any potential state changes.A large portion of this PR was assisted by Codex GPT 5.5