Skip to content

[CP Staging] Revert "Add insight-switcher dropdown to the chart slot in Home" - #98351

Closed
mountiny wants to merge 1 commit into
mainfrom
vit-revert-home-insight-switcher
Closed

[CP Staging] Revert "Add insight-switcher dropdown to the chart slot in Home"#98351
mountiny wants to merge 1 commit into
mainfrom
vit-revert-home-insight-switcher

Conversation

@mountiny

@mountiny mountiny commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Reverts Add insight-switcher dropdown to the chart slot in Home (merge commit a7d6923), which crashes the iOS app when a user opens the Home Insights dropdown and picks Top merchants. The crash is unrecoverable — the reporter had to delete and reinstall the app.

The revert restores the previous Home behaviour, where the chart slot always shows Spend over time and has no dropdown:

  • InsightsSection goes back to SpendOverTimeSection, and useInsightData back to useSpendOverTimeData.
  • InsightTitleDropdown and useHomeInsightConfigs are removed.
  • The nvp_homeSelectedInsight Onyx key and its insightsSection translations are removed.
  • WidgetContainer loses the titleContent prop that the dropdown needed.
  • The track-intent Top spenders gating moves back from getSuggestedSearchesVisibility into createTypeMenuSections, so Spend still hides Top spenders for track-intent users with Workflows disabled.

One conflict came up in config/eslint/eslint.seatbelt.tsv. main had dropped the @typescript-eslint/no-unsafe-type-assertion entry for this file because the post-PR version no longer had an assertion. The restored useSpendOverTimeData.ts still casts to GroupedItem[], so the entry is restored with a count of 1.

Fixed Issues

$ #98331
PROPOSAL: N/A

Tests

  1. Log in to an account that is an admin, auditor, or approver on at least one workspace.
  2. Create an expense dated in the previous calendar month.
  3. Open Home and scroll to the chart section.
  4. Verify the section title reads "Spend over time" and is plain text with no chevron next to it.
  5. Tap the title and verify nothing happens — no dropdown or popup opens.
  6. Verify the Spend over time chart renders.
  7. Open the three dot menu and select View.
  8. Verify the app navigates to Spend over time in the Spend tab.
  9. Switch to another tab, return to Home, and verify the section still shows Spend over time.
  10. Go to Search > Spend and verify Spend over time, Top categories, and Top merchants are listed.
  11. Sign up for a new account, pick the "Track and budget expenses" onboarding intent, create a workspace with Workflows off, and add a second member.
  12. Go to Search > Spend and verify Top spenders is not listed.
  13. Enable Workflows on that workspace and verify Top spenders appears.
  • Verify that no errors appear in the JS console

Offline tests

  1. Open Home while online and let the Spend over time chart load.
  2. Turn off the network connection.
  3. Reload the app and open Home.
  4. Verify the section shows the last fetched chart data.
  5. Clear the cache, stay offline, and open Home.
  6. Verify the section shows the "You appear to be offline" placeholder.

QA Steps

  1. Log in to an account that is an admin, auditor, or approver on at least one workspace.
  2. Create an expense dated in the previous calendar month.
  3. Open Home on iOS and scroll to the chart section.
  4. Verify the section title reads "Spend over time" with no chevron.
  5. Tap the title and verify no dropdown opens and the app does not crash.
  6. Verify the Spend over time chart renders.
  7. Repeat steps 3 to 6 on Android, iOS mWeb Safari, Android mWeb Chrome, and MacOS Chrome.
  8. Go to Search > Spend and verify the insight searches still open and render their charts.
  • 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 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: Native

Not yet tested — needs manual QA.

Android: mWeb Chrome

Not yet tested — needs manual QA.

iOS: Native

Not yet tested — needs manual QA.

iOS: mWeb Safari

Not yet tested — needs manual QA.

MacOS: Chrome / Safari

Not yet tested — needs manual QA.

…e-insight-switcher"

This reverts commit a7d6923, reversing
changes made to 9ba579bbbd3e7f5b7d9b2e0e2f8e5d8e6b4a3c1d.

Reverted to fix the iOS crash reported in
#98331, where selecting Top
merchants in the Home Insights dropdown crashes the app.

Conflict in config/eslint/eslint.seatbelt.tsv resolved by restoring the
no-unsafe-type-assertion entry for SpendOverTimeSection/useSpendOverTimeData.ts,
which the restored file still needs.
@github-actions

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/components/Icon/chunks/illustrations.chunk.ts 0.00% <ø> (ø)
src/components/WidgetContainer.tsx 100.00% <100.00%> (ø)
src/libs/ExportOnyxState/common.ts 80.35% <ø> (ø)
src/libs/SearchUIUtils.ts 65.95% <100.00%> (-0.77%) ⬇️
src/pages/home/HomePage.tsx 100.00% <ø> (ø)
src/pages/home/SpendOverTimeSection/index.tsx 83.33% <66.66%> (ø)
.../home/SpendOverTimeSection/useSpendOverTimeData.ts 37.50% <66.66%> (ø)
...endOverTimeSection/SpendOverTimeSectionContent.tsx 0.00% <0.00%> (ø)
... and 16 files with indirect coverage changes

@mountiny mountiny changed the title Revert "Add insight-switcher dropdown to the chart slot in Home" [CP Staging] Revert "Add insight-switcher dropdown to the chart slot in Home" Aug 11, 2026
@mountiny
mountiny marked this pull request as ready for review August 11, 2026 19:35
@mountiny
mountiny requested review from a team as code owners August 11, 2026 19:35
@melvin-bot

melvin-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

@ZhenjaHorbach 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 and garrettmknight August 11, 2026 19:35
@mountiny

Copy link
Copy Markdown
Contributor Author

Asked QA to test if the blocker is resolved https://expensify.slack.com/archives/C09V78U42D8/p1786475915905869

@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: 6fd1f31aa0

ℹ️ 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/SearchUIUtils.ts
Comment on lines 1022 to 1025
{
sortBy: CONST.SEARCH.TABLE_COLUMNS.GROUP_TOTAL,
sortOrder: CONST.SEARCH.SORT_ORDER.DESC,
limit: CONST.SEARCH.TOP_SEARCH_LIMIT,
},

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 Top spenders capped to top results

When an admin opens Search > Spend > Top spenders in a workspace with many submitters, this canned query now omits the CONST.SEARCH.TOP_SEARCH_LIMIT cap that the parent query had and that the other top-* suggestions still use. That makes the “Top spenders” shortcut fetch and render every grouped spender for the last month instead of just the top slice, which regresses the expected top-results behavior and can make this suggested search much heavier for large workspaces.

Useful? React with 👍 / 👎.

@mountiny

Copy link
Copy Markdown
Contributor Author

Closing in favour of #98354

@mountiny mountiny closed this Aug 12, 2026
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.

1 participant