-
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 inconsistencies between single key operations (merge
, set
) and multi key operations (mergeCollection
, multiSet
)
#519
Conversation
…en-single-and-multi-functions
merge
, set
) and multi (mergeCollection
, multiSet
) functionsmerge
, set
) and multi (mergeCollection
, multiSet
) functions
I'm placing this on HOLD right now in order for QA to be done on the latest version of Onyx without more un-QAed PRs from being merged. |
@chrispader I'm getting this error when launching the App: |
I integrated #515 into this PR, so this should be the last PR in Onyx before we can bump it in E/App. |
done! can't thoroughly test it right now, will do in the evening. lmk if something doesn't work |
…en-single-and-multi-functions
@chrispader are there no manual tests that could be done here? @rinej seems like the reassure action here is not happy yet, could you check out the failure? |
hmm, not really, since we're testing for that in the Jest tests already. You could manually run the steps to check for this behavior either in the DevTools console or somewhere in E/App. I added the steps to |
merge
, set
) and multi key operations (mergeCollection
, multiSet
)merge
, set
) and multi key operations (mergeCollection
, multiSet
)
Removed the hold, lets ignore the reassure tests as we are just setting them up in the repo to make sure the lower level functions stay performant, however the setup does not look 100% yet, @rinej from Callstack will investigate on Monday @tgolen @MonilBhavsar please continue with the 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.
Thanks!
@tgolen I believe it's only pending your re-approval now? |
@tgolen already approved, i just changed a minor NAB mentioned by @MonilBhavsar. no critical change |
Welp, somebody's gotta merge it anyway🙂 |
haha, OK. Here I go! |
🚀Published to npm in v2.0.33 |
@francoisl reported that we had to roll back Onyx due to a regression in this PR. @chrispader can you please work on fixing this issue and creating a new PR to upgrade Onyx? This is currently preventing us from deploying other Onyx changes. |
Looking into fixing the regression and bumping Onyx today/tomorrow! |
Sorry for the delay 🙈 Working on this now! |
Fixed in Expensify/App#42057 |
@paultsimura
Details
This PR aims to remove inconsistencies between "single key operations" (
merge
,set
, ...) and "multi key operations" (mergeCollection
, which usesmultiMerge
under the hood,multiSet
, ...).When using
mergeCollection
nested null values would not be removed from storage, because we already removed thenull
values from the changes in that are then later (natively) merged in the provider. Keeping thenull
values in the changes sent to the storage layer ensures, that the same data will be written, as when we usedmerge
.This PR also makes sure that nested
null
values that we get from cache are never sent to the user (e.g. withwithOnyx
,useOnyx
or a callback). Cache in Onyx will still containnull
values for performance reasons, as in #411. We can still use the original data to compare data to prevent unnecessary re-renders, but we should never providenull
values towithOnyx
props or callbacks.This PR also adds some more unit tests to check for these new changes.
Related Issues
$ #516
$ #514
Automated Tests
Run Jest tests especially the ones in
oynxTest
regardingmergeCollection
.Manual Tests
Somewhere in E/App or any other test project:
Onyx.mergeCollection
with nested null values for already existing keys.Onyx.connect
or the valuef fromuseOnyx
/withOnyx
Author Checklist
### Related Issues
section aboveTests
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop