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 2023-11-22] [$500] New room - Workspace selector doesn't highlight when selected #29675

Closed
6 tasks done
kbecciv opened this issue Oct 16, 2023 · 60 comments
Closed
6 tasks done
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

@kbecciv
Copy link

kbecciv commented Oct 16, 2023

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.3.84.1
Reproducible in staging?: y
Reproducible in production?: y
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: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697209356639479

Action Performed:

  1. Create some WS
  2. Click FAB button
  3. Click send message and select room tab
  4. Click workspace section
  5. Select any workspace
  6. Click workspace section again, Observe that the selected item is not highlighted

Expected Result:

Selected item is highlighted

Actual Result:

Selected item is not highlighted

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

Android: Native
Screen.Recording.2023-10-13.at.22.58.41.mov
Android: mWeb Chrome
Screen.Recording.2023-10-13.at.22.54.20.mov
iOS: Native
Screen.Recording.2023-10-13.at.22.54.40.mov
iOS: mWeb Safari
Screen.Recording.2023-10-13.at.22.08.35.mov
MacOS: Chrome / Safari
Screen.Recording.2023-10-13.at.22.02.51.mov
MacOS: Desktop
Screen.Recording.2023-10-13.at.22.04.20.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a505b5f852bd2d0f
  • Upwork Job ID: 1713907491046084608
  • Last Price Increase: 2023-10-30
  • Automatic offers:
    • 0xmiroslav | Reviewer | 27552192
    • namhihi237 | Contributor | 27552193
    • namhihi237 | Reporter | 27552194
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 16, 2023
@melvin-bot melvin-bot bot changed the title New room - Workspace selector doesn't highlight when selected [$500] New room - Workspace selector doesn't highlight when selected Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

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

@kbecciv
Copy link
Author

kbecciv commented Oct 16, 2023

Proposal by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697209356639479

Proposal

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

The selected item is highlighted on some selectors on Create Room, we need to fix them

What is the root cause of that problem?

In Visibility and Workspace selectors when creating a room we use ValueSelectorModal component and it uses SelectionList but we pass the initiallyFocusedOptionKey incorrectly.

<SelectionList
sections={[{data: sectionsData}]}
onSelectRow={onItemSelected}
initiallyFocusedOptionKey={currentValue}
/>

It should be the same we create keyForList in itemsData
const itemsData = _.map(items, (item) => ({value: item.value, keyForList: item.value, text: item.label, isSelected: item === selectedItem}));

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

We should update correctly initiallyFocusedOptionKey:

initiallyFocusedOptionKey={selectedItem.value}

What alternative solutions did you explore? (Optional)

Also, we can remove currentValue prop because it doesn't used

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 16, 2023

Proposal

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

Selected item is not highlighted

What is the root cause of that problem?

  1. In here, we're passing the currentValue incorrectly, we're passing the label to it, while we should use the value of the selected option (similar patterns for other places like here)
  2. The fallback value of focusedIndex here is not ideal. It's defaulting to -1 if initiallyFocusedOptionKey is not found. IMO if initiallyFocusedOptionKey is not passed, it should default to the index of the item that has isSelected true, if there's no item that has isSelected true, then it can be -1.

This unideal design leads to us duplicating the logic by passing initiallyFocusedOptionKey as the key of the selected item in almost all selection list places like here, here, here. If we default to the isSelected item, we can omit initiallyFocusedOptionKey in all those places and only pass it if we need to customize (initially focus on something other than isSelected)

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

  1. Change this to
currentValue={value}
  1. Fix here so that it finds the focusedIndex based on the following priority:
  • initiallyFocusedOptionKey
  • item that has isSelected as true
  • -1

We can optionally remove initiallyFocusedOptionKey in a lot of places since it's no longer needed after the above correct default is implemented. In the future for SelectionList we also (mostly) don't have to add it, reducing surface for errors like this to happen.

What alternative solutions did you explore? (Optional)

NA

@atef1995
Copy link

atef1995 commented Oct 16, 2023

Proposal for Issue #29675

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

The current implementation of the ValueSelectorModal component does not correctly highlight the selected item when the workspace section is clicked again.

Root Cause

The issue is likely due to how isSelected is being set in the useEffect function. Specifically, the comparison item === selectedItem is an object reference comparison, which may not behave as intended if item and selectedItem are not referring to the exact same object.

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

Object Equality: Change the object reference equality check to a value equality check for the relevant fields. This will ensure that items are correctly marked as selected based on their value property.

Logging and Debugging: Temporarily add console logs inside the useEffect to ensure that items and selectedItem are being updated as expected. Remove these logs once the issue is confirmed to be fixed.

Contributor details
Your Expensify account email: atefm6@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01bce955e983cc4f4e

@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

📣 @atef1995! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@joekaufmanexpensify
Copy link
Contributor

Going to triage this tomorrow

@melvin-bot melvin-bot bot added the Overdue label Oct 20, 2023
@joekaufmanexpensify
Copy link
Contributor

Seems like this is a bug, but confirming here that this should not have been fixed in another issue

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 20, 2023
@joekaufmanexpensify
Copy link
Contributor

Okay, confirmed we can proceed here. @0xmiroslav could you share whether any of these proposals work?

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@joekaufmanexpensify
Copy link
Contributor

Pending review of proposals

@0xmiros
Copy link
Contributor

0xmiros commented Oct 24, 2023

reviewing

@joekaufmanexpensify
Copy link
Contributor

TY!

@joekaufmanexpensify
Copy link
Contributor

@0xmiroslav any of these proposals work?

@joekaufmanexpensify
Copy link
Contributor

Still pending input on proposals

@0xmiros
Copy link
Contributor

0xmiros commented Oct 27, 2023

I will provide feedback by Monday

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Nov 7, 2023
Copy link

melvin-bot bot commented Nov 12, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@joekaufmanexpensify
Copy link
Contributor

@0xmiroslav I saw your comment on the other issue. That means the PR in this issue is blocked on #31192, is that right?

@0xmiros
Copy link
Contributor

0xmiros commented Nov 13, 2023

@0xmiroslav I saw your comment on the other issue. That means the PR in this issue is blocked on #31192, is that right?

yes but likely unblocked today again as linked issue is deploy blocker and that offending PR is being reverted

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 15, 2023
@melvin-bot melvin-bot bot changed the title [$500] New room - Workspace selector doesn't highlight when selected [HOLD for payment 2023-11-22] [$500] New room - Workspace selector doesn't highlight when selected Nov 15, 2023
Copy link

melvin-bot bot commented Nov 15, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 15, 2023
Copy link

melvin-bot bot commented Nov 15, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.99-0 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 2023-11-22. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

Copy link

melvin-bot bot commented Nov 15, 2023

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:

  • [@0xmiroslav] The PR that introduced the bug has been identified. Link to the PR: Allow Welcome Message on Room Creation #29541
  • [@0xmiroslav] 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: Allow Welcome Message on Room Creation #29541 (comment)
  • [@0xmiroslav] 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
  • [@0xmiroslav] Determine if we should create a regression test for this bug.
  • [@0xmiroslav] 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.
  • [@joekaufmanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: N/A

@joekaufmanexpensify
Copy link
Contributor

@0xmiroslav could you please complete your portion of the BZ checklist?

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Nov 22, 2023
Copy link

melvin-bot bot commented Nov 27, 2023

@dangrous, @namhihi237, @joekaufmanexpensify, @0xmiroslav Eep! 4 days overdue now. Issues have feelings too...

@0xmiros
Copy link
Contributor

0xmiros commented Nov 27, 2023

  • The PR that introduced the bug has been identified. Link to the PR: Allow Welcome Message on Room Creation #29541
  • 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: Allow Welcome Message on Room Creation #29541 (comment)
  • 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 This should have been caught earlier during PR review.
  • Determine if we should create a regression test for this bug. I don't suggest regression test as this is minor visual bug.
  • 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.

@melvin-bot melvin-bot bot removed the Overdue label Nov 27, 2023
@joekaufmanexpensify
Copy link
Contributor

BZ checklist is done. All set to issue payment!

@joekaufmanexpensify
Copy link
Contributor

We need to issue the following payments:

  • @namhihi237 - $500 for PR. Paid via Upwork.
  • @namhihi237 - $50 for reporting. Paid via Upwork.
  • @0xmiroslav -$500 for C+ review.

@joekaufmanexpensify
Copy link
Contributor

@0xmiroslav looks like an offer was made automatically to an upwork account. But it doesn't look like the correct one. I saw on a previous issue you were tracking payment on your end, so I didn't make any payment to you in the issue. Is that still the case?

@joekaufmanexpensify
Copy link
Contributor

@namhihi237 $500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

@namhihi237 $50 sent and contract ended!

@0xmiros
Copy link
Contributor

0xmiros commented Nov 27, 2023

yes, let's close this if other payments are done. Thanks

@joekaufmanexpensify
Copy link
Contributor

Sounds good! There was an automatic offer sent to an upwork account for a Volodymyr for C+ review. Going to end that contract without payment for now.

@joekaufmanexpensify
Copy link
Contributor

Closing as this is all set. Thanks everyone!

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

7 participants