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 2025-01-02] [$250] when selecting categories, the selected categories get reset if we click outside the checkbox #49322

Open
1 of 6 tasks
m-natarajan opened this issue Sep 17, 2024 · 110 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production 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

@m-natarajan
Copy link

m-natarajan commented Sep 17, 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.36-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: @rushatgabhane
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1725906909191599

Action Performed:

  1. Enable categories on a controlled workspace
  2. Click More features > Categories > Click check box to select all categories
  3. Click on any row to select individual category

Expected Result:

RHP opened for selected category and other category remain selected

Actual Result:

RHP opened for the category and all other categories are reset (Unchecked)

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

Screen.Recording.2024-09-09.at.21.33.31.mov
Recording.530.mp4

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021835867544323146964
  • Upwork Job ID: 1835867544323146964
  • Last Price Increase: 2024-09-17
  • Automatic offers:
    • truph01 | Contributor | 105157836
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @jliexpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 17, 2024
Copy link

melvin-bot bot commented Sep 17, 2024

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

@cretadn22

This comment was marked as off-topic.

@rushatgabhane
Copy link
Member

@jliexpensify could you please assign me. I want to C this because I raised this issue

@jliexpensify jliexpensify added the External Added to denote the issue can be worked on by a contributor label Sep 17, 2024
@melvin-bot melvin-bot bot changed the title when selecting categories, the selected categories get reset if we click outside the checkbox [$250] when selecting categories, the selected categories get reset if we click outside the checkbox Sep 17, 2024
Copy link

melvin-bot bot commented Sep 17, 2024

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

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

melvin-bot bot commented Sep 17, 2024

Current assignee @rushatgabhane is eligible for the External assigner, not assigning anyone new.

@jliexpensify
Copy link
Contributor

Done, I think Design is still weighing in though?

@rushatgabhane

This comment was marked as outdated.

@rushatgabhane
Copy link
Member

I'll post an update on the expected result whenever design team has reached a decision

@rushatgabhane
Copy link
Member

Expected result:

  1. On web, make it like gmail.
    a. You can select by tapping checkbox.
    b. If you tap a row, it’ll open the category.
    c. Tapping a row should not dismiss the selected categories

  2. On mobile, if you’re in selection mode you should be able to tap anywhere to select the row.

(source)

@cretadn22
Copy link
Contributor

@rushatgabhane Please review the PR that introduced this bug. I believe it will provide valuable insights for defining the final expectations.

@truph01
Copy link
Contributor

truph01 commented Sep 17, 2024

Edited by proposal-police: This proposal was edited at 2023-10-07T16:31:35Z.

Proposal

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

RHP opened for the category and all other categories are reset (Unchecked)

What is the root cause of that problem?

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

  1. On web's requirements.

The similar logic should be removed in this, this and this.

  • Then introduce a new hook. With this hook, it will not clear the selected options if user is navigated to RHN. Otherwise, clear the selected options :
import {NavigationContainerRefContext, useIsFocused} from '@react-navigation/native';
import {useContext, useEffect} from 'react';
import NAVIGATORS from '@src/NAVIGATORS';

let shouldCleanupSelectedOptions = false;

const useCleanupSelectedOptions = (setFunction: ({}: any) => void) => {
    const navigationContainerRef = useContext(NavigationContainerRefContext);
    const state = navigationContainerRef?.getState();
    const lastRoute = state.routes.at(-1);
    const isRightModalOpening = lastRoute?.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR;

    const isFocused = useIsFocused();

    useEffect(() => {
        if (isFocused || isRightModalOpening) {
            return;
        }
        shouldCleanupSelectedOptions = false;
        setFunction?.({});
    }, [isFocused, setFunction, isRightModalOpening]);
};

export {useCleanupSelectedOptions};

and just need to use that hook in where we want to clean up its selected option once we visit other pages, such as: In WorkspaceCategoriesPage, we use useCleanupSelectedOptions(setSelectedCategories), in WorkspaceTagsPage we use useCleanupSelectedOptions(setSelectedTags).

  1. On mobile's requirements:
  • Update this logic:

const navigateToCategorySettings = (category: PolicyOption) => {

so that it will call toggleCategory(category) if isSmallScreenWidth && selectionMode?.isEnabled is true:

    const navigateToCategorySettings = (category: PolicyOption) => {
        if (isSmallScreenWidth && selectionMode?.isEnabled) {
            toggleCategory(category);
            return;
        }

What alternative solutions did you explore? (Optional)

  1. On web's requirements.

I suggest removing that logic, as it was originally added to address an issue where: if you selected options on screen A, navigated to screen B, and returned to A, the selected options were not cleared. However, I believe this is standard behavior in terms of the navigation stack: when you select options on screen A, navigate to B, and then return to A, A's state should naturally be preserved.

@ChavdaSachin
Copy link
Contributor

Results for above proposal

Screen.Recording.2024-09-17.at.10.08.17.AM.mov
Screen.Recording.2024-09-17.at.10.10.38.AM.mov

@truph01
Copy link
Contributor

truph01 commented Sep 17, 2024

Updated proposal to remove redundant code changes and add an explanation.

@rushatgabhane
Copy link
Member

rushatgabhane commented Sep 17, 2024

Let's go forward with @truph01's proposal. it addresses all requirements

C reviewed 🎀 👀 🎀

Copy link

melvin-bot bot commented Sep 17, 2024

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

@ChavdaSachin
Copy link
Contributor

@rushatgabhane just a note @truph01's solution do not clear categories even for other cases like switching to tags page and come back, so it does not align with the expectations.
Just to be more precise on expectations

  1. selections should not clear after taping raw
  2. selection should be cleared upon visiting other pages like Tags, Workflow, etc... and coming back
  • this is what I concluded from expectations posted by you.

@rushatgabhane
Copy link
Member

sorry i didn't know that we should remove selected categories if we navigate away

@rushatgabhane
Copy link
Member

rushatgabhane commented Sep 17, 2024

@ChavdaSachin for mobile, we want the categories to select if you tap anywhere on the row when in selection mode.
please update your proposal

@ChavdaSachin
Copy link
Contributor

give me a minute

@ChavdaSachin

This comment was marked as outdated.

Copy link
Contributor

spb Your proposal will be dismissed because you did not follow the proposal template.

@ChavdaSachin

This comment was marked as outdated.

@jliexpensify jliexpensify added the External Added to denote the issue can be worked on by a contributor label Dec 2, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 2, 2024
@jliexpensify
Copy link
Contributor

jliexpensify commented Dec 2, 2024

Thanks Monil - so here's a tentative Payment Summary

NEW UPWORKS JOB

Copy link

melvin-bot bot commented Dec 2, 2024

Current assignee @rushatgabhane is eligible for the External assigner, not assigning anyone new.

@jliexpensify jliexpensify removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 2, 2024
@jliexpensify
Copy link
Contributor

Damn, I thought that would auto-create a new job (the old one is expired). Will manually create one then.

@jliexpensify
Copy link
Contributor

@truph01 what's your Upworks profile? Could you add it (or your name) to your GH profile? Thanks.

@truph01
Copy link
Contributor

truph01 commented Dec 3, 2024

@jliexpensify I accepted this automatic offer. Correct amount ($200) could be paid out on that offer later.

@truph01 what's your Upworks profile? Could you add it (or your name) to your GH profile? Thanks.

Sure, I added my profile link to GH profile.

@jliexpensify
Copy link
Contributor

@truph01 thanks! Upworks does this annoying thing where after a month, it closes jobs and we can't pay out on them. So I had to create a new job and hire you.

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

truph01 commented Dec 6, 2024

PR is ready @rushatgabhane

@jliexpensify
Copy link
Contributor

I'm OOO until the 29th, feel free to reassign if payment is required before then - otherwise will handle when I get back.

@truph01
Copy link
Contributor

truph01 commented Dec 23, 2024

@MonilBhavsar Do we want to address the issue "If we preserve selections and delete category from categorySettingsPage, selection counter on header would not update"? I've had a solution for it.

Copy link

melvin-bot bot commented Dec 24, 2024

⚠️ 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.

Copy link

melvin-bot bot commented Dec 24, 2024

⚠️ 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.

Copy link

melvin-bot bot commented Dec 24, 2024

⚠️ 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.

@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 26, 2024
@melvin-bot melvin-bot bot changed the title [$250] when selecting categories, the selected categories get reset if we click outside the checkbox [HOLD for payment 2025-01-02] [$250] when selecting categories, the selected categories get reset if we click outside the checkbox Dec 26, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 26, 2024
Copy link

melvin-bot bot commented Dec 26, 2024

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

Copy link

melvin-bot bot commented Dec 26, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.78-6 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 2025-01-02. 🎊

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

Copy link

melvin-bot bot commented Dec 26, 2024

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

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Product (CRITICAL)
Development

No branches or pull requests

8 participants