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
[HOLD for payment 2024-07-24] [$250] [HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it #42900
Version Number: Reproducible in staging?: Reproducible in production?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@mountiny Slack conversation:
Action Performed:
Break down in numbered steps
Go to settings
Navigate to workspaces
Select a workspace
Notice that OpenWorkspaceView API command is called
Expected Result:
Describe what you think should've happened
this command is used to load bank account data and it should be called in Workflows page and/ or some other pages where we might need the bank account information for the policy, paid or free (still since migration is not complete)
Actual Result:
Describe what actually happened
This is being called on pages where the bank account details are not needed
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-][HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/-][+][$250] [HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/+]on May 31, 2024
either we need to refactor this code so the API call is not in the WorkspacePageWithSections component as then people will forget to pass the shouldSkipVBBA call - that would be ideal, or we make that param required and pass it everywhere
Please re-state the problem that we are trying to solve in this issue. n
The problem we are trying to solve is that the OpenWorkspaceView API call is being made on pages that do not require it. This results in unnecessary API calls, which can lead to performance issues and inefficient use of resources.
What is the root cause of that problem?
The root cause of the problem is that the OpenWorkspaceView API call is embedded within the WorkspacePageWithSections component. This leads to the API call being executed regardless of whether the page actually requires bank account information, as the component does not conditionally skip the API call when it is not needed.
What changes do you think we should make in order to solve the problem?
To solve this problem, we propose the following changes:
Ensure that the parameter shouldSkipVBBACall is required and passed explicitly wherever the WorkspacePageWithSections component is used.
Update all relevant pages and components to correctly utilize the shouldSkipVBBACall parameter, making sure that the OpenWorkspaceView API call is only made on pages where bank account details are actually needed.
additionally we need add shouldSkipVBBACall to the WorkspaceProfilePage to prevent the current issue from occurring
Optionally:
To preserve the separation of concerns principle, we can create an intermediate component WorkspaceViewLoader which will handle the fetching and loading parts. This component will return a loading component if the data is still loading; otherwise, it will return the children components.
This component should be called within the WorkspacePageWithSections component.
Alternatively
To preserve the separation of concerns principle, we can:
Completely remove the shouldSkipVBBACall flag.
Create a new component, WorkspacePageWithSectionsAndDataLoaded, that handles the data fetching and loading parts. This component will then return WorkspacePageWithSections with the fetched data passed to it.
then in components that require VBB call, the new component should be used, otherwise use the WorkspacePageWithSections component
changed the title [-][$250] [HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/-][+][HOLD for payment 2024-07-24] [$250] [HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/+]on Jul 17, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.7-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@hoangzinh] The PR that introduced the bug has been identified. Link to the PR:
[@hoangzinh] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@hoangzinh] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@hoangzinh] Determine if we should create a regression test for this bug.
[@hoangzinh] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@greg-schroeder] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
Activity
melvin-bot commentedon May 31, 2024
Triggered auto assignment to @greg-schroeder (
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.[-][HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/-][+][$250] [HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/+]melvin-bot commentedon May 31, 2024
Job added to Upwork: https://www.upwork.com/jobs/~01c3a5ef10ba51590e
melvin-bot commentedon May 31, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (
External)mountiny commentedon May 31, 2024
either we need to refactor this code so the API call is not in the
WorkspacePageWithSectionscomponent as then people will forget to pass the shouldSkipVBBA call - that would be ideal, or we make that param required and pass it everywhereabzokhattab commentedon May 31, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue. n
The problem we are trying to solve is that the
OpenWorkspaceViewAPI call is being made on pages that do not require it. This results in unnecessary API calls, which can lead to performance issues and inefficient use of resources.What is the root cause of that problem?
The root cause of the problem is that the
OpenWorkspaceViewAPI call is embedded within theWorkspacePageWithSectionscomponent. This leads to the API call being executed regardless of whether the page actually requires bank account information, as the component does not conditionally skip the API call when it is not needed.What changes do you think we should make in order to solve the problem?
To solve this problem, we propose the following changes:
shouldSkipVBBACallis required and passed explicitly wherever theWorkspacePageWithSectionscomponent is used.shouldSkipVBBACallparameter, making sure that theOpenWorkspaceViewAPI call is only made on pages where bank account details are actually needed.shouldSkipVBBACallto the WorkspaceProfilePage to prevent the current issue from occurringOptionally:
To preserve the separation of concerns principle, we can create an intermediate component
WorkspaceViewLoaderwhich will handle the fetching and loading parts. This component will return a loading component if the data is still loading; otherwise, it will return the children components.This component should be called within the
WorkspacePageWithSectionscomponent.Alternatively
To preserve the separation of concerns principle, we can:
shouldSkipVBBACallflag.WorkspacePageWithSectionsAndDataLoaded, that handles the data fetching and loading parts. This component will then returnWorkspacePageWithSectionswith the fetched data passed to it.WorkspacePageWithSectionscomponent79 remaining items
mountiny commentedon Jul 9, 2024
The Auth PR was merged
greg-schroeder commentedon Jul 16, 2024
On staging
[-][$250] [HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/-][+][HOLD for payment 2024-07-24] [$250] [HIGH] [API] OpenWorkspaceView API call is made on pages that do not need it[/+]melvin-bot commentedon Jul 17, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jul 17, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.7-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-07-24. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jul 17, 2024
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
greg-schroeder commentedon Jul 24, 2024
This is for the backend PR, no contributors were involved in that one