-
Notifications
You must be signed in to change notification settings - Fork 3k
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
perf: don't rerender whole screen just because a modal opened/closed #11886
perf: don't rerender whole screen just because a modal opened/closed #11886
Conversation
08da2e1
to
b562c4f
Compare
b562c4f
to
6816236
Compare
this.unsubscribeOnyx = onyxSubscribe({ | ||
key: ONYXKEYS.MODAL, | ||
callback: (object) => { | ||
willAlertModalBecomeVisible = object.willAlertModalBecomeVisible; | ||
}, | ||
}); |
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.
This would be the first instance of such use of Onyx. What about moving this outside the component in lib and using the function to check the status of modal visibility?
There are many examples of it in actions. e.g.
App/src/libs/actions/Report.js
Line 31 in 9a13fa3
Onyx.connect({ |
Because this is not an action, you can put it in a lib.
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.
Yeah i agree, that would be good, will reactor!
export default (mapping) => { | ||
const connectionId = Onyx.connect(mapping); | ||
return () => Onyx.disconnect(connectionId); | ||
}; |
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.
Nice idea
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.
Note to myself: refactor to be a function with a name that I then default export (code style)
…f/dont-rerender-modal-prop-changed
…f/dont-rerender-modal-prop-changed
…f/dont-rerender-modal-prop-changed
Closed in favor of #11907 |
Details
Small performance improvement where we stop re-rendering a screen wrapped with
BaseScreenWrapper
just because a modal opened/close (it's not relevant for the rendering output)This optimizes several flows in which a modal gets opened.
Emoji picker:
emoji_before.mp4
emoji_after.mp4
Opening actions:
actions_before.mp4
actions_after.mp4
Fixed Issues
$ #12119
PROPOSAL: GH_LINK_ISSUE(COMMENT)
Tests
PR Review Checklist
PR Author Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.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
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** 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
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Screenshots
Web
web.mov
Mobile Web - Chrome
chrome.mov
Mobile Web - Safari
safari.mp4
Desktop
desktop.mov
iOS
iOS.mp4
Android
actions_after.mp4