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 2024-12-25] [$250] iOS Search - Filter icon is not responsive when navigating to Search via WS chat in WS settings #53600

Closed
6 of 8 tasks
vincdargento opened this issue Dec 4, 2024 · 20 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 External Added to denote the issue can be worked on by a contributor

Comments

@vincdargento
Copy link

vincdargento commented Dec 4, 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.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 [email protected]
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
@vincdargento vincdargento added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 4, 2024
Copy link

melvin-bot bot commented Dec 4, 2024

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.

@daledah
Copy link
Contributor

daledah commented Dec 5, 2024

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.

@saifelance
Copy link

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.

@kadiealexander kadiealexander added the External Added to denote the issue can be worked on by a contributor label Dec 6, 2024
@melvin-bot melvin-bot bot 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 Dec 6, 2024
Copy link

melvin-bot bot commented Dec 6, 2024

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

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

melvin-bot bot commented Dec 6, 2024

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 6, 2024

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

@ikevin127
Copy link
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

@ikevin127
Copy link
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

Copy link

melvin-bot bot commented Dec 9, 2024

@kadiealexander, @rayane-djouah Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
@rayane-djouah
Copy link
Contributor

Will review today

@melvin-bot melvin-bot bot removed the Overdue label Dec 9, 2024
@rayane-djouah
Copy link
Contributor

@bernhardoj's proposal looks good to me. It comprehensively explains the root cause and fixes the bug at its root.

🎀👀🎀 C reviewed

Copy link

melvin-bot bot commented Dec 9, 2024

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

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

melvin-bot bot commented Dec 10, 2024

📣 @rayane-djouah 🎉 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

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 10, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @rayane-djouah

@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 18, 2024
@melvin-bot melvin-bot bot 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 Dec 18, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 18, 2024
Copy link

melvin-bot bot commented Dec 18, 2024

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

Copy link

melvin-bot bot commented Dec 18, 2024

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:

Copy link

melvin-bot bot commented Dec 18, 2024

@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]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 25, 2024
@rayane-djouah
Copy link
Contributor

rayane-djouah commented Dec 26, 2024

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 👎

@melvin-bot melvin-bot bot added the Overdue label Dec 27, 2024
@bfitzexpensify bfitzexpensify self-assigned this Dec 27, 2024
@melvin-bot melvin-bot bot removed the Overdue label Dec 27, 2024
@bfitzexpensify
Copy link
Contributor

Payment summary:

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

@bernhardoj
Copy link
Contributor

Requested in ND.

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

No branches or pull requests

9 participants