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

Taxes - Missing tax rates in currency default list & app crashes when clicking on foreign rate #39602

Closed
6 tasks done
kbecciv opened this issue Apr 4, 2024 · 14 comments
Closed
6 tasks done
Assignees
Labels
Engineering Reviewing Has a PR in review Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Apr 4, 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: 1.4.60-1
Reproducible in staging?: y
Reproducible in production?: n
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
    2.Create a new (Collect) workspace.
  2. Go to Collect workspace settings > More features
  3. Toggle on Taxes.
  4. Go to Taxes tab.
  5. Click Settings > Workspace currency default.
  6. Go to Foreign currency default.
  7. Click on the selected default tax.

Expected Result:

In Step 6 and 7, all other available taxes will show up in the list.
In Step 8, app will not crash.

Actual Result:

In Step 6 and 7, only the selected default tax shows up in the list.
In Step 8, app crashes

Workaround:

n/a

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

Bug6437926_1712233913737.default_tax_and_crash.mp4

View all open jobs on GitHub

@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Apr 4, 2024
Copy link

melvin-bot bot commented Apr 4, 2024

Triggered auto assignment to @pecanoro (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

github-actions bot commented Apr 4, 2024

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@kbecciv
Copy link
Author

kbecciv commented Apr 4, 2024

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

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Apr 4, 2024

Proposal

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

Taxes - Missing tax rates in currency default list & app crashes when clicking on foreign rate

What is the root cause of that problem?

Actually looks like the BE issue
Because when we choose the same Workspace currency we get from BE new empty tax
As result we get crash that we try to get name from undefined

const submit = ({keyForList}: ListItem) => {
setWorkspaceCurrencyDefault(policyID, keyForList ?? '');
Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
};

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

To fix this issue we can add condition to just close current screen when we choose the same value without selecting the value

        if (selectedTaxRate === keyForList) {
            Navigation.goBack(ROUTES.WORKSPACE_TAXES_SETTINGS.getRoute(policyID));
            return;
        }

And we can filter the list when we don't have mandatory values( Or just update name like (value?.name ?? '') and other fields)

const taxesList = useMemo<ListItem[]>(
() =>
Object.entries(policy?.taxRates?.taxes ?? {})
.map(([key, value]) => ({
text: value.name,
alternateText: textForDefault(key),
keyForList: key,
isSelected: !!selectedTaxesIDs.includes(key),
isDisabledCheckbox: key === defaultExternalID,
pendingAction: value.pendingAction,
errors: value.errors,
rightElement: (
<View style={styles.flexRow}>
<Text style={[styles.disabledText, styles.alignSelfCenter]}>
{value.isDisabled ? translate('workspace.common.disabled') : translate('workspace.common.enabled')}
</Text>
<View style={[styles.p1, styles.pl2]}>
<Icon
src={Expensicons.ArrowRight}
fill={theme.icon}
/>
</View>
</View>
),
}))
.sort((a, b) => a.text.localeCompare(b.text)),
[policy?.taxRates?.taxes, textForDefault, defaultExternalID, selectedTaxesIDs, styles, theme.icon, translate],
);

What alternative solutions did you explore? (Optional)

NA

@pecanoro
Copy link
Contributor

pecanoro commented Apr 4, 2024

@ZhenjaHorbach don't add proposals until the Help Wanted is applied. Since this a deploy blocker, I am looking for this to get fixed by whoever broke it.

@pecanoro
Copy link
Contributor

pecanoro commented Apr 4, 2024

I am confident this deploy blocker is coming from #33927

@MonilBhavsar
Copy link
Contributor

Looking...

@MonilBhavsar MonilBhavsar self-assigned this Apr 4, 2024
@teneeto
Copy link
Contributor

teneeto commented Apr 4, 2024

Hi, I'm Eto from Callstack - expert contributor group - and I would like to take care of this issue.

@pecanoro
Copy link
Contributor

pecanoro commented Apr 4, 2024

@teneeto Any updates on this? It's a deploy blocker so we either need to fix it asap or revert the original PR

@MonilBhavsar
Copy link
Contributor

@MonilBhavsar
Copy link
Contributor

PR is up #39646

@MonilBhavsar
Copy link
Contributor

PR is merged. Requested CP

@pecanoro pecanoro added the Reviewing Has a PR in review label Apr 5, 2024
@MonilBhavsar MonilBhavsar added Weekly KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Apr 5, 2024
@MonilBhavsar
Copy link
Contributor

Works well, no action required here

Screen.Recording.2024-04-05.at.6.18.06.PM.mov

@pecanoro
Copy link
Contributor

All done, closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

5 participants