Skip to content
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

[HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [$250] Workspace - Empty screen when transferring ownership of the workplace #43143

Closed
1 of 6 tasks
lanitochka17 opened this issue Jun 5, 2024 · 24 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jun 5, 2024

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: 1.4.79-3
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4593414&group_by=cases:section_id&group_order=asc&group_id=229065
Email or phone of affected tester (no customers): applausetester+47pronin@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

As User A:

  1. Create a Workspace
  2. Ad User B as a member
  3. Set User B as Admin
    As User B:
  4. Go to created workspace
  5. Transfer ownership

Expected Result:

Success screen should be displayed

Actual Result:

Empty screen appears with no-name button before success screen

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6502388_1717571511325.video_40.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019cbfaae4a7b3b66e
  • Upwork Job ID: 1799209224020053309
  • Last Price Increase: 2024-06-07
  • Automatic offers:
    • eh2077 | Reviewer | 102718569
    • bernhardoj | Contributor | 102718571
Issue OwnerCurrent Issue Owner: @johncschuster
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 5, 2024
Copy link

melvin-bot bot commented Jun 5, 2024

Triggered auto assignment to @johncschuster (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.

@lanitochka17
Copy link
Author

@johncschuster 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

@bernhardoj
Copy link
Contributor

bernhardoj commented Jun 6, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Blank view when going to transfer ownership page.

What is the root cause of that problem?

When we press transfer owner, it will request a check and navigate to the check page with a default error param of amountOwed.

const startChangeOwnershipFlow = useCallback(() => {
Policy.clearWorkspaceOwnerChangeFlow(policyID);
Policy.requestWorkspaceOwnerChange(policyID);
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, 'amountOwed' as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));

After the check is done, it will check whether the error param passed to the page is the same as the error from the check that we request before.

const updateDisplayTexts = useCallback(() => {
const changeOwnerErrors = Object.keys(policy?.errorFields?.changeOwner ?? {});
if (error !== changeOwnerErrors[0]) {
return;
}
const texts = WorkspaceSettingsUtils.getOwnershipChecksDisplayText(error, translate, policy, personalDetails?.[accountID]?.login);
setDisplayTexts(texts);

If it's not the same, we don't display anything, but if it's the same, we will display the text to explain the error.

In our case, I get a noBillingCard error, but it can be repro happen with any error (except amountOwed because this is the default value that we pass as the error). Because noBillingCard is not the same as amountOwed, nothing is displayed.

However, the app is supposed to update the error params when the check is done (in a useEffect). There is currently 2 places that do this. One in the check page itself,

if (changeOwnerErrors && changeOwnerErrors.length > 0 && changeOwnerErrors[0] !== CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD) {
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, changeOwnerErrors[0] as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
}
}, [accountID, policy, policy?.errorFields?.changeOwner, policyID]);

and the other one is in the member details page.

if (changeOwnerErrors && changeOwnerErrors.length > 0) {
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, changeOwnerErrors[0] as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
}
}, [accountID, policy?.errorFields?.changeOwner, policy?.isChangeOwnerSuccessful, policyID]);

This dupe logic can be cleaned up.

However, a recent change from #42335 doesn't allow to perform a navigate to the same screen even if the params is different (in our case the error param).

// If the current focused route is the same as the target focused route, we don't want to navigate.
if (currentFocusedRoute?.name === targetFocusedRoute?.name) {
return;
}

So, the error param is never updated.

What changes do you think we should make in order to solve the problem?

First of all, I'd to suggest a cleanup to the dupe error check logic. First, remove the exception of no billing card error here, we want to update any error we got

if (changeOwnerErrors && changeOwnerErrors.length > 0 && changeOwnerErrors[0] !== CONST.POLICY.OWNERSHIP_ERRORS.NO_BILLING_CARD) {
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, changeOwnerErrors[0] as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
}

Why the exception is there in the first place? I believe that's because initially, no billing card has a separate page to show the error. In this commit, you can see that when we press transfer owner, it won't immediately navigate us to the owner change check page. Instead, it will wait for the request to done first and if it's error, it checks whether it's a no billing card error or other errors. If it's no billing card error, it will navigate to no billing card error page, otherwise it will go to WORKSPACE_OWNER_CHANGE_CHECK, which is the page that we use now for all errors.

Then, we can remove the one from the member detail page.

useEffect(() => {
if (!policy?.errorFields?.changeOwner && policy?.isChangeOwnerSuccessful) {
return;
}
const changeOwnerErrors = Object.keys(policy?.errorFields?.changeOwner ?? {});
if (changeOwnerErrors && changeOwnerErrors.length > 0) {
Navigation.navigate(ROUTES.WORKSPACE_OWNER_CHANGE_CHECK.getRoute(policyID, accountID, changeOwnerErrors[0] as ValueOf<typeof CONST.POLICY.OWNERSHIP_ERRORS>));
}
}, [accountID, policy?.errorFields?.changeOwner, policy?.isChangeOwnerSuccessful, policyID]);

Now, the real solution to the issue is that we need to allow to navigate to the same screen if the params are different. We can follow a similar check as we already have here.

const areParamsDifferent =
action.payload.params?.screen === SCREENS.REPORT
? getTopmostReportId(rootState) !== getTopmostReportId(stateFromPath)
: !shallowCompare(
omitBy(topmostCentralPaneRoute?.params as Record<string, unknown> | undefined, (value) => value === undefined),
omitBy(action.payload.params?.params as Record<string, unknown> | undefined, (value) => value === undefined),
);

if (currentFocusedRoute?.name === targetFocusedRoute?.name && shallowCompare(currentFocusedRoute?.params, targetFocusedRoute?.params)) {
    return;
}

Or, we can use Navigation.setParams to update the param manually instead of using navigate.

@johncschuster johncschuster added the External Added to denote the issue can be worked on by a contributor label Jun 7, 2024
@melvin-bot melvin-bot bot changed the title Workspace - Empty screen when transferring ownership of the workplace [$250] Workspace - Empty screen when transferring ownership of the workplace Jun 7, 2024
Copy link

melvin-bot bot commented Jun 7, 2024

Job added to Upwork: https://www.upwork.com/jobs/~019cbfaae4a7b3b66e

@melvin-bot melvin-bot bot added Overdue Help Wanted Apply this label when an issue is open to proposals by contributors labels Jun 7, 2024
Copy link

melvin-bot bot commented Jun 7, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 (External)

@melvin-bot melvin-bot bot removed the Overdue label Jun 7, 2024
@eh2077
Copy link
Contributor

eh2077 commented Jun 10, 2024

Reviewing proposals

@eh2077
Copy link
Contributor

eh2077 commented Jun 10, 2024

This isn’t a bug with straightforward root cause and fix - it's related to subtle navigation feature and function. So, I'll need to take more time to understand the root cause.

@eh2077
Copy link
Contributor

eh2077 commented Jun 12, 2024

I'll prioritise this tmr.

@eh2077
Copy link
Contributor

eh2077 commented Jun 13, 2024

I think @bernhardoj 's RCA is correct and their solution to include route parameters check for SideModalNavigator also makes sense to me.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jun 13, 2024

Triggered auto assignment to @madmax330, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

📣 @eh2077 🎉 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

Copy link

melvin-bot bot commented Jun 13, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@bernhardoj
Copy link
Contributor

PR is ready

cc: @eh2077

@melvin-bot melvin-bot bot removed the Weekly KSv2 label Jun 17, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Jun 17, 2024
@melvin-bot melvin-bot bot changed the title [$250] Workspace - Empty screen when transferring ownership of the workplace [HOLD for payment 2024-06-24] [$250] Workspace - Empty screen when transferring ownership of the workplace Jun 17, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Jun 17, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.84-3 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-06-24. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jun 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:

  • [@eh2077] The PR that introduced the bug has been identified. Link to the PR:
  • [@eh2077] 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:
  • [@eh2077] 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:
  • [@eh2077] Determine if we should create a regression test for this bug.
  • [@eh2077] 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.
  • [@johncschuster] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jun 21, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-06-24] [$250] Workspace - Empty screen when transferring ownership of the workplace [HOLD for payment 2024-06-28] [HOLD for payment 2024-06-24] [$250] Workspace - Empty screen when transferring ownership of the workplace Jun 21, 2024
Copy link

melvin-bot bot commented Jun 21, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.85-7 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-06-28. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jun 21, 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:

  • [@eh2077] The PR that introduced the bug has been identified. Link to the PR:
  • [@eh2077] 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:
  • [@eh2077] 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:
  • [@eh2077] Determine if we should create a regression test for this bug.
  • [@eh2077] 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.
  • [@johncschuster] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@johncschuster
Copy link
Contributor

@eh2077 can you address the BZ Checklist please? Thank you!

@johncschuster
Copy link
Contributor

I have issued payment. We're just waiting on the completion of the BZ Checklist.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 24, 2024
@johncschuster
Copy link
Contributor

@eh2077 bump on this. Can you complete the BZ Checklist so we can button this one up? Thank you!

@eh2077
Copy link
Contributor

eh2077 commented Jun 25, 2024

Sure I'll complete the checklist by tomorrow thank you

@eh2077
Copy link
Contributor

eh2077 commented Jun 26, 2024

Checklist

Regression test

  1. Open workspace where you are admin
  2. Press the owner to open the detail page
  3. Press Transfer owner
  4. Verify after loading, a non empty screen is shown

Do we agree 👍 or 👎

cc @johncschuster

@johncschuster
Copy link
Contributor

Thanks for completing that, @eh2077!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

5 participants