You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Copilot - App crashes after switching account #49939
Version Number: 9.0.41-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers):applausetester+kaaaa@applause.expensifail.com Issue reported by: Applause - Internal Team
Action Performed:
Precondition:
Log in as a copilot
Go to staging.new.expensify.com
Go to Inbox (important)
Go to Account settings
Click on the account switcher
Select another account
Expected Result:
App will not crash
Actual Result:
App crashes after switching account
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Please re-state the problem that we are trying to solve in this issue.
App crashes when switching account.
What is the root cause of that problem?
As shown by the error on the console, the error caused by the useOnyx keys changes from a member collection key to the whole collection key (in this case, reportNameValuePairs_xx to reportNameValuePairs_).
This occurs because when switching, the report becomes empty. Since we are constructing the report object in this context, the report ID fallback value is set to an empty string instead of -1:
Thanks for the proposals.
The root cause is that the report id becomes an empty string. Falling back to -1 will solve this issue. @bernhardojproposal LGTM
🎀👀🎀 C+ reviewed
Activity
melvin-bot commentedon Sep 30, 2024
Triggered auto assignment to @twisterdotcom (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.bernhardoj commentedon Sep 30, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
App crashes when switching account.
What is the root cause of that problem?
As shown by the error on the console, the error caused by the
useOnyxkeys changes from a member collection key to the whole collection key (in this case, reportNameValuePairs_xx to reportNameValuePairs_).The error is thrown specifically from
App/src/pages/home/report/ReportActionItem.tsx
Line 181 in 36032e0
When switching accounts, the report becomes undefined and we default the reportID attribute to an empty string.
App/src/pages/home/ReportScreen.tsx
Lines 169 to 173 in 36032e0
Because empty string is not undefined/null,
report?.reportID ?? -1will still be an empty string.What changes do you think we should make in order to solve the problem?
We need to use || instead of ??
I see that we use ?? for REPORT_NAME_VALUE_PAIRS in several places too, we can replace them all with || too.
abzokhattab commentedon Sep 30, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
App crashes when switching account.
What is the root cause of that problem?
when switiching the accounts, the following oynx key is resolved as
reportNameValuePairs_App/src/pages/home/report/ReportActionItem.tsx
Line 181 in 36032e0
This occurs because when switching, the report becomes empty. Since we are constructing the report object in this context, the report ID fallback value is set to an empty string instead of -1:
App/src/pages/home/ReportScreen.tsx
Line 173 in 36032e0
What changes do you think we should make in order to solve the problem?
we should change the fallback value here to
-1instead of the empty string:What alternative solutions did you explore? (Optional)
[-]Copilot - App crashes after switching account[/-][+][$250] Copilot - App crashes after switching account[/+]melvin-bot commentedon Sep 30, 2024
Job added to Upwork: https://www.upwork.com/jobs/~021840797218276068437
melvin-bot commentedon Sep 30, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rojiphil (
External)rojiphil commentedon Sep 30, 2024
Thanks for the proposals.
The root cause is that the report id becomes an empty string. Falling back to
-1will solve this issue.@bernhardoj proposal LGTM
🎀👀🎀 C+ reviewed
melvin-bot commentedon Sep 30, 2024
Triggered auto assignment to @jasperhuangg, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
melvin-bot commentedon Oct 4, 2024
@rojiphil, @twisterdotcom, @jasperhuangg Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Oct 4, 2024
📣 @rojiphil 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
Offer link
Upwork job
bernhardoj commentedon Oct 5, 2024
This is fixed in #49255.
rojiphil commentedon Oct 5, 2024
Ok. Let's close this then and move on cc @twisterdotcom @jasperhuangg