Merged
Conversation
…etSnapshot-performance
…etSnapshot-performance
janicduplessis
approved these changes
May 23, 2024
Contributor
janicduplessis
left a comment
There was a problem hiding this comment.
Overall looks good to me. Do you have any performance measurements before / after this change? Maybe using the same flow described in the linked issue.
Contributor
Author
|
@janicduplessis Sure, all the details about this solution can be found here. |
useOnyx performanceuseOnyx performance
Contributor
Author
|
@mountiny This PR is still waiting for the Onyx bump, right? |
Contributor
|
Correct |
useOnyx performanceuseOnyx performance
useOnyx performanceuseOnyx performance
mountiny
previously approved these changes
Jun 19, 2024
Contributor
mountiny
left a comment
There was a problem hiding this comment.
Looks good to me, one NAB
Co-authored-by: Vit Horacek <36083550+mountiny@users.noreply.github.com>
Contributor
|
🚀Published to npm in v2.0.52 |
50 tasks
Merged
50 tasks
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.
Details
@hurali97
This PR improves
useOnyxperformance by introducing two changes:getSnapshot()function to only get the newest cached value from Onyx IF we are connecting toOnyx.connect()for the first time OR after theOnyx.connect()callback is fired, sincegetSnapshot()can be called several times by React and we only want to update the cache under this specific condition.deepEqualsIFkeyis a collection key ANDselectoris defined.shallowEqualsis enough for the other cases and will be used instead.Related Issues
Expensify/App#42421
Automated Tests
Manual Tests
Some common tasks on E/App:
useOnyx).useOnyx).useOnyx).Author Checklist
### Related Issuessection aboveTestssectiontoggleReportand 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
Android: Native
Screen.Recording.2024-05-22.at.17.51.06-compressed.mov
Android: mWeb Chrome
Screen.Recording.2024-05-22.at.17.55.53-compressed.mov
iOS: Native
Screen.Recording.2024-05-22.at.17.35.27-compressed.mov
iOS: mWeb Safari
Screen.Recording.2024-05-22.at.17.37.36-compressed.mov
MacOS: Chrome / Safari
Screen.Recording.2024-05-22.at.17.23.10-compressed.mov
Screen.Recording.2024-05-22.at.17.21.54-compressed.mov
MacOS: Desktop
Screen.Recording.2024-05-22.at.17.24.10-compressed.mov