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
Updates to the custom unit rate should be persisted.
Actual Result:
Updates to the custom unit rate aren't persisted. The policy.customUnits is null.
Workaround:
Reverting changes from #10873 fixes things locally
Platform:
Where is this issue occurring?
Web
iOS
Android
Desktop App
Mobile Web
Version Number: v1.2.0-0 Reproducible in staging?: yes Reproducible in production?: no Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL: Issue reported by: Slack conversation:
The biggest thing I'm noticing from #10873 is that we're not calling Policy.loadFullPolicy anymore. This means that we'll only have loaded the policy from AppInit, which sets customUnits to be null. The only way we can grab a policy's custom units is if we load the full policy.
This is definitely what's causing the custom unit rate to be 0.000 when we first load the page, and any subsequent updates to it to fail. If you log this.props.policy.customUnits it's actually null when it shouldn't be.
I'm not entirely sure what the decision behind getting rid of the call to Policy.loadFullPolicy was, maybe we can wait for @arosiclair to clarify?
@francoisl After reading the design doc it looks like not calling Policy.loadFullPolicy was an intentional design choice to prevent additional chaining, it seems this was an unintended consequence that wasn't considered previously.
I say we revert #10873 for now to avoid blocking the deploy.
For the refactor we moved syncing customUnits to the new OpenWorkspaceReimburseView command here. I'm curious how reverting that PR fixes this issue, because I've noticed that changing the custom unit was already very wonky the last time I tried it.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Yeah from my tests, the root of the issue is that on this line, props.policy.customUnits is null, so we don't find the right customUnitRate. In turn, when we call the API, this error is thrown because we can't find the right custom rate to update.
I'm still looking if there's an easy fix for a bit.
#10873 was also the last place we called Policy.loadFullPolicy(), so there might also be additional places in the code where we rely on the whole policy being loaded that would now be broken and that we haven't seen yet.
Let's revert the PR to unblock the deploy so that we can look into a proper long-term fix.
@jasperhuangg , if you can confirm that this worked properly on production in the past, can you add details to the RCA sheet so we can track the regression? Thx
So it looks like OpenWorkspaceReimburseView is syncing the policy's customUnit correctly and this is getting passed along to the WorkspaceReimburseView without issue.
However this format is not what the page is expecting. The page is expecting the rates to be set under onyxRates not rates. Since this is undefined, the field displays as 0.000 and if you try to change it, we send mostly empty data to UpdateWorkspaceCustomUnitRate which causes the failure.
@jasperhuangg@yuwenmemon did the customUnits format change recently? And which way is the right way? Should the rates be set under rates or onyxRates?
When creating a new workspace, the CreateWorkspace command actually sets the custom unit rates under both properties and the reimburse view works with this data.
Ah that was my doing, sorry if this wasn't made clear! We had to move the rates into onxyRates temporarily to ensure that my new custom unit rate changes weren't breaking older clients, which were still accessing from rates.
Notice how in the screenshot onyxRates is keyed by ID, while rates is just an array of rates. We need the rates to be keyed by ID for them to work with any Onyx updates.
This will actually be removed in #10974, so things should just work afterwards?
Notice how in the screenshot onyxRates is keyed by ID, while rates is just an array of rates. We need the rates to be keyed by ID for them to work with any Onyx updates.
This will actually be removed in #10974, so things should just work afterwards?
Activity
melvin-bot commentedon Sep 13, 2022
Triggered auto assignment to @mallenexpensify (
AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.melvin-bot commentedon Sep 13, 2022
Current assignee @mallenexpensify is eligible for the AutoAssignerTriage assigner, not assigning anyone new.
jasperhuangg commentedon Sep 13, 2022
@francoisl
The biggest thing I'm noticing from #10873 is that we're not calling
Policy.loadFullPolicyanymore. This means that we'll only have loaded the policy fromAppInit, which sets customUnits to benull. The only way we can grab a policy's custom units is if we load the full policy.This is definitely what's causing the custom unit rate to be
0.000when we first load the page, and any subsequent updates to it to fail. If you logthis.props.policy.customUnitsit's actuallynullwhen it shouldn't be.I'm not entirely sure what the decision behind getting rid of the call to
Policy.loadFullPolicywas, maybe we can wait for @arosiclair to clarify?jasperhuangg commentedon Sep 13, 2022
@francoisl After reading the design doc it looks like not calling
Policy.loadFullPolicywas an intentional design choice to prevent additional chaining, it seems this was an unintended consequence that wasn't considered previously.I say we revert #10873 for now to avoid blocking the deploy.
arosiclair commentedon Sep 13, 2022
For the refactor we moved syncing customUnits to the new OpenWorkspaceReimburseView command here. I'm curious how reverting that PR fixes this issue, because I've noticed that changing the custom unit was already very wonky the last time I tried it.
3 remaining items
OSBotify commentedon Sep 13, 2022
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open
StagingDeployCashdeploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:francoisl commentedon Sep 13, 2022
Yeah from my tests, the root of the issue is that on this line,
props.policy.customUnitsisnull, so we don't find the rightcustomUnitRate. In turn, when we call the API, this error is thrown because we can't find the right custom rate to update.I'm still looking if there's an easy fix for a bit.
francoisl commentedon Sep 13, 2022
#10873 was also the last place we called
Policy.loadFullPolicy(), so there might also be additional places in the code where we rely on the whole policy being loaded that would now be broken and that we haven't seen yet.Let's revert the PR to unblock the deploy so that we can look into a proper long-term fix.
mallenexpensify commentedon Sep 13, 2022
@jasperhuangg , if you can confirm that this worked properly on production in the past, can you add details to the RCA sheet so we can track the regression? Thx
arosiclair commentedon Sep 14, 2022
So it looks like
OpenWorkspaceReimburseViewis syncing the policy's customUnit correctly and this is getting passed along to the WorkspaceReimburseView without issue.However this format is not what the page is expecting. The page is expecting the rates to be set under
onyxRatesnotrates. Since this is undefined, the field displays as 0.000 and if you try to change it, we send mostly empty data toUpdateWorkspaceCustomUnitRatewhich causes the failure.@jasperhuangg @yuwenmemon did the customUnits format change recently? And which way is the right way? Should the rates be set under
ratesoronyxRates?arosiclair commentedon Sep 14, 2022
When creating a new workspace, the
CreateWorkspacecommand actually sets the custom unit rates under both properties and the reimburse view works with this data.jasperhuangg commentedon Sep 15, 2022
@arosiclair
Ah that was my doing, sorry if this wasn't made clear! We had to move the rates into
onxyRatestemporarily to ensure that my new custom unit rate changes weren't breaking older clients, which were still accessing fromrates.Notice how in the screenshot
onyxRatesis keyed by ID, whileratesis just an array of rates. We need the rates to be keyed by ID for them to work with any Onyx updates.This will actually be removed in #10974, so things should just work afterwards?
arosiclair commentedon Sep 15, 2022
Yeah that sounds about right. https://github.com/Expensify/Web-Expensify/pull/34862 should get the rates keyed by ID and then our form should be working correctly again. I'll re-test the withFullPolicy refactor after that stuff gets merged in
jasperhuangg commentedon Sep 15, 2022
@arosiclair Sounds like a plan, thanks for waiting on this!
francoisl commentedon Sep 15, 2022
The fix was tested on staging #10974 (comment), closing.