-
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
Return early if policy doesn't have customUnits
to prevent crash
#10937
Conversation
customUnits
to prevent crash
|
Note: Checking off PR checklist b/c this is relatively time sensitive - I did test in Chrome but haven't tested on mobile devices, the changes are small enough I don't think it's necessary |
PR Reviewer Checklist
|
@Julesssss tests now finally passing 😅 |
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.
Tests well on web and Android when I manually set the object to undefined 👍
@Julesssss looks like this was merged without passing tests. Please add a note explaining why this was done and remove the |
Bad Melvin, all tests had passed. |
…Units Return early if policy doesn't have `customUnits` to prevent crash (cherry picked from commit 9b7ebed)
I tested on Android and didn't get any crashes. Discussing with @mvtglobally in #qa to test on the iOS TestFlight build 1.1.99.4. |
Same here, no crash on Android |
🚀 Deployed to staging by @Julesssss in version: 1.2.0-0 🚀
|
@@ -142,6 +143,12 @@ class WorkspaceReimburseView extends React.Component { | |||
} | |||
|
|||
const distanceCustomUnit = _.find(lodashGet(this.props, 'policy.customUnits', {}), unit => unit.name === 'Distance'); | |||
if (!distanceCustomUnit) { | |||
Log.warn('Policy has no customUnits, returning early.', { |
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.
Slight NAB, but this only indicates it doesn't have a customUnit named "Distance". It could be helpful to add the policy's customUnits
property to the logs too (unless it's some huge object).
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.
That seems like a good improvement! Orrrr updating the log to clarify there's no 'Distance'
in the policy's customUnits
🤔
cc @Julesssss as this is intented to fix a crash blocking deploy
Implementing @tgolen 's proposed solution here: #10876 (comment)
Details
Fixed Issues
$ #10876
Tests
Having trouble reproducing in dev so not sure what test steps to provide :(
PR Review Checklist
Contributor (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 */
displayName
propertythis
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 Contributor+ 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 */
displayName
propertythis
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
Was very hard to reproduce the error, so just try creating a new Workspace & opening up the reimbursement page, rooting around, making sure there's no errors.
Note: This crash was specifically found on iOS & Android so best to test on those devices
Verify that no errors appear in the JS console
Screenshots
Web
Mobile Web
Desktop
iOS
Android