Skip to content

[No QA] Fix typecheck on main: widen static search tab keys for saved searches - #97370

Merged
mountiny merged 1 commit into
mainfrom
vit-fix-typecheck-static-search-tabs
Jul 29, 2026
Merged

[No QA] Fix typecheck on main: widen static search tab keys for saved searches#97370
mountiny merged 1 commit into
mainfrom
vit-fix-typecheck-static-search-tabs

Conversation

@mountiny

@mountiny mountiny commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

typecheck is failing on main because of a merge race between two PRs that were green independently:

SearchKey is ValueOf<typeof CONST.SEARCH.SEARCH_KEYS> | \${typeof CONST.SEARCH.SAVED_SEARCH_PREFIX}${string}`, and saved searches are keyed by their bare hash (e.g. "1234567"), not by a savedSearch_`-prefixed key — nothing in the codebase constructs that prefixed form. So the push at StaticSearchTypeMenu.tsx:82 fails:

src/pages/Search/SearchPageNarrow/StaticSearchTypeMenu.tsx(82,20): error TS2322: Type 'string' is not assignable to type 'SearchKey'.

This widens the local annotation back to TabSelectorBaseItem[], which is the type the consumer already expects — SearchTypeMenuNarrowContent declares tabs: TabSelectorBaseItem[] and activeTabKey: string. This is a type-only change with no runtime effect.

The alternative would be to prefix the saved-search tab key with CONST.SEARCH.SAVED_SEARCH_PREFIX to satisfy SearchKey. I did not do that because it would change the runtime key format in the static twin only: the interactive SearchTypeMenuNarrow uses the raw hash as the saved-search tab key, and StaticSearchTypeMenu is explicitly documented as a static twin that must stay identical to the interactive version.

Fixed Issues

$ #97368

PROPOSAL:

Tests

  1. Run npm run typecheck and verify it completes with no errors.
  2. Run npx jest tests/ui/components/SearchTypeMenuSavedSearchHighlightTest.tsx and verify all 4 tests pass.
  3. On a narrow screen (mWeb or native), open Reports, save a search via the search filters, then navigate to that saved search.
  4. Verify the saved search's tab appears in the narrow tab bar with a bookmark icon and is highlighted as the selected tab.
  5. Tap the Reports and Expenses tabs and verify the highlight moves to the tapped tab and the correct results load.
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline.
  2. On a narrow screen, open a saved search and verify its tab is still shown and highlighted.
  3. Delete that saved search while offline and verify the tab remains visible with the pending (greyed out) styling.
  4. Go back online and verify the deleted saved search's tab disappears.
  • Verify that no errors appear in the JS console

QA Steps

Same as tests — this is a type-only change with no runtime effect, so no QA is required.

  • 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.

@mountiny
mountiny marked this pull request as ready for review July 29, 2026 18:46
@mountiny
mountiny requested review from a team as code owners July 29, 2026 18:46
@melvin-bot
melvin-bot Bot requested review from abzokhattab and joekaufmanexpensify and removed request for a team July 29, 2026 18:46
@melvin-bot

melvin-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

@abzokhattab 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 July 29, 2026 18:47
@mountiny
mountiny merged commit 39d8f7d into main Jul 29, 2026
47 checks passed
@mountiny
mountiny deleted the vit-fix-typecheck-static-search-tabs branch July 29, 2026 18:55
@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

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.46-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site changes required

I reviewed the changes in this PR and no updates to Expensify's help site (docs/articles) are needed.

This is a type-only change: it widens a local TypeScript annotation in StaticSearchTypeMenu.tsx from Array<TabSelectorBaseItem<SearchKey>> to TabSelectorBaseItem[] to fix a typecheck failure on main. As the PR description itself states, there is no runtime effect — no user-facing behavior, feature, tab label, setting, or button changed. Help site articles document product behavior, and none of that is affected here.

No draft docs PR was created since there are no help site changes to make.

@mountiny, since this is a type-only change with no runtime effect, there's no linked help site PR to review — nothing on the help site needs updating for this change.

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