-
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
Remove optimization that was supposed to help with infinite rendering… #421
Conversation
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
lib/withOnyx.js
Outdated
@@ -119,12 +119,9 @@ export default function (mapOnyxToState, shouldDelayUpdates = false) { | |||
const onyxDataFromState = getOnyxDataFromState(this.state, mapOnyxToState); | |||
const prevOnyxDataFromState = getOnyxDataFromState(prevState, mapOnyxToState); | |||
|
|||
// This ensures that only one property is reconnecting at a time, or else it can lead to race conditions and infinite rendering loops. No fun! | |||
let isReconnectingToOnyx = false; | |||
|
|||
_.each(mapOnyxToState, (mapping, propName) => { | |||
// Some properties can be ignored and also return early if the component is already reconnecting to Onyx |
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.
Also update that comment that mentions the reconnecting.
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
… loops
Details
What seems to happen is that
withOnyx
detects that thereportActions_
key has changed, so it reconnects to Onyx. However, because ofisReconnectingToOnyx
it also misses the change to thereport_
key, sowithOnyx
never reconnects to that key.Related Issues
Part of Expensify/App#30934
Automated Tests
Covered by unit tests already
Manual Tests
Easy test for web:
/r/1234
from the path and press enterReportScreen.js
to have a log at the top of the render method likeconsole.log('report screen')
For native platforms:
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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android