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

[Payment due 08-23][$250] Expensify card - Expensify card page content is reloaded upon navigating back #48172

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 28, 2024 · 32 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

@lanitochka17
Copy link

lanitochka17 commented Aug 28, 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.25-4
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #47844

Action Performed:

  1. Log in with an expensifail account
  2. Create a workspace
  3. Navigate to Workspace settings - More features
  4. Enable "Expensify Card"
  5. Navigate to Workspace settings - Expensify Card
  6. Click on the "Issue new card" button
  7. Click on the "<" button next to "Choose bank account"

Expected Result:

It shouldn't reload

Actual Result:

Expensify card page content is reloaded upon navigating back. On mWeb, it only reloads if you background the app and open it again

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

Add any screenshot/video evidence

Bug6584394_1724779750139.bandicam_2024-08-27_19-23-53-146.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c51dda0396acf8a0
  • Upwork Job ID: 1828835425848218614
  • Last Price Increase: 2024-09-04
Issue OwnerCurrent Issue Owner: @Christinadobrzyn
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

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

@lanitochka17
Copy link
Author

@Christinadobrzyn FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-collect - Release 2

@bernhardoj
Copy link
Contributor

Proposal

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

Expensify card page reloads every time the page gets refocused.

What is the root cause of that problem?

We have a useFocusEffect to fetch the card data.

const fetchExpensifyCards = useCallback(() => {
Policy.openPolicyExpensifyCardsPage(policyID, workspaceAccountID);
}, [policyID, workspaceAccountID]);
const {isOffline} = useNetwork({onReconnect: fetchExpensifyCards});
useFocusEffect(fetchExpensifyCards);

This is a common pattern within the workspace page, for example, in categories.

useFocusEffect(
useCallback(() => {
fetchCategories();
}, [fetchCategories]),
);

The refetch will set the cardSettings.isLoading to true and based on the condition below, it will show the loading indicator (the cardSettings object only contains isLoading at this point).

{isLoading && (
<ActivityIndicator
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
style={styles.flex1}
color={theme.spinner}
/>
)}

const isLoading = !isOffline && (!cardSettings || (cardSettings.isLoading && Object.keys(cardSettings).length === 1));

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

If we don't want to show the loading every time we refetch the data, we can change the condition to check whether the data exists or not.

const isLoading = !isOffline && (!cardSettings || !cardsList);

@cretadn22
Copy link
Contributor

Proposal

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

Expensify card page reloads every time the page gets refocused.

What is the root cause of that problem?

useFocusEffect(fetchExpensifyCards);

We fetch data every time the screen is focused. When we call the OpenPolicyExpensifyCardsPage API, we set cardSetting.isLoading to true in optimisticData. This causes the page to display a loading indicator each time it is re-focused.

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

The cardSettings condition is unnecessary because it always contains the isLoading field and is always truthy. We only need to ensure that cardsList is available before displaying it. If there are no cards, the backend returns cardSetting as undefined, so we don't need to include cardSetting in the condition for displaying the offline indicator. cardSetting

const isLoading = !isOffline && (!cardSettings || (cardSettings.isLoading && Object.keys(cardSettings).length === 1));

const isLoading = !isOffline && !cardsList;

We should remove the isLoading field from cardSettings by eliminating the optimistic data, success data, and failure data in the openPolicyExpensifyCardsPage API.

What alternative solutions did you explore? (Optional)

@Christinadobrzyn Christinadobrzyn added the External Added to denote the issue can be worked on by a contributor label Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

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

@melvin-bot melvin-bot bot changed the title Expensify card - Expensify card page content is reloaded upon navigating back [$250] Expensify card - Expensify card page content is reloaded upon navigating back Aug 28, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

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

@Christinadobrzyn
Copy link
Contributor

This is pretty minor, I don't know if we need to do this. @aimane-chnaif what do you think?

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Aug 29, 2024

This is pretty minor, I don't know if we need to do this. @aimane-chnaif what do you think?

Agree but I think we can polish this for better user experience. I will leave the decision to assigned engineer.
🎀👀🎀

Copy link

melvin-bot bot commented Aug 29, 2024

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

Copy link

melvin-bot bot commented Sep 2, 2024

@deetergp, @Christinadobrzyn, @aimane-chnaif 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 Sep 2, 2024
@Christinadobrzyn Christinadobrzyn removed the Bug Something is broken. Auto assigns a BugZero manager. label Sep 3, 2024
@Christinadobrzyn Christinadobrzyn removed their assignment Sep 3, 2024
@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@Christinadobrzyn Christinadobrzyn added Overdue Bug Something is broken. Auto assigns a BugZero manager. labels Sep 3, 2024
Copy link

melvin-bot bot commented Sep 3, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@Christinadobrzyn Christinadobrzyn self-assigned this Sep 3, 2024
@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Sep 3, 2024

I'm going to be ooo 9/4-9/10. @strepanier03 we are discussing if this needs to be fixed or if it should just be closed.

@deetergp, can you check this issue out and let us know if you think we should fix it or close the issue. TY!

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Sep 16, 2024

PR in production today so setting payment due date.

I think payment will be

Payouts due:

Will you both remind me if you're paid in Upwork or NewDot (sorry I always ask).

@Christinadobrzyn Christinadobrzyn changed the title [$250] Expensify card - Expensify card page content is reloaded upon navigating back [Payment due 08-23][$250] Expensify card - Expensify card page content is reloaded upon navigating back Sep 16, 2024
@Christinadobrzyn Christinadobrzyn added the Awaiting Payment Auto-added when associated PR is deployed to production label Sep 16, 2024
@strepanier03 strepanier03 removed their assignment Sep 17, 2024
@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 23, 2024
@Christinadobrzyn
Copy link
Contributor

Payment day- payment summary is here - #48172 (comment)

Do we need a regression test?

@aimane-chnaif
Copy link
Contributor

upwork for me, newDot for @bernhardoj

@aimane-chnaif
Copy link
Contributor

Regression Test

  1. Create a workspace
  2. Navigate to Workspace settings - More features
  3. Enable "Expensify Card"
  4. Navigate to Workspace settings - Expensify Card
  5. Click on the "Issue new card" button
  6. Click on the "<" button next to "Choose bank account" title
  7. Verify that card page content doesn't reload

@bernhardoj
Copy link
Contributor

Yes, ND for me. Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@Christinadobrzyn
Copy link
Contributor

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Sep 25, 2024

Hey @abekkala! I'm going to be ooo until 9/30 -

Everything else is done! TY!

@Christinadobrzyn Christinadobrzyn removed the Bug Something is broken. Auto assigns a BugZero manager. label Sep 25, 2024
@Christinadobrzyn Christinadobrzyn removed their assignment Sep 25, 2024
@Christinadobrzyn Christinadobrzyn added the Bug Something is broken. Auto assigns a BugZero manager. label Sep 25, 2024
Copy link

melvin-bot bot commented Sep 25, 2024

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

@Christinadobrzyn Christinadobrzyn self-assigned this Sep 25, 2024
@abekkala
Copy link
Contributor

@aimane-chnaif if you can accept the offer sent by @Christinadobrzyn I can get that paid out - thanks!

@Christinadobrzyn Christinadobrzyn removed the Reviewing Has a PR in review label Sep 30, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 30, 2024
@Christinadobrzyn
Copy link
Contributor

I'm back @abekkala - thanks for watching this! I'll reach out to @aimane-chnaif in a DM about payment.

@melvin-bot melvin-bot bot removed the Overdue label Sep 30, 2024
@abekkala abekkala removed their assignment Sep 30, 2024
@Christinadobrzyn
Copy link
Contributor

I'm gonna move this to weekly since we're just waiting on paying @aimane-chnaif in Upwork.

@Christinadobrzyn Christinadobrzyn added Weekly KSv2 and removed Daily KSv2 labels Oct 1, 2024
@Christinadobrzyn
Copy link
Contributor

Paid @aimane-chnaif in Upwork.

payment summary here - #48172 (comment)

Closing as complete!

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: Done
Development

No branches or pull requests

9 participants