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

[Pay meow][$250] "you haven't created any categories" appear for a moment when opening categories in workspace settings #44224

Closed
1 of 6 tasks
m-natarajan opened this issue Jun 23, 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

@m-natarajan
Copy link

m-natarajan commented Jun 23, 2024

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.1-0
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: @ZhenjaHorbach
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1718993745779499

Action Performed:

  1. Open App (It's better to open app with an account that we haven’t used for a long time to be sure that we don't have cache )
  2. Tap Account settings -> Workspaces
  3. Choose any collect workspace
  4. Tap Categories

Expected Result:

List of categories appear

Actual Result:

after opening the workspace categories, an empty state (You haven't created any categories) is displayed instead of a loading state

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

2024-06-21.20.28.20.mov
Recording.238.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ad610832f3c79921
  • Upwork Job ID: 1805471883229818637
  • Last Price Increase: 2024-06-25
  • Automatic offers:
    • rayane-djouah | Reviewer | 102866325
    • ZhenjaHorbach | Contributor | 102866327
    • dominictb | Contributor | 102961804
Issue OwnerCurrent Issue Owner: @VictoriaExpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 23, 2024
Copy link

melvin-bot bot commented Jun 23, 2024

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

@ZhenjaHorbach
Copy link
Contributor

I reported this issue
If necessary, I can help in reviewing proposals

@dominictb
Copy link
Contributor

Proposal

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

after opening the workspace categories, an empty state (You haven't created any categories) is displayed instead of a loading state

What is the root cause of that problem?

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

    const isLoading = !isOffline && (policyCategories === null || policyCategories === undefined);

What alternative solutions did you explore? (Optional)

    const shouldShowEmptyState =  policyCategories !== undefined &&  !categoryList.some((category) => category.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) && !isLoading;

or

    const isLoading = !isOffline && (policyCategories === null || isLoadingCategories);

@devguest07
Copy link
Contributor

Proposal

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

"you haven't created any categories" appear for a moment when opening categories in workspace settings

What is the root cause of that problem?

From an old account or one without cached data, sometimes we open the category page and the data is not loaded yet.

const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyId}`);

This leads to a wrong value on isLoading.

const isLoading = !isOffline && policyCategories === null;

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

As per the code pattern in the app, we need to use the same approach used in other components.

  1. We need to use isLoadingOnyxValue for the loading state from Onyx.

As we do in other components, it's better to use isLoadingOnyxValue to get the loading state from Onyx.

- const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyId}`);
+ const [policyCategories, policyCategoriesResult] =  useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyId}`);
+ const  isLoadingPolicyCategories  =  isLoadingOnyxValue(policyCategoriesResult);

+ const  isLoading  =  !isOffline  &&  isLoadingPolicyCategories;
  1. We can also enhance the shouldShowEmptyState by using the same solution the team uses, as shown here: https://github.com/Expensify/App/pull/43921/files using isEmptyObject.

const shouldShowEmptyState = !categoryList.some((category) => category.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) && !isLoading;

- const  shouldShowEmptyState  =  !categoryList.some((category) =>  category.pendingAction  !==  CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) &&  !isLoading;
+ const  shouldShowEmptyState  = isEmptyObject(policyCategories) || !categoryList.some((category) =>  category.pendingAction  !==  CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) &&  !isLoading;

What alternative solutions did you explore?

@VictoriaExpensify VictoriaExpensify added the External Added to denote the issue can be worked on by a contributor label Jun 25, 2024
Copy link

melvin-bot bot commented Jun 25, 2024

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

@melvin-bot melvin-bot bot changed the title "you haven't created any categories" appear for a moment when opening categories in workspace settings [$250] "you haven't created any categories" appear for a moment when opening categories in workspace settings Jun 25, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 25, 2024
Copy link

melvin-bot bot commented Jun 25, 2024

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

@VictoriaExpensify
Copy link
Contributor

I was able to recreate this, agree it's not great but it is a pretty low priority.

@ZhenjaHorbach
Copy link
Contributor

@VictoriaExpensify, can I be C+ here since I reported this issue and already have context ?

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

melvin-bot bot commented Jun 25, 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

Copy link

melvin-bot bot commented Jun 25, 2024

📣 @ZhenjaHorbach 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@ZhenjaHorbach
Copy link
Contributor

@rayane-djouah
Do you mind if I check the proposals ?

@melvin-bot melvin-bot bot added the Overdue label Jun 27, 2024
@rayane-djouah
Copy link
Contributor

No problem, please go ahead ☺️

@melvin-bot melvin-bot bot removed the Overdue label Jun 27, 2024
@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Jun 28, 2024

@dominictb @devguest07
Thank you both for your proposals!

@devguest07
Your proposal makes sense, but the problem is that policyCategoriesResult always returns status: 'loaded'. Therefore, technically, nothing will change.

@dominictb
Your proposal makes more sense. In fact, we have a slightly incorrect condition for displaying the loader:

const isLoading = !isOffline && policyCategories === null;

However, your proposal is a bit redundant but it's correct. We just need to check if policyCategories is undefined without checking for null, as we do in many other places:

const isLoading = !isOffline && policyTags === undefined;

const isLoading = !isOffline && taxesList === undefined;

const isLoading = !isOffline && policyCategories === undefined;

But anyway
This proposal is enough for me

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jun 28, 2024

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

Copy link

melvin-bot bot commented Jul 2, 2024

📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jul 3, 2024
@ZhenjaHorbach
Copy link
Contributor

Changes from PR are already in production
7 day holding period for regressions will end on July 22

Снимок экрана 2024-07-17 в 11 24 52

@ZhenjaHorbach
Copy link
Contributor

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@ZhenjaHorbach] The PR that introduced the bug has been identified. Link to the PR:

#41344

  • [@ZhenjaHorbach] 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:

#41344 (comment)

  • [@ZhenjaHorbach] A discussion in #expensify-bugs 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:

NA

  • [@ZhenjaHorbach] Determine if we should create a regression test for this bug.

This is a minor issue
Plus the loader display logic is exactly the same as in other places
So I'm not sure if regression tests are needed for this

  • [@ZhenjaHorbach] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

@ZhenjaHorbach
Copy link
Contributor

@VictoriaExpensify
Could you please make a payment for this issue? 😃

@ZhenjaHorbach
Copy link
Contributor

@VictoriaExpensify
Friendly bump !

@mallenexpensify mallenexpensify added Daily KSv2 and removed Reviewing Has a PR in review Weekly KSv2 labels Aug 12, 2024
@mallenexpensify mallenexpensify added the Awaiting Payment Auto-added when associated PR is deployed to production label Aug 12, 2024
@mallenexpensify mallenexpensify changed the title [$250] "you haven't created any categories" appear for a moment when opening categories in workspace settings [Pay meow][$250] "you haven't created any categories" appear for a moment when opening categories in workspace settings Aug 12, 2024
@VictoriaExpensify
Copy link
Contributor

So sorry for the delay here! Automation didn't work and I hadn't been made the owner, so I missed it. Everything's paid up now:

Payment Summary

Thanks for your work, everyone!

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
No open projects
Status: Done
Development

No branches or pull requests

8 participants