Skip to content

[HOLD for payment 2024-12-25] [$250] iOS Search - Filter icon is not responsive when navigating to Search via WS chat in WS settings #53600

Closed

Description

@vincdargento

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: 9.0.71-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): applausetester+kh1311020@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Launch ND or hybrid app.
  2. Go to workspace settings.
  3. Tap on the workspace chat under "Submit expenses using your workspace chat below"
  4. Tap on the search icon on the top right.
  5. Type anything and search it.
  6. On Search page, tap on the filter icon.

Expected Result:

Filter options will open.

Actual Result:

Filter icon is not responsive.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021864902077815200576
  • Upwork Job ID: 1864902077815200576
  • Last Price Increase: 2024-12-06
  • Automatic offers:
    • rayane-djouah | Reviewer | 105267754
Issue OwnerCurrent Issue Owner: @kadiealexander

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 4, 2024
  2. melvin-bot commented on Dec 4, 2024

    @melvin-bot

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

  3. daledah commented on Dec 5, 2024

    @daledah
    Contributor

    Proposal

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

    Filter icon is not responsive.

    What is the root cause of that problem?

    We are using normal navigate here

    onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(currentUserPolicyExpenseChat?.reportID ?? '-1'))}

    Search page is open on top of workspaceInitiaPage so canAccessRoute is incorrectly computed

    // We are checking if the user can access the route.
    // If user can't access the route, we are dismissing any modals that are open when the NotFound view is shown
    const canAccessRoute = activeRoute && menuItems.some((item) => item.routeName === activeRoute);

    And we get dismiss all RHP modal in this useEffect

    // We are dismissing any modals that are open when the NotFound view is shown
    Navigation.isNavigationReady().then(() => {
    Navigation.closeRHPFlow();
    });

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

    When workspace init is the only route in the navigator state. We can use navigate with a type of 'UP'

        onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(currentUserPolicyExpenseChat?.reportID ?? '-1'), 'UP')}
    

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

    NA

    What alternative solutions did you explore? (Optional)

    We can use function closeAndNavigate here

    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.

  4. saifelance commented on Dec 5, 2024

    @saifelance

    Proposal

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

    The issue involves [specific problem, e.g., "inconsistent form behavior causing incorrect submissions"], affecting [impact, e.g., "data reliability and user experience"].

    What is the root cause of that problem?

    Triggered by [root cause, e.g., "a race condition in asynchronous state management"].

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

    1. Refactor state management to handle async operations correctly.
    2. Add validation checks at client/server levels.
    3. Enhance error handling for better feedback and logging.
    4. Update outdated dependencies.

    Suggested Fix for the Filter Icon Handler

    function onFilterIconPress() {
        if (isExecuting) {
            return; // Prevent multiple executions.
        }
    
        singleExecution(() => {
            // Logic to show filter options
            Navigation.navigate(ROUTES.SEARCH_FILTER); // Adjust as per your route setup.
        })();
    }
    

    Add Accessibility and Clickability Checks

    <TouchableOpacity
        onPress={onFilterIconPress}
        accessible={true}
        accessibilityLabel={translate('search.filter')}
        style={styles.filterIconContainer}
    >
        <Expensicons.Filter />
    </TouchableOpacity>
    

    What alternative solutions did you explore? (Optional)

    1. Rewrite module (time-intensive).
    2. Adopt a new state library (steep learning curve).
    3. Implementing targeted fixes and robust tests will resolve the issue and prevent recurrence.
  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 6, 2024
  6. changed the title [-]iOS Search - Filter icon is not responsive when navigating to Search via WS chat in WS settings[/-] [+][$250] iOS Search - Filter icon is not responsive when navigating to Search via WS chat in WS settings[/+] on Dec 6, 2024
  7. melvin-bot commented on Dec 6, 2024

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 6, 2024
  9. melvin-bot commented on Dec 6, 2024

    @melvin-bot

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

  10. bernhardoj commented on Dec 6, 2024

    @bernhardoj
    Contributor

    Proposal

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

    The filter button is "unresponsive"

    What is the root cause of that problem?

    In WorkspaceInitialPage, we check to see if the active route of the sub-page of the workspace settings page is accessible.

    // We are checking if the user can access the route.
    // If user can't access the route, we are dismissing any modals that are open when the NotFound view is shown
    const canAccessRoute = activeRoute && menuItems.some((item) => item.routeName === activeRoute);
    useEffect(() => {
    if (!shouldShowNotFoundPage && canAccessRoute) {
    return;
    }
    if (wasRendered.current) {
    return;
    }
    wasRendered.current = true;
    // We are dismissing any modals that are open when the NotFound view is shown
    Navigation.isNavigationReady().then(() => {
    Navigation.closeRHPFlow();
    });
    }, [canAccessRoute, shouldShowNotFoundPage]);

    If not, then we dismiss any RHP. For example, if the user opens a workspace as a member and tries to open the workspace categories setting, then the categories setting RHP will be dismissed and the not found page will show from the workspace categories list page.

    In our case, we open the workspace's initial page. The active route becomes Workspace_Initial. However, the current canAccessRoute logic only checks for the sub-page route. So, when it compares the active route with itself, it fails because menuItems doesn't contain Workspace_Initial.

    We actually have the logic to run it only once.

    if (wasRendered.current) {
    return;
    }
    wasRendered.current = true;

    But when we open the search page, all routes are "hidden".

    // On narrow layout, if we are on /search route we want to hide all central pane routes and show only the bottom tab navigator.
    if (lastSearchCentralPane) {
    const filteredRoute = filteredRoutes.at(0);
    if (filteredRoute) {
    return {
    stateToRender: {
    ...state,
    index: 0,
    routes: [filteredRoute],
    },
    searchRoute: lastSearchCentralPane,
    };
    }
    }

    So, the wasRendered logic in WorkspaceInitialPage won't work. And when we try to open the filter page, the previously "hidden" routes are added again to the stack and canAccessRoute becomes false which dismiss any RHP.

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

    We can update canAccessRoute to cover the case of the workspace's initial page itself.

    const canAccessRoute = activeRoute && (menuItems.some((item) => item.routeName === activeRoute) || activeRoute === SCREENS.WORKSPACE.INITIAL);
    

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

    N/A

  11. ikevin127 commented on Dec 7, 2024

    @ikevin127
    Contributor

    Proposal

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

    Filter icon is not responsive when navigating to Search via WS chat in WS settings.

    What is the root cause of that problem?

    Note

    This issue is only present on narrow layout devices (native / mWeb) where screens displayed in RHP act as a modal.

    // We are checking if the user can access the route.
    // If user can't access the route, we are dismissing any modals that are open when the NotFound view is shown
    const canAccessRoute = activeRoute && menuItems.some((item) => item.routeName === activeRoute);
    useEffect(() => {
    if (!shouldShowNotFoundPage && canAccessRoute) {
    return;
    }
    if (wasRendered.current) {
    return;
    }
    wasRendered.current = true;
    // We are dismissing any modals that are open when the NotFound view is shown
    Navigation.isNavigationReady().then(() => {
    Navigation.closeRHPFlow();
    });
    }, [canAccessRoute, shouldShowNotFoundPage]);

    When we open the workspace's initial page, the active route becomes Workspace_Initial. However, the current canAccessRoute logic only checks for the sub-page route - therefore when it compares the active route with itself, it fails because menuItems doesn't contain Workspace_Initial.

    We actually have the logic to only run it once here, but when we open the search page, all routes are "hidden" as explained here. Because of this, the wasRendered logic in WorkspaceInitialPage won't work as expected -> when we try to open the filter page, the previously "hidden" routes are added back to the stack and canAccessRoute becomes false which will dismiss any RHP that we try to open (Filters).

    Credits to bernhardoj for the RCA.

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

    We had a similar issue which I reviewed recently here where we navigated away from WorkspaceProfileSharePage to a report without dismissing the currently opened modal which caused a weird UI bug in the QR Code because the same modal would be opened twice.

    A practical solution for this kind of issue which wouldn't break any other functionality is to simply replace the way we navigate away from WS to the report here:

    onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(currentUserPolicyExpenseChat?.reportID ?? '-1'))}

    to use Navigation.dismissModal instead:

    onPress={() => Navigation.dismissModal(currentUserPolicyExpenseChat?.reportID ?? '-1')}

    Why dismissing the modal first fixes our issue ?
    Because as explained in RCA, on narrow layout devices (native / mWeb) screens displayed in RHP act as a modal and by dismissing it when navigating to the report, all the conditions which lead to the Filters RHP to being able to open when clicked on in our case, will now work as expected.

    Result video (before / after)

    iOS: Native
    Before After
    before.mov
    after.mov
  12. ikevin127 commented on Dec 7, 2024

    @ikevin127
    Contributor

    Important

    I proposed the same solution for this issue and because this solution would fix both issues, if my solution is selected on any of the two issues -> we should put the other one on HOLD.

    cc @rayane-djouah

  13. 17 remaining items

  14. changed the title [-][$250] iOS Search - Filter icon is not responsive when navigating to Search via WS chat in WS settings[/-] [+][HOLD for payment 2024-12-25] [$250] iOS Search - Filter icon is not responsive when navigating to Search via WS chat in WS settings[/+] on Dec 18, 2024
  15. melvin-bot commented on Dec 18, 2024

    @melvin-bot

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

  16. melvin-bot commented on Dec 18, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.76-12 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-12-25. 🎊

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

  17. melvin-bot commented on Dec 18, 2024

    @melvin-bot

    @rayane-djouah @kadiealexander @rayane-djouah 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]

  18. rayane-d commented on Dec 26, 2024

    @rayane-d
    Contributor

    BugZero Checklist:

    • 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
      • 2b. Reported on staging (deploy blocker)
      • 2c. Reported on a PR
      • 2z. Other:

      Who reported the bug:

      • 3a. Expensify user
      • 3b. Expensify employee
      • 3c. Contributor
      • 3d. QA
      • 3z. Other:
    • 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/41665/files#r1898131293

    • 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

    • 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.

    • [@kadiealexander] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    #### Precondition:
    
    - N/A
    
    #### Test:
    
    1. Go to Workspace Settings.
    2. Tap the workspace chat under "Submit expenses using your workspace chat below".
    3. Tap the search icon in the top-right corner.
    4. Enter any text and search.
    5. On the Search page, tap the Filters button.
    6. Verify that the Filters button is responsive and the search filters modal is displayed.
    
    

    Do we agree 👍 or 👎

  19. bfitzexpensify commented on Dec 27, 2024

    @bfitzexpensify
    Contributor

    Payment summary:

    @rayane-djouah due $250 for C+ work, paid via Upwork ✅
    @bernhardoj due $250 for contributor work via NewDot manual request

  20. bernhardoj commented on Dec 28, 2024

    @bernhardoj
    Contributor

    Requested in ND.

  21. JmillsExpensify commented on Jan 8, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions