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 2025-01-02] [$250] Workspace - Selected invited new user becomes unselected when returning online #53899

Closed
5 of 8 tasks
IuliiaHerets opened this issue Dec 11, 2024 · 25 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Dec 11, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.74-0
Reproducible in staging?: Yes
Reproducible in production?: No
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: Exp #52173
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Members.
  3. Go offline.
  4. Click Invite member.
  5. Invite a new user (new account).
  6. Click on the checkbox.
  7. Go online.

Expected Result:

The invited new user should remain selected.

Actual Result:

The invited new user becomes unselected.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6690438_1733875593955.20241211_080414.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021866776898629564869
  • Upwork Job ID: 1866776898629564869
  • Last Price Increase: 2024-12-11
  • Automatic offers:
    • suneox | Reviewer | 105360752
    • huult | Contributor | 105360753
Issue OwnerCurrent Issue Owner: @trjExpensify
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

Triggered auto assignment to @NikkiWines (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Dec 11, 2024

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

💬 A slack conversation has been started in #expensify-open-source

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Dec 11, 2024
Copy link
Contributor

👋 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:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@trjExpensify
Copy link
Contributor

@NikkiWines I don't think this is severe enough to be a blocker, do you?

@NikkiWines
Copy link
Contributor

No i think this is a pretty minor bug for a very edge case behavior - I don't think this needs to be a blocker but will look into what PR this originated from

@NikkiWines NikkiWines added External Added to denote the issue can be worked on by a contributor Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Dec 11, 2024
@melvin-bot melvin-bot bot changed the title Workspace - Selected invited new user becomes unselected when returning online [$250] Workspace - Selected invited new user becomes unselected when returning online Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 11, 2024
Copy link

melvin-bot bot commented Dec 11, 2024

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Dec 11, 2024

Edited by proposal-police: This proposal was edited at 2024-12-11 10:10:53 UTC.

Proposal

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

Workspace - Selected invited new user becomes unselected when returning online

What is the root cause of that problem?

  • Before this PR the check box was disabled even when details.isOptimisticPersonalDetail was true but in that PR we updated the code to use isInteractive prop for members with pending action,
    isDisabled: isPendingDeleteOrError,
    isInteractive: !details.isOptimisticPersonalDetail,

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

  • We should also pass interactive prop to the checkmark pressable container. interactive={item.isInteractive ?? true}.
  • Or instead of using interactive prop we can modify the disabled prop of the checkbox disabled={isDisabled || item.isDisabledCheckbox || (item.isInteractive ?? true)}.
    {!!canSelectMultiple && (
    <PressableWithFeedback
    accessibilityLabel={item.text ?? ''}
    role={CONST.ROLE.BUTTON}
    // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
    disabled={isDisabled || item.isDisabledCheckbox}
    onPress={handleCheckboxPress}
    style={[styles.cursorUnset, StyleUtils.getCheckboxPressableStyle(), item.isDisabledCheckbox && styles.cursorDisabled, styles.mr3, item.cursorStyle]}
    >
    <View style={[StyleUtils.getCheckboxContainerStyle(20), StyleUtils.getMultiselectListStyles(!!item.isSelected, !!item.isDisabled), item.cursorStyle]}>
    {!!item.isSelected && (
    <Icon
    src={Expensicons.Checkmark}
    fill={theme.textLight}
    height={14}
    width={14}
  • We should also check other similar components like TableListItem.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?


What alternative solutions did you explore? (Optional)

Copy link
Contributor

rdeanda Your proposal will be dismissed because you did not follow the proposal template.

@ChavdaSachin
Copy link
Contributor

@Krishna2323 I am curious here,
I was working out to find the root cause here for some time, could you explain why checkbox is unmarked when going online back? Coz at that time when app goes online, isSelected should be true and also isDisabled would be false, so I can't seem to really understand the root cause why selection is removed!

@Krishna2323
Copy link
Contributor

@ChavdaSachin when isOptimisticPersonalDetail is true then the user shouldn't be able to select the item at the first place. The expected behaviour in the OP isn't correct.

The invited new user should remain selected.

@suneox
Copy link
Contributor

suneox commented Dec 14, 2024

@Krishna2323 Thank you for your proposal, but the expected result for this issue is that The invited new user should remain selected rather than disable selection when offline, because users should still be able to update the value in offline mode.

Screen.Recording.2024-12-14.at.18.10.58.mp4

@Krishna2323

This comment was marked as resolved.

@huult
Copy link
Contributor

huult commented Dec 14, 2024

Proposal

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

Selected invited new user becomes unselected when returning online

What is the root cause of that problem?

When a member is added offline and transitions to online, filter the previously selected employees based on the new personal details, as unknown or new user IDs may change during the transition

// Filter all personal details in order to use the elements needed for the current workspace

The prevPersonalDetails will have the data type OnyxEntry. For example:

{
1153713: {accountID: 1153713, avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/default-avatar_10.png', firstName: '', lastName: ''}
1951440: {accountID: 1951440, avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/default-avatar_1.png', firstName: '', lastName: ''}
360920167: {login: '[email protected]', accountID: 360920167, displayName: '[email protected]', isOptimisticPersonalDetail: true} // This is the member added in offline mode
}

We use prevPersonalDetails?.id to get prevItem. Using this approach, the value of prevItem is undefined. As a result, prevSelectedElements will return the previous ID which is the ID from offline mode.

prevPersonalDetails = {
1153713: {accountID: 1153713, avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/default-avatar_10.png', firstName: '', lastName: ''}
1951440: {accountID: 1951440, avatar: 'https://d2k5nsl2zxldvw.cloudfront.net/images/avatars/default-avatar_1.png', firstName: '', lastName: ''}
360920167: {login: '[email protected]', accountID: 360920167, displayName: '[email protected]', isOptimisticPersonalDetail: true} // This is the member added in offline mode
}

prevPersonalDetails?.id => undefined

const prevItem = prevPersonalDetails?.id;
const res = Object.values(currentPersonalDetails).find((item) => prevItem?.login === item?.login);
return res?.accountID ?? id;
});

we received prevSelectedElements, which contains the ID from offline mode. When we switch back to online, this ID is not included in members, causing the issue to occur.

return [prevSelectedElements, currentSelectedElements].reduce((prev, members) => prev.filter((item) => members.includes(item)));

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

To resolve this issue, we should update the way to get prevItem correctly, something like this:

const prevItem = prevPersonalDetails?.id;

update to:

 const prevItem = prevPersonalDetails?.id ?? prevPersonalDetails[id];
 or
  const prevItem = prevPersonalDetails[id];
POC
Screen.Recording.2024-12-15.at.00.54.33.mp4

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

  1. prevPersonalDetails is an object and id is a valid key
  2. prevPersonalDetails[id] is undefined (either because id doesn’t exist in prevPersonalDetails or prevPersonalDetails is null or undefined)

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@suneox
Copy link
Contributor

suneox commented Dec 16, 2024

@huult Thank you for your proposal has pointing out the outdated prevPersonalDetails data when returning online. We can proceed with this proposal

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 16, 2024

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

@chiragsalian
Copy link
Contributor

Proposal LGTM, feel free to create the PR @huult.

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

melvin-bot bot commented Dec 16, 2024

📣 @suneox 🎉 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 Dec 16, 2024

📣 @huult 🎉 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 17, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 26, 2024
@melvin-bot melvin-bot bot changed the title [$250] Workspace - Selected invited new user becomes unselected when returning online [HOLD for payment 2025-01-02] [$250] Workspace - Selected invited new user becomes unselected when returning online Dec 26, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 26, 2024
Copy link

melvin-bot bot commented Dec 26, 2024

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

Copy link

melvin-bot bot commented Dec 26, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.78-6 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 2025-01-02. 🎊

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

Copy link

melvin-bot bot commented Dec 26, 2024

@suneox @trjExpensify @suneox The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@suneox
Copy link
Contributor

suneox commented Jan 1, 2025

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: https://github.com/Expensify/App/pull/35065/files#r1900434022

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    N/A: It isn't an impactful bug

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 2, 2025
@trjExpensify
Copy link
Contributor

Thanks! Agree with the assessment above. Payment summary as follows:

Paid, closing!

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants