Repository navigation
fix: persist native merge inserts and resets consistently - #883
chrispader wants to merge 2 commits into
Conversation
Co-authored-by: Codex <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tgolen
left a comment
There was a problem hiding this comment.
Sounds like a good fix. Thank you!
fabioh8010
left a comment
There was a problem hiding this comment.
Hi @chrispader nice catch, thanks! Could you please provide a linked E/App PR for testing? We should at least do a simple login/some action/logout test to make sure everything is alright. And the PR will also be later used for the bump.
|
@fabioh8010 on it! 👍🏼 |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@fabioh8010 I applied your naming suggestions in 2c8b38e. The linked App PR is Expensify/App#105482. I've tested and recorded the suggested login/some action/logout flow there, everything works! App is still on Onyx 3.0.120, and this branch would also pull in 3.0.121 to 3.0.141, which need NitroSQLite 10.2 from Expensify/App#102422. So the App PR pins this fix on top of 3.0.120 instead. |
cc @tgolen @fabioh8010
Native
Onyx.mergecan leave SQLite out of sync with the cache when inserting data with null properties or resetting a value through a batchednull. I now persist the merged value for these cases and keep delta merges for existing values. The new integration suite exercises the native merge path with NitroSQLite's Node mock.Details
For a previously unused key,
nullmeans remove the property:The upsert applies
JSON_PATCHonly to existing rows, so new rows previously stored the delta unchanged.SQLite rejection assertions compare messages so they work across Jest environments.
Related Issues
Expensify/App#105485
Supersedes #528 and margelo#2.
Linked E/App PR
Expensify/App#105482
Automated Tests
The native integration cases compare subscriber, cache, and persisted values for null removal, whole-value resets, nested replacement, and arrays. They also cover batching, unchanged values, and RAM-only keys.
Manual Tests
Use the reproduction below in an initialized native Onyx development build with two registered test keys.
Reproduction
{old: true}.nullfollowed by{new: true}.Onyx.exportState()and check that the key contains only{new: true}.{nested: {keep: true, remove: null}}into the previously unused second key.{nested: {keep: true}}.Author Checklist
### Related Issuessection above### Linked E/App PRsection above, and verified this change against it (E/App CI passed and manual testing completed)TestssectiontoggleReportand notonIconClick)myBool && <MyComponent />.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Avataris modified, I verified thatAvataris working as expected in all cases)mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
This change has no UI.