fix(persister): restore MergeableChanges handling in extractChangedTables#3240
Merged
fix(persister): restore MergeableChanges handling in extractChangedTables#3240
Conversation
…bles Commit 64922df removed MergeableChanges format handling from extractChangedTables(), breaking session folder persistence for MergeableStore users. TinyBase sends changes in two formats: - Regular Changes: [changedTables, changedValues, 1] - MergeableChanges: [[changedTables, hlc?], [changedValues, hlc?], 1] The simplified code didn't unwrap the inner array for MergeableChanges, returning [changedTables, hlc] instead of changedTables. This caused getChangedSessionIds to receive an array instead of an object, making it think nothing changed and skipping all save operations.
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for howto-fix-macos-audio-selection canceled.
|
✅ Deploy Preview for hyprnote canceled.
|
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.
Summary
sessions/*.md,_meta.json, etc.) not persisting sincenightly.8release (worked innightly.7)extractChangedTables()Root Cause Analysis
Commit
64922dfba("remove stamp repair that might cause dataloss") simplifiedextractChangedTables()too aggressively.TinyBase sends changes in two different formats depending on the store type:
[changedTables, changedValues, 1][[changedTables, hlc?], [changedValues, hlc?], 1]The app uses a MergeableStore, which sends changes in format #2.
Before (nightly.7 - working)
After (nightly.8 - broken)
The Problem
With MergeableChanges,
changes[0]is[changedTables, hlc?](an array), not the tables object directly.Since arrays are objects in JavaScript,
typeof tables === "object"returnstrue, and the function returns[changedTables, hlc]instead of justchangedTables.When
getChangedSessionIdsreceives this array:changedTables.sessions.sessionsproperty → returnsundefined{ operations: [] }Test plan