[No QA] Fix typecheck on main: widen static search tab keys for saved searches - #97370
Conversation
|
@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] |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.46-0 🚀
|
No help site changes requiredI reviewed the changes in this PR and no updates to Expensify's help site ( This is a type-only change: it widens a local TypeScript annotation in 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. |
Explanation of Change
typecheckis failing onmainbecause of a merge race between two PRs that were green independently:tabsannotation inStaticSearchTypeMenutoArray<TabSelectorBaseItem<SearchKey>>.SearchKeyisValueOf<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 asavedSearch_`-prefixed key — nothing in the codebase constructs that prefixed form. So the push at StaticSearchTypeMenu.tsx:82 fails:This widens the local annotation back to
TabSelectorBaseItem[], which is the type the consumer already expects —SearchTypeMenuNarrowContentdeclarestabs: TabSelectorBaseItem[]andactiveTabKey: 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_PREFIXto satisfySearchKey. I did not do that because it would change the runtime key format in the static twin only: the interactiveSearchTypeMenuNarrowuses the raw hash as the saved-search tab key, andStaticSearchTypeMenuis explicitly documented as a static twin that must stay identical to the interactive version.Fixed Issues
$ #97368
PROPOSAL:
Tests
npm run typecheckand verify it completes with no errors.npx jest tests/ui/components/SearchTypeMenuSavedSearchHighlightTest.tsxand verify all 4 tests pass.Offline tests
QA Steps
Same as tests — this is a type-only change with no runtime effect, so no QA is required.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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.