Skip to content

fix: show floating action badge for errored expense not above viewpor… - #97180

Closed
Abdulloh0109 wants to merge 1 commit into
Expensify:mainfrom
Abdulloh0109:fix/96132-floating-action-badge
Closed

fix: show floating action badge for errored expense not above viewpor…#97180
Abdulloh0109 wants to merge 1 commit into
Expensify:mainfrom
Abdulloh0109:fix/96132-floating-action-badge

Conversation

@Abdulloh0109

@Abdulloh0109 Abdulloh0109 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The floating action badge (FloatingMessageCounter) is only rendered when its target report action is above the viewport (isActionBadgeAboveViewport). PR #94762 retargeted the FIX badge's actionTargetReportActionID to the oldest errored child's report-preview action — the just-failed expense, which is the newest action at the bottom of the chat. That target is never above the viewport, so after a failed submission the badge stopped appearing instead of changing to "Fix".

This gates the badge on the error status too, so the red FIX badge surfaces regardless of scroll position. The green SUBMIT/APPROVE/PAY badges keep their existing above-viewport ("scroll up to your queue") behavior.

const shouldShowActionBadge = !isProduction && (isActionBadgeAboveViewport || reportAttributes?.actionBadge === CONST.REPORT.ACTION_BADGE.FIX);

Fixed Issues

$ #96132
PROPOSAL: #96132 (comment)

Tests

Prerequisite: a workspace chat.

  1. Open the workspace chat and scroll to the bottom.
  2. Press Ctrl + D (native) / Account → Troubleshoot (web) and enable Simulate failing network requests.
  3. Create an expense.
  4. Wait for the expense to fail — it shows "Unexpected error submitting this expense".
  5. Verify the floating action badge appears as a red Fix pill at the top of the chat.
  6. Click the Fix badge and verify the app scrolls to the failed expense.
  • Verify that no errors appear in the JS console

Offline tests

With failing network simulated, the failed expense shows its error state and the floating Fix badge appears; clicking it scrolls to the failed expense.

QA Steps

Prerequisite: a workspace chat.

  1. Open the workspace chat and scroll to the bottom.
  2. Enable Simulate failing network requests.
  3. Create an expense and wait for it to fail.
  4. Verify the floating action badge appears as Fix and clicking it scrolls to the failed expense.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author 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 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 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

MacOS: Chrome / Safari
622006477-538592c4-e1a9-4729-aa4c-e707f7986b3e.mp4

@Abdulloh0109
Abdulloh0109 requested review from a team as code owners July 28, 2026 04:31
@melvin-bot
melvin-bot Bot requested a review from rojiphil July 28, 2026 04:31
@melvin-bot

melvin-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

@rojiphil 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 requested review from trjExpensify and removed request for a team July 28, 2026 04:31

@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: 4292a99193

ℹ️ 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".

// The FIX badge points at the errored child (the just-failed expense), which is the newest action at the
// bottom of the chat — never above the viewport — so it must surface regardless of scroll position. Green
// badges stay a "scroll up to your queue" affordance and remain gated to the above-viewport case.
const shouldShowActionBadge = !isProduction && (isActionBadgeAboveViewport || reportAttributes?.actionBadge === CONST.REPORT.ACTION_BADGE.FIX);

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 Require a target before showing Fix badge

When a report gets a FIX badge from an RBR source that does not provide a reportAction (for example receipt-upload errors leave actionTargetReportActionID undefined in reportAttributes.ts), actionBadgeTargetIndex is -1; this new condition still renders the red Fix pill, but pressing it only reaches the early return in scrollToActionBadgeTarget, leaving a persistent no-op badge. Please keep the unconditional FIX path behind a valid action target.

Useful? React with 👍 / 👎.

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.

👍

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/pages/inbox/report/ReportActionsList.tsx 88.57% <100.00%> (+0.08%) ⬆️
... and 12 files with indirect coverage changes

@Abdulloh0109
Abdulloh0109 force-pushed the fix/96132-floating-action-badge branch from 4292a99 to aab7999 Compare July 28, 2026 04:36
Expensify#96132)

The FIX action badge targets the oldest errored child's report-preview action (the just-failed expense), which is the newest action at the bottom of the chat and therefore never above the viewport. The render gate only showed the badge when the target was above the viewport (isActionBadgeAboveViewport), so after a failed submission the badge disappeared instead of showing Fix. Gate the badge on the error status too so it surfaces regardless of scroll position; green Submit/Approve/Pay badges keep the above-viewport behavior.
@Abdulloh0109
Abdulloh0109 force-pushed the fix/96132-floating-action-badge branch from aab7999 to 63d46b1 Compare July 28, 2026 04:54

@trjExpensify trjExpensify left a comment

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.

The floating action badge (FloatingMessageCounter) is only rendered when its target report action is above the viewport (isActionBadgeAboveViewport)

@Expensify/design I'm not sure I quite understand this. Isn't it intentional that the Fix pill should only show for previews in the chat history that are not in the viewport?

@dannymcclain

Copy link
Copy Markdown
Contributor

Yeah I guess I'm not following really either because I thought the whole point of the pill was to draw your attention to things that weren't visible in the viewport? So I'm not sure I totally understand the goal of this fix.

@trjExpensify

Copy link
Copy Markdown
Contributor

@rojiphil do you agree?

@shawnborton

Copy link
Copy Markdown
Contributor

That's my understanding too, Danny.

@rojiphil

Copy link
Copy Markdown
Contributor

The floating action badge (FloatingMessageCounter) is only rendered when its target report action is above the viewport (isActionBadgeAboveViewport)

@Expensify/design I'm not sure I quite understand this. Isn't it intentional that the Fix pill should only show for previews in the chat history that are not in the viewport?

Thanks @trjExpensify for raising this. Yeah, that seems intentional as per #86064 where the above-viewport rule was implemented. And the staging version seems to work fine for this as demonstrated below. Looks like the confusion arises from OP test steps where the just-created failing expense’s preview action is the newest action i.e. at the bottom of the chat and the expectation is to see the Fix floating action badge. Does this mean we should do nothing here?

96132-001.mp4

@trjExpensify

Copy link
Copy Markdown
Contributor

Okay cool, thanks for confirming. Yeah, I think we should do nothing. It doesn't make sense to always show Fix when the preview in question is in the scrollview 👍

@Abdulloh0109

Copy link
Copy Markdown
Contributor Author

@trjExpensify @rojiphil bumping this — no reply for 4 days.

What change do we want on this PR? I just need the call so I can move:

  1. Close it as working as intended, or
  2. Adjust it to cover the case I raised above.

Either works for me.

Separately: #96132 was assigned to me, the PR was raised, reviewed and is fully green — the work was done in good faith on an assigned job before we concluded no code change may be needed. Could you confirm how payment is handled in this case?

@rojiphil

rojiphil commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@Abdulloh0109 I think closing the PR makes sense as the current behaviour is intended. Also, agree with you that the work was done in good faith.

@mallenexpensify This is a case where we have to close the job before it is completed. Also, the contributor has drafted the PR and requested a review; I reviewed and tested it after considering the product/design team's input. A 100% compensation seems fair here.

@trjExpensify

Copy link
Copy Markdown
Contributor

yes, closing this PR. @mallenexpensify can help with the payment side of things on the parent issue.

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.

5 participants