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-04-15] [$500] Room - WS is not shown empty on setting collect WS as default. #37656

Closed
3 of 6 tasks
lanitochka17 opened this issue Mar 2, 2024 · 39 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 Mar 2, 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.46
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/4359738
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

Pre-condition: User A in old dot must have a collect workspace

  1. Launch app with user A
  2. As same user login old dot
  3. Set Collect Workspace as default
  4. In new dot, tap fab --- start chat
  5. Tap room
  6. Note the Workspace field

Expected Result:

The Workspace you are currently filtering by should be shown as the top suggested option when creating a room. If filtering by all, your default workspace should be shown as the top suggested option when creating a room.

Actual Result:

Workspace is not shown empty on setting personal Workspace as default

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

Bug6399190_1709557892248.changee.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 2, 2024
Copy link

melvin-bot bot commented Mar 2, 2024

Triggered auto assignment to @MitchExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@lanitochka17
Copy link
Author

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

@allgandalf
Copy link
Contributor

Proposal

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

WS is not shown empty on setting collect WS as default

What is the root cause of that problem?

In useEffect, we set PolicyID to activePolicyID when the any value from workspaceOptions match activePolicyID

useEffect(() => {
if (policyID) {
if (!workspaceOptions.some((opt) => opt.value === policyID)) {
setPolicyID('');
}
return;
}
if (!!activePolicyID && workspaceOptions.some((opt) => opt.value === activePolicyID)) {
setPolicyID(activePolicyID);
} else {
setPolicyID('');
}
}, [activePolicyID, policyID, workspaceOptions]);

And this further sets the default value over here:

<InputWrapper
InputComponent={ValuePicker}
inputID={INPUT_IDS.POLICY_ID}
label={translate('workspace.common.workspace')}
items={workspaceOptions}
value={policyID}
onValueChange={(value) => setPolicyID(value as typeof policyID)}
/>

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

In useEffect as well as useState , we must add one more condition to check for the type of the current option and only set the policy id to the active one if it is not equal to team:

image

Essentially we would set setPolicyID to empty string in useEffect and return empty string in useState The update would be like:

    const [policyID, setPolicyID] = useState<string>(() => {
        if (!!activePolicyID && workspaceOptions.some((option) => (option.value === activePolicyID && option.type !== CONST.POLICY.TYPE.TEAM))) {
            return activePolicyID;
        }
        return '';
    });
    
    useEffect(() => {
     .....
        if (!!activePolicyID && workspaceOptions.some((opt) => (opt.value === activePolicyID && opt.type !== CONST.POLICY.TYPE.TEAM))) {
            setPolicyID(activePolicyID);
        }

The type property is inherited from workspaceOptions, we will define a new variable as type which is present in policy

const workspaceOptions = useMemo(
() =>
PolicyUtils.getActivePolicies(policies)
?.filter((policy) => policy.type !== CONST.POLICY.TYPE.PERSONAL)
.map((policy) => ({
label: policy.name,
value: policy.id,
}))
.sort((a, b) => localeCompare(a.label, b.label)) ?? [],
[policies],
);

Result:

simplescreenrecorder-2024-03-03_05.58.41.mp4

@MitchExpensify
Copy link
Contributor

I'm not sure why we'd want the Workspace field to show be blank here on the room creation screen. I'd expect us to show the Collect default workspace in the workspace field which seems to be what is happening - Rigth @lanitochka17 ?

@Krishna2323
Copy link
Contributor

Krishna2323 commented Mar 4, 2024

Proposal

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

Room - WS is not shown empty on setting collect WS as default.

What is the root cause of that problem?

I believe the current behavior is partially correct. When a user has set a default workspace, it should be selected as the default in the room creation flow. However, the issue arises when the user switches to a different workspace in NewDot from the workspace switcher. When the user creates a room, the default workspace remains the default from the OldDot. In my opinion, for better user experience, we should select the newly selected workspace from NewDot.

Bug Video

default_workspace_bug.mp4

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

Instead of checking for activePolicyID from OldDot first, we should verify whether the user has selected any workspace from NewDot. If there is no selected workspace in NewDot, we will set the default to activePolicyID from OldDot. We can obtain the active workspace in NewDot using const {activeWorkspaceID} = useActiveWorkspace(). Then, we can use const activeID = activeWorkspaceID ?? activePolicyID; to obtain the default value for policyID.

We will replace activePolicyID with activeID.

Result

default_ws.mp4

Alternative

If we want to always show empty default WS we can remove code blocks below:

if (!!activePolicyID && workspaceOptions.some((option) => option.value === activePolicyID)) {
return activePolicyID;
}

if (!!activePolicyID && workspaceOptions.some((opt) => opt.value === activePolicyID)) {
setPolicyID(activePolicyID);
} else {

@Krishna2323
Copy link
Contributor

@MitchExpensify, can you please provide some feedback on this? Thanks

I believe the current behavior is partially correct. When a user has set a default workspace, it should be selected as the default in the room creation flow. However, the issue arises when the user switches to a different workspace in NewDot from the workspace switcher. When the user creates a room, the default workspace remains the default from the OldDot. In my opinion, for better user experience, we should select the newly selected workspace from NewDot.

Bug Video

default_workspace_bug.mp4

@MitchExpensify
Copy link
Contributor

Yeah this is an interesting question @Krishna2323 - Should the workspace you are filtering by in NewDot be shown as the default workspace when creating a room? I think the answer is "yes" and I'll double-check internally that others agree!

@Krishna2323
Copy link
Contributor

@MitchExpensify, any updates?

@melvin-bot melvin-bot bot added the Overdue label Mar 8, 2024
@allgandalf
Copy link
Contributor

allgandalf commented Mar 8, 2024

Should the workspace you are filtering by in NewDot be shown as the default workspace when creating a room?

@MitchExpensify I think collect workspaces are still not show by default in ND, we need to run a script when we create new collect policy in OD for it to show in ND, so I think not relying on ND workspace is a safe option

(not 100% sure about this, but just thought this out loud :) )

I'm not sure why we'd want the Workspace field to show be blank here on the room creation screen.

We are updating ND to create collect workspaces by default, with this change, we give the user 7 day free trail, when it is over then we don't want the user to create a room with the expired workspace, and hence i think the expected behavior is mentioned in the issue

@MitchExpensify
Copy link
Contributor

Double checking what the team thinks!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Mar 10, 2024
@Krishna2323
Copy link
Contributor

@MitchExpensify, do we have an update here?

Copy link

melvin-bot bot commented Mar 14, 2024

@MitchExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@MitchExpensify
Copy link
Contributor

Yes! The expected behavior is to show the Workspace you are currently filtering by as the suggested Workspace when creating a room. Updated the expected behavior:

Expected Result:

The Workspace you are currently filtering by should be shown as the top suggested option when creating a room. If filtering by all, your default workspace should be shown as the top suggested option when creating a room.

@melvin-bot melvin-bot bot removed the Overdue label Mar 16, 2024
@MitchExpensify MitchExpensify added Help Wanted Apply this label when an issue is open to proposals by contributors Overdue External Added to denote the issue can be worked on by a contributor labels Mar 16, 2024
@melvin-bot melvin-bot bot changed the title Room - WS is not shown empty on setting collect WS as default. [$500] Room - WS is not shown empty on setting collect WS as default. Mar 16, 2024
Copy link

melvin-bot bot commented Mar 16, 2024

Job added to Upwork: https://www.upwork.com/jobs/~014b390ee1a3dc9cad

Copy link

melvin-bot bot commented Mar 16, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Mar 16, 2024
Copy link

melvin-bot bot commented Mar 16, 2024

@MitchExpensify @ishpaul777 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Mar 18, 2024
@hoangzinh
Copy link
Contributor

Thanks @MitchExpensify I will review proposals today

@hoangzinh
Copy link
Contributor

Thanks for proposals, everyone. I like @Krishna2323's proposal here. He coordinated with Mitch to come up with the right expectations. He also provided a correct RCA and solution.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 21, 2024

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

@Krishna2323
Copy link
Contributor

@hoangzinh, PR ready for review.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 8, 2024
@melvin-bot melvin-bot bot changed the title [$500] Room - WS is not shown empty on setting collect WS as default. [HOLD for payment 2024-04-15] [$500] Room - WS is not shown empty on setting collect WS as default. Apr 8, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 8, 2024
Copy link

melvin-bot bot commented Apr 8, 2024

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

Copy link

melvin-bot bot commented Apr 8, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 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-04-15. 🎊

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

  • @hoangzinh requires payment (Needs manual offer from BZ)
  • @Krishna2323 requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Apr 8, 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:

  • [@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.
  • [@MitchExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@MitchExpensify
Copy link
Contributor

Payment summary:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 14, 2024
@MitchExpensify
Copy link
Contributor

Friendly bump on your regression step suggestion @hoangzinh 🙇

Offers sent for payment on this Job https://www.upwork.com/jobs/~014b390ee1a3dc9cad

@Krishna2323
Copy link
Contributor

@MitchExpensify thanks, accepted 😁

Copy link

melvin-bot bot commented Apr 15, 2024

Payment Summary

Upwork Job

BugZero Checklist (@MitchExpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@MitchExpensify
Copy link
Contributor

paid, thanks @Krishna2323 !

@hoangzinh
Copy link
Contributor

Regression Test Proposal

Pre-condition: User must have a default workspace and some other workspaces in OldDot

  1. Sign in to New Dot
  2. Tap FAB => Start chat
  3. Select tab Room
  4. Verify the default WS from OldDot is auto-selected in the workspace select box
  5. Close "Start chat" modal
  6. Open the workspace switcher => select any other workspace
  7. Repeat step 2->3
  8. Verify that the workspace selected in step 5 is auto-selected in the workspace select box

Do we agree 👍 or 👎

@hoangzinh
Copy link
Contributor

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR: I think there is no PR causing this issue. It's a new requirement/expected result.
  • 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: N/A
  • 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: N/A
  • Determine if we should create a regression test for this bug: Yes

@hoangzinh
Copy link
Contributor

@MitchExpensify could you process payment for me in upwork? Thanks

@MitchExpensify
Copy link
Contributor

Done!

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

7 participants