Skip to content

Fix skeleton loader flash on Inbox Unread/To-dos tabs when receiving a message - #93533

Merged
youssef-lr merged 3 commits into
mainfrom
claude-fixUnreadSkeletonFlash
Jun 15, 2026
Merged

youssef-lr merged 3 commits into
mainfrom
claude-fixUnreadSkeletonFlash

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

On the Inbox Unread / To-dos tabs, a brief skeleton loader + empty-state flash appeared whenever a new message arrived (DeployBlockerCash from #92146).

There are two independent skeletons in the Inbox sidebar:

  1. BaseSidebarScreen — the cold-load skeleton, correctly guarded by a module-level hasEverFinishedLoading flag so it is shown only once on first load and never again, even when isLoadingApp briefly flips back to true during a reconnect.
  2. SidebarLinks — a second, unguarded skeleton that rendered whenever isLoadingReportData && optionListItems.length === 0.

PR #92146 changed optionListItems from the full report list to the filtered tab list (SidebarLinksData now passes filteredReports). On the Unread/To-dos tabs that list is legitimately empty when there's nothing to show, so the second condition was constantly satisfied. When a new message arrived, a partial ReconnectApp flipped isLoadingReportData to true while the filtered list was momentarily still empty — so the unguarded SidebarLinks skeleton painted on top of the empty state until the new report synced.

Because BaseSidebarScreen only mounts SidebarLinksData after the first load completes (and already owns the cold-load skeleton with the proper guard), the inner SidebarLinks skeleton could effectively only ever fire in this reconnect-flash scenario. This PR removes that now-redundant skeleton (and its now-unused imports/variables). The "You're all caught up" empty state still renders correctly underneath while the incoming chat streams in — with no skeleton flash.

Fixed Issues

$ #93531
PROPOSAL: #93531 (comment)

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"

Suggested manual test:

  1. As User A, ensure there is no existing conversation with User B and no unread chats.
  2. Open the Inbox and switch to the Unread tab (shows "You're all caught up").
  3. From another device/account (User B), start a conversation with User A and send a message.
  4. Verify the new chat appears in the Unread list without a skeleton loader flashing over the empty state.
  5. Regression: cold-launch the app and verify the initial sidebar skeleton still shows once while loading, then the chat list renders.
  • Verify that no errors appear in the JS console

Offline tests

N/A — change only removes a transient loading overlay.

QA Steps

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".

  • 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
    • MacOS: Desktop
  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

🤖 Generated by MelvinBot from the approved proposal on #93531. AI checks run locally: lint-changed ✅, prettier ✅, react-compiler check (no regression vs main — file was already in the non-compiling set) ✅, SidebarTest ✅, UnreadIndicatorsTest ✅. typecheck surfaced only pre-existing, unrelated errors in src/libs/API/types.ts (untouched by this PR).

…ects

Co-authored-by: Youssef Lourayad <youssef-lr@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚧 @youssef-lr has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@youssef-lr
youssef-lr requested a review from parasharrajat June 15, 2026 06:38
@youssef-lr
youssef-lr marked this pull request as ready for review June 15, 2026 06:39
@youssef-lr
youssef-lr requested a review from a team as a code owner June 15, 2026 06:39
@melvin-bot
melvin-bot Bot requested review from heyjennahay and youssef-lr and removed request for a team June 15, 2026 06:39
@melvin-bot

melvin-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

@youssef-lr 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 the request for review from a team June 15, 2026 06:39

@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

{shouldShowEmptyLHN ? (
<View style={[styles.flex1, styles.emptyLHNWrapper]}>
<LHNEmptyState />
</View>

P2 Badge Preserve the loader after clearing report data

When switching accounts/delegate sessions or reauthing after an Onyx clear, the report collection is emptied and openApp() sets IS_LOADING_REPORT_DATA=true; however BaseSidebarScreen suppresses its outer skeleton after the first app load via the module-level hasEverFinishedLoading flag. Now that the inner IS_LOADING_REPORT_DATA && optionListItems.length === 0 fallback has been removed, this branch renders the empty LHN while the new account’s reports are still loading, so users can briefly see “no chats”/“caught up” even though chats are about to populate. Please keep a guarded loading state for the Onyx-cleared/openApp path while avoiding the reconnect flash.

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

@youssef-lr

Copy link
Copy Markdown
Contributor

@MelvinBot address this #93533 (review)

Address Codex review: gate the loading skeleton on the unfiltered report
set (orderedReportIDs) being empty rather than the per-tab filtered list,
so account switches/delegate sessions/reauth show a loader while reports
repopulate, while still avoiding the reconnect flash on Unread/To-do tabs.

Co-authored-by: Youssef Lourayad <youssef-lr@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner June 15, 2026 07:18
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Addressed in 3830a90.

Codex is right: removing the inner skeleton entirely also dropped the legitimate loading state for the Onyx-cleared/openApp() path (account switch, delegate sessions, reauth), where BaseSidebarScreen's outer skeleton stays suppressed by the module-level hasEverFinishedLoading flag. With the fallback gone, that path painted the empty LHN ("You're all caught up"/"no chats") while the new account's reports were still loading.

Fix: restore a guarded skeleton, but gate it on the unfiltered report set instead of the current tab's filtered list. The distinguishing signal between the two scenarios is whether any reports exist:

  • Reconnect flash (the original bug): the filtered Unread/To-do list is momentarily empty, but the full report collection is not empty → no skeleton.
  • Onyx-cleared/openApp(): the full report collection is empty + isLoadingReportData is true → skeleton shows until reports repopulate.

SidebarLinksData already exposes orderedReportIDs (the unfiltered LHN set), so it now passes hasReportData={orderedReportIDs.length > 0} to SidebarLinks, which shows the skeleton only when isLoadingReportData && !hasReportData:

This keeps the reconnect flash fixed (the original optionListItems.length === 0 gate was the part that conflated the two cases on the filtered tabs) while restoring the loader for full reloads. The "display empty state" test was updated to set IS_LOADING_REPORT_DATA: false, which reflects the real finished-loading state where the empty LHN should render.

AI checks run locally on the new commit: prettier ✅, lint-changed ✅, react-compiler check-changed (no regression vs main — both files were already in the non-compiling set) ✅, typecheck (only pre-existing unrelated errors in src/libs/API/types.ts) ✅, SidebarTest ✅, UnreadIndicatorsTest ✅, LHNItemsPresence ✅.

@melvin-bot
melvin-bot Bot requested review from Valforte and removed request for a team June 15, 2026 07:19
@melvin-bot

melvin-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

@Valforte 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]

Co-authored-by: Youssef Lourayad <youssef-lr@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Fixed the failing Spell check check: cspell flagged the non-dictionary word reauthing in a code comment at src/pages/inbox/sidebar/SidebarLinks.tsx:92. Replaced it with re-authenticating. Verified locally with npm run spell-changed.

The remaining PR Author Checklist / checklist failure is the manual author checklist and is expected — the human co-author still needs to fill out the Tests/QA sections.

@codecov

codecov Bot commented Jun 15, 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/sidebar/SidebarLinks.tsx 93.75% <100.00%> (+0.20%) ⬆️
src/pages/inbox/sidebar/SidebarLinksData.tsx 100.00% <100.00%> (ø)
... and 33 files with indirect coverage changes

@Valforte

Valforte commented Jun 15, 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari

@Valforte Valforte 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.

Changes LGTM, can you address the author checklist?

@parasharrajat parasharrajat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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.
15.06.2026_19.39.30_REC.mp4

🎀 👀 🎀 C+ reviewed

@parasharrajat

Copy link
Copy Markdown
Member

@MelvinBot Update the PR description with this.

### Explanation of Change

On the Inbox **Unread** / **To-dos** tabs, a brief **skeleton loader + empty-state flash** appeared whenever a new message arrived (DeployBlockerCash from #92146).

There are two independent skeletons in the Inbox sidebar:

1. `BaseSidebarScreen` — the cold-load skeleton, correctly guarded by a module-level `hasEverFinishedLoading` flag so it is shown only once on first load and **never again**, even when `isLoadingApp` briefly flips back to `true` during a reconnect.
2. `SidebarLinks` — a second, **unguarded** skeleton that rendered whenever `isLoadingReportData && optionListItems.length === 0`.

PR #92146 changed `optionListItems` from the full report list to the **filtered** tab list (`SidebarLinksData` now passes `filteredReports`). On the Unread/To-dos tabs that list is legitimately empty when there's nothing to show, so the second condition was constantly satisfied. When a new message arrived, a partial `ReconnectApp` flipped `isLoadingReportData` to `true` while the filtered list was momentarily still empty — so the unguarded `SidebarLinks` skeleton painted on top of the empty state until the new report synced.

Because `BaseSidebarScreen` only mounts `SidebarLinksData` **after** the first load completes (and already owns the cold-load skeleton with the proper guard), the inner `SidebarLinks` skeleton could effectively only ever fire in this reconnect-flash scenario. This PR **removes that now-redundant skeleton** (and its now-unused imports/variables). The "You're all caught up" empty state still renders correctly underneath while the incoming chat streams in — with no skeleton flash.

### Fixed Issues

$ https://github.com/Expensify/App/issues/93531
PROPOSAL: https://github.com/Expensify/App/issues/93531#issuecomment-4699112785

### Tests
// TODO: **The human co-author** must fill out the tests you ran before marking this PR as "ready for review"

Suggested manual test:
1. As User A, ensure there is no existing conversation with User B and no unread chats.
2. Open the Inbox and switch to the **Unread** tab (shows "You're all caught up").
3. From another device/account (User B), start a conversation with User A and send a message.
4. Verify the new chat appears in the Unread list **without** a skeleton loader flashing over the empty state.
5. Regression: cold-launch the app and verify the initial sidebar skeleton still shows once while loading, then the chat list renders.

- [ ] Verify that no errors appear in the JS console

### Offline tests

N/A — change only removes a transient loading overlay.

### QA Steps
// TODO: **The human co-author** must fill out the QA tests you ran before marking this PR as "ready for review".

- [ ] Verify that no errors appear in the JS console

### PR Author Checklist
<!--
This is a checklist for PR authors. Please make sure to complete all tasks and check them off once you do, or else your PR will not be merged!
-->

- [x] I linked the correct issue in the `### Fixed Issues` section above
- [x] I wrote clear testing steps that cover the changes made in this PR
    - [x] I added steps for local testing in the `Tests` section
    - [x] I added steps for the expected offline behavior in the `Offline steps` section
    - [x] I added steps for Staging and/or Production testing in the `QA steps` section
    - [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    - [x] 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)
    - [x] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
- [x] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I ran the tests on **all platforms** & verified they passed on:
    - [x] Android: Native
    - [x] Android: mWeb Chrome
    - [x] iOS: Native
    - [x] iOS: mWeb Safari
    - [x] MacOS: Chrome / Safari
    - [x] MacOS: Desktop
- [x] 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)
- [x] I verified there are no new alerts related to the `canBeMissing` param for `useOnyx`
- [x] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
    - [x] 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`)
    - [x] I verified that comments were added to code that is not self explanatory
    - [x] 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.
    - [x] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L80)
      - [x] If any non-english text was added/modified, I used [JaimeGPT](https://chatgpt.com/g/g-2dgOQl5VM-english-to-spanish-translator-aka-jaimegpt) to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    - [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4510fc76bbf5df699a2575bfb49a276af90f3ed7/src/components/LocaleContextProvider.tsx#L116-L123)
    - [x] 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)
    - [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    - [x] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [x] 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)
- [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- [x] I verified that if a function's arguments changed that all usages have also been updated correctly
- [x] If any new file was added I verified that:
    - [x] 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
- [x] If a new CSS style is added I verified that:
    - [x] A similar style doesn't already exist
    - [x] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
- [x] If new assets were added or existing ones were modified, I verified that:
    - [x] The assets are optimized and compressed (for SVG files, run `npm run compress-svg`)
    - [x] The assets load correctly across all supported platforms.
- [x] 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.
- [x] 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)
- [x] 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.
- [x] 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.
- [x] 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:
    - [x] I verified that all the inputs inside a form are aligned with each other.
    - [x] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [x] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [x] I added [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [x] 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
<details>
<summary>Android: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>Android: mWeb Chrome</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: Native</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>iOS: mWeb Safari</summary>

<!-- add screenshots or videos here -->

</details>

<details>
<summary>MacOS: Chrome / Safari</summary>

<!-- add screenshots or videos here -->

</details>

---
<sub>🤖 Generated by MelvinBot from the approved proposal on #93531. AI checks run locally: `lint-changed` ✅, `prettier` ✅, react-compiler `check` (no regression vs `main` — file was already in the non-compiling set) ✅, `SidebarTest` ✅, `UnreadIndicatorsTest` ✅. `typecheck` surfaced only pre-existing, unrelated errors in `src/libs/API/types.ts` (untouched by this PR).</sub>

@parasharrajat

Copy link
Copy Markdown
Member

@Valforte All set.

@youssef-lr
youssef-lr merged commit f5e2a4d into main Jun 15, 2026
37 of 38 checks passed
@youssef-lr
youssef-lr deleted the claude-fixUnreadSkeletonFlash branch June 15, 2026 15:02
@OSBotify

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.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 @youssef-lr has triggered a test Expensify/App build. You can view the workflow run here.

OSBotify pushed a commit that referenced this pull request Jun 15, 2026
Fix skeleton loader flash on Inbox Unread/To-dos tabs when receiving a message

(cherry picked from commit f5e2a4d)

(cherry-picked to staging by puneetlath)
@OSBotify OSBotify added the CP Staging marks PRs that have been CP'd to staging label Jun 15, 2026
@arekm213

Copy link
Copy Markdown
Contributor

📱 Mobile QA — PR #93533 · PASS ✅

Reproduced the bug on main and verified the fix on this PR branch, on an Android emulator (the only platform the linked issue reproduces on).

Issue #93531 — Android · Unread · skeleton loader displayed after receiving message while on "Unread"
Platform tested Android — Native (Pixel 9, API 35). Issue ## Platforms: only Android: App ✓
Branches bug: main @ 7224b837ffd · fix: claude-fixUnreadSkeletonFlash @ 22fba10df2c
Account expensifytestinglogin+pr93200@gmail.com (staging)
Verdict ✅ PASS — the skeleton flash on the Unread tab is gone on the PR branch

What the bug is

On the Inbox Unread / To-dos tabs (where the filtered list is legitimately empty → "You're all caught up"), a brief skeleton loader painted over the empty state whenever isLoadingReportData flipped to true during a reconnect. The unguarded condition in SidebarLinks was isLoadingReportData && optionListItems.length === 0 — and since #92146 made optionListItems the filtered (per-tab) list, that condition was constantly satisfied on the Unread/To-dos tabs.

What the diff does

SidebarLinks.tsx now gates the skeleton on the unfiltered report set: shouldShowLoadingSkeleton = isLoadingReportData && !hasReportData, and SidebarLinksData.tsx passes hasReportData={orderedReportIDs.length > 0}. So when reports exist but the current tab's filtered list is empty, the skeleton no longer shows.

How I triggered it (note)

The issue's literal trigger is "receive a message from another account". I instead toggled the device offline → online (airplane mode) while parked on the Unread tab with an empty list. This drives a ReconnectApp, which sets the exact same isLoadingReportData flag the PR gates on — i.e. it exercises the identical code path the fix changes — and it's deterministic for capturing the sub-second flash. A real inbound message produces the same isLoadingReportData=true partial-reconnect condition.


Side-by-side (same reconnect moment, ~same timestamp)

Left = main (skeleton flashes over the empty Unread tab) · Right = PR branch (stays "You're all caught up", no skeleton).

main vs PR at reconnect moment

Before — main (bug) 🐞

Unread tab "all caught up" → reconnect → skeleton loader paints over the empty state.

All caught up (before reconnect) Skeleton flash on reconnect (BUG)
main all caught up main skeleton flash

main reconnect GIF

▶️ Full video — main (~28s, two offline→online reconnects, compressed)

After — PR branch (fixed) ✅

Same Unread tab, same reconnect — empty state stays put, no skeleton.

All caught up (before reconnect) After reconnect (no skeleton — FIXED)
pr all caught up pr no skeleton

pr reconnect GIF

▶️ Full video — PR branch (~27s, same two reconnects, compressed)


Verdict

✅ PASS. On main, a reconnect while on the Unread "all caught up" tab flashes the OptionsListSkeletonView over the empty state (Actual = the reported bug). On the PR branch, the identical flow keeps the empty state with no skeleton flash (Expected). The size of the captured GIFs reflects it too — main 819 KB (animated skeleton) vs PR 108 KB (static empty state).

Caveats

  • Android only — matches the issue's single reproduced platform; web/mWeb/iOS not in scope here.
  • Bug triggered via a network-reconnect toggle rather than a literal inbound message (same isLoadingReportData code path; see note above).
  • Fix applied by checking out the PR's two changed files (SidebarLinks.tsx, SidebarLinksData.tsx) onto the test branch and reloading the JS bundle (the change is JS-only).
  • The "Fast Refresh disconnected" banner is a dev-bundle (Metro HMR) artifact, unrelated to the app's backend connectivity or this behavior.

🤖 Automated mobile QA run (Argent) — reproduced on main, verified on the PR branch, Android native simulator.

@OSBotify OSBotify mentioned this pull request Jun 15, 2026
62 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/puneetlath in version: 9.4.7-4 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 No help site changes required.

This PR is an internal bug fix: it re-gates a transient skeleton loader in the Inbox sidebar (SidebarLinks) so it no longer flashes over the empty state on the Unread / To-dos tabs when a new message arrives. The skeleton now keys off the unfiltered LHN report set (hasReportData) instead of the per-tab filtered list.

There is no change to any customer-facing feature, setting, label, navigation, workflow, billing, or integration behavior — only a transient loading overlay was corrected. Nothing in App/docs/articles describes this loading-state behavior, so no help site article needs to be created or updated, and no draft PR was opened.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.7-4 🚀

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/puneetlath in version: 9.4.8-0 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Help site review: no changes required

I reviewed the changes in this PR against the help site articles under docs/articles.

Conclusion: No help site updates are required.

Why:

  • This PR is a purely internal visual bug fix — it removes a now-redundant, unguarded skeleton loader in SidebarLinks.tsx that briefly flashed over the Inbox Unread / To-dos empty state when a new message arrived.
  • There are no new features, settings, buttons, tab names, or user-facing copy introduced or changed. The "You're all caught up" empty state continues to render exactly as before — only the transient skeleton flash on top of it is removed.
  • The help site does not document loading/skeleton behavior. The closest related content is the For you section's empty/caught-up state in Understanding-the-For-you-Section.md and Expensify-Home-Overview.md, and neither describes the skeleton loader or any behavior altered by this PR.

Since no documented behavior changes, I did not create a draft help site PR.


@youssef-lr, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/puneetlath in version: 9.4.8-0 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Help site review: no changes required

I reviewed the changes in this PR against the help site articles under docs/articles and no documentation updates are required, so I did not open a docs PR.

Why: This is a purely internal rendering fix. It changes the gating condition for the Inbox sidebar loading skeleton (shouldShowLoadingSkeleton = isLoadingReportData && !hasReportData) so the skeleton no longer briefly flashes over the empty state on the Unread / To-dos tabs when a new message arrives. There is no new feature, no changed setting, no renamed UI label, and no altered user workflow — nothing that the help site documents.

If anything, the fix brings the actual behavior into line with what the docs already describe. The existing articles correctly state that an empty section means "you're caught up":

These descriptions remain accurate; the skeleton flash was a transient visual bug that contradicted them, and removing it makes the UI consistent with the docs.

@youssef-lr, no linked help site PR was created because the changes are internal-only and don't affect any documented behavior. If you believe a customer-facing article does need updating, let me know which one and I'll draft it.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.8-3 🚀

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

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

Labels

CP Staging marks PRs that have been CP'd to staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants