Open lanitochka17 opened 4 days ago
Triggered auto assignment to @anmurali (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.
@anmurali FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Error shows up when adding distance rates to the workspace created from actionable whisper
The error is an invalid ID in the custom unit
The RCA is when we categorize with a new workspace, it's created in frontend with a customUnitID
but we don't pass this to the parameter of TrackExpense
API then BE returns another customUnitID
for the new WS.
If it's the new WS, we've passed some data in createdWorkspaceParams
, we can pass additional data customUnitID
and customUnitRateID
to the parameter. BE also needs to use these parameters to update customUnits
data of the workspace if required.
customUnitID: createdWorkspaceParams?.customUnitID,
customUnitRateID: createdWorkspaceParams?.customUnitRateID
NA
Distance rates - Error shows up when adding distance rates to the workspace created from actionable whisper
When we press new workspace button a new workspace will be created with customUnits generated in FE onyx only
https://github.com/Expensify/App/blob/4a25c36e50b58ef9e5ba8b63cf32132f95a0b005/src/pages/iou/request/step/IOURequestStepParticipants.tsx#L134
https://github.com/Expensify/App/blob/4a25c36e50b58ef9e5ba8b63cf32132f95a0b005/src/libs/ReportUtils.ts#L8004
now we will have a draft policy in onyx only and when we open the workspace profile page we fetch the policy with that policyID from BE here
https://github.com/Expensify/App/blob/4a25c36e50b58ef9e5ba8b63cf32132f95a0b005/src/pages/workspace/WorkspaceProfilePage.tsx#L97
so now OPEN_POLICY_PROFILE_PAGE
API will return a policy data and it will merge the customUnit that only existed in FE with customUnits from the server. Therefore, when we create a distance rate the customUnitRateID in onyx will be sent but the BE doesn't know it so it returns error
By the way, the problem is even more serious: if you finish on categorizing with the new workspace you created in track flow and create the expense but sign out or clear cache before opening the profile page of the new workspace created the workspace along with the expense created from the track expense will be lost as the data was only saved in onyx only not in server.
What we should do is call createWorkspace
instead of createDraftWorkspace
(that will create the workspace both optimisticData and in server) here
https://github.com/Expensify/App/blob/4a25c36e50b58ef9e5ba8b63cf32132f95a0b005/src/libs/ReportUtils.ts#L8004
similar to what we do when we create workspace in onboarding flow here
const {expenseChatReportID, policyID, policyName} = PolicyActions.createWorkspace();
We can then remove createDraftWorkspace
as we no longer need it.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.50-3 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A 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+giugihiuhi@applause.expensifail.com Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Distance rates will be added without issue
Actual Result:
Error shows up when adding distance rates to the workspace created from actionable whisper
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/26d248bd-0d4d-4db9-a82f-7674e0f5c18d
View all open jobs on GitHub