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 #29080] [$500] Chat - The first option in Notifications preference is always highlighted #31087

Closed
2 of 6 tasks
lanitochka17 opened this issue Nov 9, 2023 · 24 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Nov 9, 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.97-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: Applause - Internal Team
Slack conversation:

Issue found when executing PR #30694

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Go to any chat
  3. Click on the chat header
  4. Click Notification preference

Expected Result:

The selected option is highlighted

Actual Result:

The first option is always highlighted
On iOS, the selected option is highlighted. The first option becomes highlighted when returning to app from the background

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

Bug6269367_1699488037719.20231109_075832.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01d8a2b72f459ff260
  • Upwork Job ID: 1722404757021065216
  • Last Price Increase: 2023-11-09
@lanitochka17 lanitochka17 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 Nov 9, 2023
@melvin-bot melvin-bot bot changed the title Chat - The first option in Notifications preference is always highlighted [$500] Chat - The first option in Notifications preference is always highlighted Nov 9, 2023
Copy link

melvin-bot bot commented Nov 9, 2023

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

Copy link

melvin-bot bot commented Nov 9, 2023

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

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

melvin-bot bot commented Nov 9, 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

Copy link

melvin-bot bot commented Nov 9, 2023

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

@abzokhattab
Copy link
Contributor

abzokhattab commented Nov 9, 2023

Related to #29080

@wlegolas
Copy link
Contributor

wlegolas commented Nov 9, 2023

Proposal

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

Chat - The first option in Notifications preference is always highlighted

What is the root cause of that problem?

The problem is related to the BaseSelectionList component, there is an useEffect that resets the focus and scrolls to the first section when there is at least one section in the sections array.

useEffect(() => {
// do not change focus on the first render, as it should focus on the selected item
if (firstLayoutRef.current) {
return;
}
// set the focus on the first item when the sections list is changed
if (sections.length > 0) {
updateAndScrollToFocusedIndex(0);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [sections]);

The code above came through this PR #30438 related to the issue above #29080

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

We should change this useEffect to only resets the focus and scroll to the first section when there is at least one section in the sections array and there are no selected sections.

For example,

function shouldUpdateFocusedSection(sections) {
    const availableSections = lodashGet(sections, '[0].data', []);

    return _.all(availableSections, (section) => !section.isSelected);
}

function BaseSelectionList({
  ...

    useEffect(() => {
        // do not change focus on the first render, as it should focus on the selected item
        if (firstLayoutRef.current) {
            return;
        }

        // set the focus on the first item when the sections list is changed
        if (shouldUpdateFocusedSection(sections)) {
            updateAndScrollToFocusedIndex(0);
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [sections]);

    ...
});

What alternative solutions did you explore? (Optional)

The main branch already has the code with the solution from the issue above #29080, but the problem still occurring.

That's why I created this proposal.

POC

poc-issue-31087.mp4

@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 9, 2023

Proposal

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

The first option in Notifications preference is always highlighted

What is the root cause of that problem?

We change focusedIndex and scroll to the first option whenever the sections are changed. It doesn't make sense because it can be changed when the search value isn't changed.

if (sections.length > 0) {

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

We should only scroll to the first option when both textInputValue and sections are changed.

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Nov 13, 2023
@abdulrahuman5196
Copy link
Contributor

Hi, Will review again today, just back from weekend

@melvin-bot melvin-bot bot removed the Overdue label Nov 13, 2023
@abdulrahuman5196
Copy link
Contributor

Seems there is multiple regressions from #29080 and this could be a regression as well as pointed out by contributors.

@greg-schroeder Could you kindly put this issue on hold for #29080?

@greg-schroeder
Copy link
Contributor

Putting this on hold!

@greg-schroeder greg-schroeder added Weekly KSv2 and removed Daily KSv2 labels Nov 14, 2023
@greg-schroeder greg-schroeder changed the title [$500] Chat - The first option in Notifications preference is always highlighted [Hold for #29080] [$500] Chat - The first option in Notifications preference is always highlighted Nov 14, 2023
@melvin-bot melvin-bot bot added the Overdue label Nov 23, 2023
@greg-schroeder
Copy link
Contributor

Still holding

@melvin-bot melvin-bot bot removed the Overdue label Nov 26, 2023
@melvin-bot melvin-bot bot added the Overdue label Dec 5, 2023
@greg-schroeder
Copy link
Contributor

same

@melvin-bot melvin-bot bot removed the Overdue label Dec 5, 2023
@melvin-bot melvin-bot bot added the Overdue label Dec 14, 2023
@melvin-bot melvin-bot bot removed the Overdue label Dec 31, 2023
@melvin-bot melvin-bot bot added the Overdue label Jan 8, 2024
@greg-schroeder
Copy link
Contributor

""

@melvin-bot melvin-bot bot removed the Overdue label Jan 8, 2024
@melvin-bot melvin-bot bot added the Overdue label Jan 17, 2024
@greg-schroeder greg-schroeder added Monthly KSv2 and removed Weekly KSv2 labels Jan 18, 2024
@greg-schroeder
Copy link
Contributor

Held

@melvin-bot melvin-bot bot removed the Overdue label Jan 18, 2024
@greg-schroeder greg-schroeder added Weekly KSv2 Monthly KSv2 and removed Monthly KSv2 Weekly KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels Jan 26, 2024
@greg-schroeder
Copy link
Contributor

Same

@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2024
@greg-schroeder
Copy link
Contributor

#29080 is still open

@melvin-bot melvin-bot bot removed the Overdue label Feb 6, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 14, 2024
@greg-schroeder
Copy link
Contributor

held

@melvin-bot melvin-bot bot removed the Overdue label Feb 14, 2024
@melvin-bot melvin-bot bot added the Overdue label Feb 23, 2024
@greg-schroeder
Copy link
Contributor

29080 is deployed

@melvin-bot melvin-bot bot removed the Overdue label Feb 27, 2024
@greg-schroeder
Copy link
Contributor

@abdulrahuman5196 what do you think about this issue given that the hold issue is deployed? It's been a while - do we need to retest, or can we proceed?

@abdulrahuman5196
Copy link
Contributor

@greg-schroeder I don't see this issue in staging. I think we can close this issue.

Screen.Recording.2024-02-27.at.1.03.52.PM.mov

@greg-schroeder
Copy link
Contributor

I can't see it either, seems to be resolved. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

6 participants