-
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
Improve useOnyx
performance
#551
Improve useOnyx
performance
#551
Conversation
…etSnapshot-performance
…etSnapshot-performance
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.
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.
@janicduplessis Sure, all the details about this solution can be found here. |
useOnyx
performanceuseOnyx
performance
@mountiny This PR is still waiting for the Onyx bump, right? |
Correct |
useOnyx
performanceuseOnyx
performance
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.
LGTM!
useOnyx
performanceuseOnyx
performance
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.
Looks good to me, one NAB
Co-authored-by: Vit Horacek <[email protected]>
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
🚀Published to npm in v2.0.52 |
Details
@hurali97
This PR improves
useOnyx
performance 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.deepEquals
IFkey
is a collection key ANDselector
is defined.shallowEquals
is 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 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
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