-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Remove nullish values on set and on merge when no value is in storage #292
Fix: Remove nullish values on set and on merge when no value is in storage #292
Conversation
To give another explanation to the issue at hand: Calling
Where as, when... Calling
First of all, this is inconsistent behaviour, and secondly in the app code we don't expect the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good but also tagging Marc and Tim for review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments to hopefully help the comments to be more clear to others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM. Agree with most of Tim's comments and think we could explain this edge case a bit better with some inline comments. @hannojg's description of the problem was very clear to me so maybe it can be incorporated somehow.
Awaiting another round of review, are we good to continue? This is blocking: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the comments. Very clear now. Thank you!
@tgolen @marcaaron @hannojg
In the native implementation with SQLite, the first call to
merge
on a key where no value is in storage will act like a regularset
since the values are inserted into storage directly.This is due to this SQLite operation in
SQLiteStorage.mergeItem
:In order for this to be consistent with how later
merge
withJSON_PATCH
are working, we need to remove nullish values from thebatchedChanged
in the first merge operation.Additionally, we'll want to remove nullish values on
set
as well, so that the values in cache and storage are always identical.Details
Related Issues
Automated Tests
Linked PRs