Implement JSON_PATCH() in Onyx.merge() in react-native-onyx(native)#238
Conversation
marcaaron
left a comment
There was a problem hiding this comment.
Just leaving a couple comments. I think it would be good to lay out this approach somewhere and get more feedback.
@tgolen or @kidroca might also be able to help validate the correct approach.
The existing code (merge queue stuff) is far from perfect and could likely be improved - but something about the notifyAfterWrite() direction is making me uneasy and I would appreciate some more eyes on this problem.
kidroca
left a comment
There was a problem hiding this comment.
Left some notes
I have a question:
- We need to perform the merge in order to update memory cache
- Then why do we move the merge logic to storage providers
If we need to extract the merge logic we can extract it to a lib and import the storage provider there (this would import the Storage provider we're currently using)
Co-authored-by: Peter Velkov <kidroca@gmail.com>
|
I think maybe this one is on hold pending the AsyncStorage removal? |
|
Still holding |
|
@marcaaron @kidroca change requests resolved 👍 |
|
Can we fix the lint errors? |
Done, though i'm not sure if this eslint rule should trigger here. Basically it gave errors because the |
I think it's ok to disable it in this case. |
done 👍 |
marcaaron
left a comment
There was a problem hiding this comment.
Can we clean up the diff? There are a bunch of what look like new changes, but are actually recent changes to main.
|
@marcaaron just updated the diff and replied to your questions :) |
|
@chrispader Let's raise a PR in |
|
Some issues that arose from this PR are fixed in this PR |
Details
JSON_PATCHis an algorithm inSQLitewe can use on iOS and Android to merge delta changes natively (in the storage provider) instead of manually "pre-merging" in the "Onyx layer .The original goal of this PR was to utilise
JSON_PATCHon native platforms, whilst still retaining the current merge logic on web.Related Issues
Expensify/App#13972
Automated Tests
Linked PRs