Skip to content

[HOLD for payment 2023-09-20] Web - Profile - Pronouns Displayed Without Performing Search #26074

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

1, Settings > profile > pronouns section, pronouns are displayed without the need for performing a search.

Expected Result:

Pronouns should only be displayed when something is entered in the search bar.

Actual Result:

Pronouns are displayed without any search being performed.

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.57.5
Reproducible in staging?: y
Reproducible in production?: n
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
Notes/Photos/Videos: Any additional supporting documentation

dekusak.mp4
Recording.4053.mp4

Expensify/Expensify Issue URL:
Issue reported by: @tewodrosGirmaA
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693205523216819

View all open jobs on GitHub

Activity

  1. OSBotify commented on Aug 28, 2023

    @OSBotify
    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.
  2. melvin-bot commented on Aug 28, 2023

    @melvin-bot

    Triggered auto assignment to @amyevans (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

  3. Nikhil-Vats commented on Aug 28, 2023

    @Nikhil-Vats
    Contributor

    Proposal

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

    Profile - Pronouns Displayed Without Performing Search

    What is the root cause of that problem?

    In this PR, the logic to hide pronouns when search value is empty was removed.

    const filteredPronounsList = _.filter(pronounsList, (pronous) => pronous.text.toLowerCase().indexOf(searchValue.trim().toLowerCase()) >= 0);

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

    We need to use the following code for filteredPronounsList using useMemo (this was the code before that PR)

    const filteredPronounsList = React.useMemo(() => {
        const searchedValue = searchValue.trim();
        if (searchedValue.length === 0) {
            return [];
        }
        return _.filter(pronounsList, (pronous) => pronous.text.toLowerCase().indexOf(searchedValue.toLowerCase()) >= 0);
    }, [pronounsList, searchValue]);

    What alternative solutions did you explore? (Optional)

    NA

    Screen.Recording.2023-08-28.at.5.48.55.PM.mov
  4. dummy-1111 commented on Aug 28, 2023

    @dummy-1111
    Contributor

    This issue was from this PR

  5. Nikhil-Vats commented on Aug 28, 2023

    @Nikhil-Vats
    Contributor

    Yes, sorry I linked the wrong PR. Thanks @s-alves10 . Fixed now.

  6. thiagobrez commented on Aug 28, 2023

    @thiagobrez
    Contributor

    Just FYI, rolling back to memo will break the highlight, because the sections will start empty and the list won't be able to determine which is the initially focused index

  7. Pujan92 commented on Aug 28, 2023

    @Pujan92
    Contributor

    Proposal

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

    Pronouns displayed without search value

    What is the root cause of that problem?

    Regression from #25921 as for empty search string indexOf will return 0 for all items and show the filtered pronouns list.

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

    We can revert the useMemo part for the filteredPronounsList.

    This will lead to missing highlight due to initiallyFocusedOptionKey passed as empty bcoz pronounsList gets filled but setSearchValue depends on the initiallyFocusedOption which will be called later(by that time filteredPronounsList remains empty and we renders the SelectionList component). So I think we can move the setSearchValue(initiallyFocusedOption.text); here with the setInitiallyFocusedOption and remove that useEffect. With that, it will set the searchValue if isCurrentPronouns is available before setting the pronounsList which will work correctly for the filteredPronounsList.

    useEffect(() => {
    setSearchValue(initiallyFocusedOption.text);
    }, [initiallyFocusedOption]);

    setInitiallyFocusedOption({
    text: value,
    keyForList: key,
    });

    setInitiallyFocusedOption({
        text: value,
        keyForList: key,
    });
    setSearchValue(value);
    
    Screen.Recording.2023-08-28.at.19.20.44.mov

    What alternative solutions did you explore? (Optional)

    We can add useEffect in the selection list component to refocus the item if initiallyFocusedOptionKey gets changed.

    const [focusedIndex, setFocusedIndex] = useState(() => _.findIndex(flattenedSections.allOptions, (option) => option.keyForList === initiallyFocusedOptionKey));

        useEffect(() => {
            setFocusedIndex(initiallyFocusedOptionKey)
        }, [initiallyFocusedOptionKey])
    
  8. BhuvaneshPatil commented on Aug 28, 2023

    @BhuvaneshPatil
    Contributor

    Proposal

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

    Pronouns displayed without search value

    What is the root cause of that problem?

    This was caused by this PR - #25921

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

    We shall change the logic for generating filteredPronounsList here -

    const filteredPronounsList = _.filter(pronounsList, (pronous) => pronous.text.toLowerCase().indexOf(searchValue.trim().toLowerCase()) >= 0);

    We can just change it to -

    const filteredPronounsList = _.filter(pronounsList, (pronous) => searchValue.trim() && pronous.text.toLowerCase().indexOf(searchValue.trim().toLowerCase()) >= 0);

    Above we are also adding one more check - searchValue.trim() ( we can improve this like checking length, or some function from underscore, ex - _.isEmpty()), but to summarise we can have this check and it will only display list in case of search value is non empty.

    As this function is not costly, we can avoid adding useMemo and un-necessary dependency.

    Screen.Recording.2023-08-28.at.8.04.31.PM.mov

    What alternative solutions did you explore? (Optional)

  9. 15 remaining items

  10. melvin-bot commented on Sep 13, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.68-17 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-09-20. 🎊

    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:

    As a reminder, here are the bonuses/penalties that should be applied for any External issue:

    • Merged PR within 3 business days of assignment - 50% bonus
    • Merged PR more than 9 business days after assignment - 50% penalty
  11. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 22, 2023
  12. melvin-bot commented on Sep 22, 2023

    @melvin-bot

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

  13. melvin-bot commented on Sep 22, 2023

    @melvin-bot

    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
  14. amyevans commented on Sep 22, 2023

    @amyevans
    Contributor

    Hey @maddylewis, this is all set to close except for payout. Can you help pay @tewodrosGirmaA the reporting bonus please?

  15. maddylewis commented on Sep 22, 2023

    @maddylewis
    Contributor

    offer sent to @tewodrosGirmaA

  16. tewodrosGirmaA commented on Sep 22, 2023

    @tewodrosGirmaA

    offer sent to @tewodrosGirmaA
    I accept it ,Thank you

  17. maddylewis commented on Sep 22, 2023

    @maddylewis
    Contributor

    paid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions