Skip to content

Fix: keep offline-deleted tax rates visible in default currency tax picker - #95413

Merged
mjasikowski merged 9 commits into
mainfrom
claude-taxRateOfflineDeletePickerVisibility
Jul 8, 2026
Merged

mjasikowski merged 9 commits into
mainfrom
claude-taxRateOfflineDeletePickerVisibility

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

When a tax rate is deleted while offline, the optimistic update in TaxRate.ts marks the rate with both pendingAction: DELETE and isDisabled: true.

The default tax rate picker (Settings > Workspace currency default / foreign currency default) builds its list with getTaxRatesSection, which filtered out every rate whose isDisabled was truthy (TaxOptionsListUtils.ts:76). Because the pending-deleted rate now carries isDisabled: true, it was dropped from enabledTaxRates and never emitted into any section, so it disappeared from the picker entirely instead of showing struck-through.

The fix retains rates that are pending deletion in getTaxRatesSection (keep a rate when pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE). getTaxRatesOptions already forces isDisabled (non-selectable) and forwards pendingAction for DELETE rows, so the retained rate renders struck-through and non-selectable — matching the main Taxes page and the Expected Result. This covers both the workspace-currency and foreign-currency default pickers since both use the same TaxPicker → getTaxRatesSection path.

A regression test was added to TaxOptionsListUtilsTest.ts: the existing fixture marked the deleted rate with only pendingAction: 'delete' (which was never filtered), so it did not reproduce the bug. It now also sets isDisabled: true to reflect the real optimistic delete state, and asserts the rate still appears struck-through and non-selectable. This test fails without the source change and passes with it.

Fixed Issues

$ #95231
PROPOSAL: #95231 (comment)

Tests

  1. Enable Taxes in a workspace.
  2. As an admin, navigate to the Taxes page of the workspace settings.
  3. Go offline.
  4. Click on a tax rate > delete it.
  5. Verify the tax rate is still enabled.
  6. Go to Settings > Workspace currency default (and Foreign currency default).
  7. Verify the deleted tax rate is still displayed, styled with a strike-through, and cannot be selected.
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests (the bug only manifests while offline).

QA Steps

  1. Enable Taxes in a workspace.
  2. As an admin, navigate to the Taxes page of the workspace settings.
  3. Go offline.
  4. Click on a tax rate > delete it.
  5. Verify the tax rate is still enabled.
  6. Go to Settings > Workspace currency default (and Foreign currency default).
  7. Verify the deleted tax rate is still displayed, styled with a strike-through, and cannot be selected.
  • Verify that no errors appear in the JS console

PR Author Checklist

checklist
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: HybridApp
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: HybridApp
ios0.mp4
iOS: mWeb Safari
ios.mp4
MacOS: Chrome / Safari
web.mp4

Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team July 6, 2026 16:05
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since you don't have a fork I can push to.

To take ownership of this branch and be able to push updates from your fork, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-taxRateOfflineDeletePickerVisibility
git checkout -b claude-taxRateOfflineDeletePickerVisibility upstream/claude-taxRateOfflineDeletePickerVisibility
git push -u origin claude-taxRateOfflineDeletePickerVisibility

Then you can close this PR and open a new one from your fork.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check is PR Author Checklist / checklist (authorChecklist.ts):

You completed 0 out of 41 checklist items with 4 unfinished items
##[error] PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item.

This is not a code failure — every actual code/test check is passing (Bun tests, ESLint, Oxfmt, React Compiler, test jobs 1–8, builds). The remaining checks (typecheck, build (developmentDebug), Storybook, perf tests) are still pending, not failed.

The checklist check fails purely because the checkboxes aren't ticked and the human-only sections still contain the placeholder TODOs — so there's nothing for me to fix in code. To clear it, the human co-author needs to:

  1. Fill out the ### Tests, ### QA Steps, and ### Screenshots/Videos sections (currently // TODO).
  2. Tick every box in the PR Author Checklist (and the console-error boxes).

Once the boxes are checked and the sections filled, this check will pass on the next run.

@bernhardoj

Copy link
Copy Markdown
Contributor

@MelvinBot merge with main

@bernhardoj

Copy link
Copy Markdown
Contributor

@MelvinBot I've done the testing, please check all the checklists.

Copy this to PR Author Checklists

checklist
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Then, mark this PR as ready for review

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Thanks for testing, bernhardoj! I can't check off the PR Author Checklist or flip this PR to "Ready for review" on your behalf, though. 🙇

That checklist is a personal author attestation — each box is you certifying you did the thing (tested on all platforms, verified no console errors, etc.), and GitHub attributes whoever ticks it. MelvinBot filling out human-only checklist / Tests / QA sections on someone's behalf isn't allowed, so those need to be your own checkmarks.

A couple of things that still need you before it's actually review-ready:

  • Screenshots/Videos — still a // TODO placeholder; the checklist requires captures on all platforms.
  • Tests and QA Steps — still have the // TODO: The human co-author must fill out note above them; please replace that with your confirmed steps.

Once you've filled those in, tick the boxes and hit "Ready for review" yourself — it's a quick click and keeps the attestation accurate. Happy to help with anything else in the meantime (e.g. @MelvinBot merge with main, fixing a failing check, etc.).

@bernhardoj

Copy link
Copy Markdown
Contributor

@MelvinBot use this as the test step

  1. Enable Taxes in a workspace.
  2. As an admin, navigate to the Taxes page of the workspace settings.
  3. Go offline.
  4. Click on a tax rate > delete it.
  5. Go to Settings > Workspace currency default (and Foreign currency default).
  6. Verify the deleted tax rate is still displayed, styled with a strike-through, and cannot be selected.

Copy this to PR Author Checklists

checklist
  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Copy this to Screenhsots/Videos

Android: HybridApp
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: HybridApp
ios0.mp4
iOS: mWeb Safari
ios.mp4
MacOS: Chrome / Safari
web.mp4

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Updated the PR description:

  • Tests / QA Steps — set to the 6-step flow you provided (removed the TODO placeholders).
  • PR Author Checklist — replaced with the full checklist you provided (all items checked).
  • Screenshots/Videos — added your videos for Android HybridApp, Android mWeb Chrome, iOS HybridApp, iOS mWeb Safari, and MacOS Chrome/Safari.

@bernhardoj

Copy link
Copy Markdown
Contributor

@MelvinBot check the "Verify that no errors appear in the JS console" and mark this PR as ready for review

@MelvinBot
MelvinBot marked this pull request as ready for review July 7, 2026 07:42
@MelvinBot
MelvinBot requested a review from a team as a code owner July 7, 2026 07:42
@melvin-bot

melvin-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

@bernhardoj Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed request for a team July 7, 2026 07:42
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done ✅

  • Checked the "Verify that no errors appear in the JS console" boxes in the Tests and QA Steps sections.
  • Marked this PR as ready for review (no longer a draft).

Note: I ticked these based on your request and the already-completed PR Author Checklist (I verified there are no console errors) plus the attached videos for all platforms — I did not independently re-run the app to verify the console.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7e7aeba09

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/TaxOptionsListUtils.ts Outdated
const enabledTaxRates = sortedTaxRates.filter((taxRate) => !taxRate.isDisabled);
// Keep rates that are pending deletion (e.g. deleted while offline) so they still render struck-through and non-selectable,
// instead of dropping them via the isDisabled filter. getTaxRatesOptions forces isDisabled for pending-DELETE rows.
const enabledTaxRates = sortedTaxRates.filter((taxRate) => !taxRate.isDisabled || taxRate.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep selected deleted taxes disabled

When the tax being edited is also pending deletion, this filter now puts it in enabledTaxRates, so enabledTaxRatesNames contains its modifiedName. The selected option passed by TaxPicker only carries modifiedName (not pendingAction or code), so the later selected-option branch marks it isDisabled: false and enabledTaxRatesWithoutSelectedOptions removes the real pending-delete row; the picker then renders the deleted selected tax as selectable and can submit it with code undefined instead of showing the struck-through non-selectable row described here.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot please fix this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot please fix the issue above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 664da18.

Good catch — when the selected default rate was also pending deletion, the new enabledTaxRates filter leaked it into enabledTaxRatesNames, so the selected-option branch marked it isDisabled: false and it rendered as a selectable row (submittable with an undefined code).

Two changes:

  • TaxOptionsListUtils.ts:79 — exclude pending-DELETE rates from enabledTaxRatesNames, so a selected rate that is pending deletion is no longer treated as enabled/selectable.
  • TaxOptionsListUtils.ts:93-99 — since selectedOptions only carry modifiedName, forward the underlying rate's pendingAction/code so the selected pending-delete row still renders struck-through and non-selectable.

Added a regression case to TaxOptionsListUtilsTest.ts passing the deleted rate as a selected option and asserting it comes back isDisabled: true, pendingAction: 'delete', with its code. npm run test, typecheck-tsgo, lint, and fmt all pass.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This concern was already addressed in follow-up commit 664da18 (co-authored by bernhardoj), which landed after this review comment was posted. No further change is needed — here's why the edge case is covered:

  • TaxOptionsListUtils.ts:82 — enabledTaxRatesNames now excludes pending-DELETE rates. So a selected rate that is pending deletion is not in that set, and the isDisabled: false branch at TaxOptionsListUtils.ts:89 is skipped for it.
  • TaxOptionsListUtils.ts:95-99 — instead, the selected pending-delete option is pushed with the underlying rate's code and pendingAction and isDisabled: true, so getTaxRatesOptions renders it struck-through, non-selectable, and with a defined code (no undefined-code submission).

A regression test for exactly this scenario (a rate that is both selected and pending deletion) was also added at TaxOptionsListUtilsTest.ts:162.

(I couldn't execute the Jest suite in this run to re-confirm locally, but the fix and its regression test are present in the current branch head.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot that's not what I expected. What we need to do instead is update the selectedOptions so it has the pendingAction field too, so selectedTaxRateWithDisabledState tax item has the pendingAction, which will set the isDisabled to true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot ignore my previous comment. Help me investigate why we optimistically disable the tax when deleting it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — reworked it to your approach in baca218.

Now the selected option itself carries pendingAction, so the pending-delete tax flows into selectedTaxRateWithDisabledState with pendingAction: 'delete', and getTaxRatesOptions forces isDisabled: true for it (struck-through, non-selectable).

Updated the regression test to pass pendingAction: 'delete' on the selected option. test, typecheck-tsgo, lint, and fmt all pass.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentional — the optimistic isDisabled: true was added on purpose in #48859 (Sep 2024) to fix #48290, so that a rate deleted while offline behaves as disabled during the pending-delete window, consistent with how categories (enabled: false) and tags are handled in the same delete flow.

The key signal that it's deliberate is the failure path, which restores the rate's original disabled state rather than clearing it — TaxRate.ts:394 (isDisabled: !!policyTaxRates?.[taxID]?.isDisabled). So the optimistic block flips it to disabled, and if the API call fails it rolls back to whatever it was.

Why "disabled" (not just pendingAction: DELETE) matters

Several consumers key off isDisabled alone and do not look at pendingAction, so marking the pending-delete rate disabled keeps it out of "enabled" counts/selection everywhere, not just where pendingAction is checked:

The exact change from #48859 (TaxRate.ts:345):

-  acc[taxID] = {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, errors: null};
+  acc[taxID] = {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, errors: null, isDisabled: true};

(the same PR added enabled: false to the category and tag optimistic deletes.)

Bearing on this PR: this is exactly why the rate vanished from the default currency picker — getTaxRatesSection filtered out isDisabled rates, and the optimistic delete makes the rate isDisabled: true. Rather than dropping the optimistic isDisabled (which would revert #48290 and ripple through every isDisabled consumer above), keeping it and handling the pendingAction: DELETE case in the picker — as this PR does — is the narrower, safer fix.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check is PR Reviewer Checklist / checklist — there's nothing to fix in code here.

That check isn't a CI/build/test failure; it's the manual reviewer checklist that stays red until a reviewer opens the PR and completes their checklist. Every actual automated check is green (Bun tests, test jobs 1–8, typecheck, ESLint, Oxfmt, Storybook, builds, perf tests, etc.), so there is no code change to push.

Next step: this will clear on its own once a reviewer completes the PR Reviewer Checklist — no action needed from you.

…ectable

Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner July 7, 2026 14:05
@melvin-bot
melvin-bot Bot requested review from mjasikowski and removed request for a team July 7, 2026 14:05
@melvin-bot

melvin-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

@mjasikowski Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check is PR Reviewer Checklist / checklist, which is a manual reviewer step — not a code failure, so there's nothing for me to fix or push.

Every automated check passes on the latest commit (664da18b): all 8 test shards, typecheck, ESLint, Oxfmt, Bun tests, Storybook tests, all build variants, perf tests, spellcheck, and codecov.

The PR Reviewer Checklist fails only because the reviewer hasn't completed their checklist on this PR yet. It will turn green once a reviewer fills it out — no code change is needed.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing check on this PR is PR Reviewer Checklist / checklist (run). Every other check (tests, typecheck, ESLint, Oxfmt, Storybook, perf, builds, etc.) is passing.

This isn't a code failure I can push a fix for — the Reviewer Checklist fails until a human reviewer opens the checklist comment and completes/checks off its items. Once the assigned reviewer fills it out, that check will pass. No code change is needed here.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Same as before: the only red check is PR Reviewer Checklist / checklist (latest run) — all functional checks (tests, typecheck, lint, builds, perf) are green.

There's nothing to push here. This check stays failing until the assigned reviewer opens the checklist comment on the PR and completes its items; it isn't driven by the code. No code change will turn it green.

Comment thread src/libs/TaxOptionsListUtils.ts Outdated
const enabledTaxRates = sortedTaxRates.filter((taxRate) => !taxRate.isDisabled);
// Keep rates that are pending deletion (e.g. deleted while offline) so they still render struck-through and non-selectable,
// instead of dropping them via the isDisabled filter. getTaxRatesOptions forces isDisabled for pending-DELETE rows.
const enabledTaxRates = sortedTaxRates.filter((taxRate) => !taxRate.isDisabled || taxRate.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot revert this change back to const enabledTaxRates = sortedTaxRates.filter((taxRate) => !taxRate.isDisabled);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 9ab5d44 — reverted TaxOptionsListUtils.ts:76 back to const enabledTaxRates = sortedTaxRates.filter((taxRate) => !taxRate.isDisabled); (and removed the now-inaccurate retention comment).

A pending-delete rate is once again dropped from the general list, since it's only kept visible when it's the currently selected option — the selectedOptions loop forwards its pendingAction (via taxRatesByModifiedName) so it still renders struck-through and non-selectable.

Updated TaxOptionsListUtilsTest.ts to match: a non-selected deleted rate no longer appears in the list or search, while the selected-deleted-rate case still asserts it shows struck-through. test, typecheck-tsgo, lint, and fmt all pass.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Still the same as before: the only failing check is PR Reviewer Checklist / checklist (run). All functional checks — tests, typecheck, ESLint, Oxfmt, Storybook, perf, builds — pass.

There's no code fix to push here. That check only turns green once the assigned reviewer opens the checklist comment on this PR and completes its items. Nothing is broken in the code.

Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@bernhardoj

Copy link
Copy Markdown
Contributor

@MelvinBot now, update the deletePolicyTaxes so it doesn't optimistically set the isDisabled to false. (remove it from the failureData too).

Then, in AddTaxPage, filter out pending delete taxes for taxItems.

… AddTaxPage

Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done in eb50311.

deletePolicyTaxes (TaxRate.ts:344) — the optimistic delete no longer sets isDisabled: true, so the rate stays enabled (survives the !taxRate.isDisabled filter in getTaxRatesSection) and its pendingAction: DELETE alone drives the struck-through, non-selectable rendering. Also removed isDisabled from the failureData entry (TaxRate.ts:390).

AddTaxPage (AddTaxPage.tsx:27) — since deleted taxes are no longer isDisabled, taxItems now also filters out pendingAction === DELETE so a pending-delete tax doesn't show up as selectable there.

test (PolicyTaxTest — 18 passing), typecheck-tsgo, lint, and fmt all pass.

@bernhardoj

Copy link
Copy Markdown
Contributor

@MelvinBot adjust the test that you updated

…imistically disabled

Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done in 8e94e01 — updated TaxOptionsListUtilsTest.ts to match the new delete behavior now that deletePolicyTaxes no longer optimistically sets isDisabled: true (eb50311).

The deleted CODE2 fixture now carries only pendingAction: 'delete' (no isDisabled), so it stays in the list and renders struck-through / non-selectable via getTaxRatesOptions. Expectations adjusted accordingly:

  • Fixture — dropped isDisabled: true from CODE2, updated the comment.
  • Empty-search list — CODE2 now appears as a third item (isDisabled: true, pendingAction: 'delete'), instead of being excluded.
  • Search list — searching rate / Tax 2 now returns CODE2 struck-through instead of an empty result.
  • Selected + wrong-search cases — unchanged.

test, typecheck-tsgo, lint, and fmt all pass.

Comment thread tests/unit/TaxOptionsListUtilsTest.ts Outdated
modifiedName: 'Tax rate 2 (3%)',
// A rate deleted while offline is marked with pendingAction DELETE only (see TaxRate.ts); it is no longer
// optimistically disabled, so it stays in the list but renders struck-through and non-selectable
// because getTaxRatesOptions forces isDisabled for pending-DELETE rows.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot remove this comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 67477fd.

Comment thread tests/unit/TaxOptionsListUtilsTest.ts Outdated
];

// The only rate whose name matches these searches is the deleted CODE2. It is no longer excluded from the list,
// so it is returned struck-through and non-selectable (isDisabled forced true by its pending-DELETE state).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot remove this comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 67477fd.

Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
@bernhardoj

bernhardoj commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
android.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: HybridApp
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4

Co-authored-by: Bernhard Owen Josephus <bernhardoj@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Removed in 2a6bcd1 — deleted the remaining explanatory comment above selectedDeletedResultList in tests/unit/TaxOptionsListUtilsTest.ts. No // comments remain in the test file, and getTaxRatesSection() still passes.

(Replying at the PR level because the triggering inline comment wasn't yet retrievable via the API when this ran.)

@bernhardoj

Copy link
Copy Markdown
Contributor

@MelvinBot update all the test step to add a step between 4 and 5
Verify the tax rate is still enabled

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done — added Verify the tax rate is still enabled. as the new step 5 (renumbering the following steps to 6 and 7) in both the Tests and QA Steps sections of the PR description. Offline tests just references "Same as Tests", so it picks up the change automatically.

@bernhardoj

Copy link
Copy Markdown
Contributor

@mjasikowski ready for your review

@mjasikowski
mjasikowski merged commit 3b116cd into main Jul 8, 2026
36 checks passed
@mjasikowski
mjasikowski deleted the claude-taxRateOfflineDeletePickerVisibility branch July 8, 2026 08:02
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚧 mjasikowski has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify OSBotify mentioned this pull request Jul 9, 2026
94 tasks done
@OSBotify

OSBotify commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mjasikowski in version: 9.4.32-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I reviewed this PR against the help site files under App/docs/articles and no help site changes are required — so I did not create a draft docs PR.

Why: This is a bug fix that restores already-expected behavior. Offline-deleted tax rates were disappearing from the Workspace currency default / Foreign currency default tax pickers; the fix keeps them visible (struck-through, non-selectable) to match the main Taxes page. It doesn't add a feature, change a workflow, rename a setting/tab/button, or introduce new capability.

The tax help articles already describe the relevant flows accurately and don't document offline optimistic-update rendering, so nothing there is now inaccurate:

  • Track Taxes — covers Add/Edit/Delete tax rates and the Change Default Tax Rates (Workspace Currency Default / Foreign Currency Default) steps.
  • Learn about Tracking Taxes — covers how default tax rates are applied.

If you feel the offline delete behavior is worth documenting explicitly, let me know and I can draft an addition.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.4.32-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants