[No QA] Fix import/no-cycle - part 5 - #100029
Conversation
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.
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
7844faa to
5ecc26d
Compare
|
@thelullabyy 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] |
| @@ -0,0 +1,526 @@ | |||
| import type {ExpensifyIconName} from '@components/Icon/ExpensifyIconLoader'; | |||
There was a problem hiding this comment.
❌ CONSISTENCY-14 (docs)
This is a new, non-trivial module (~526 lines with several exported helpers, types, and constants), but it opens straight into imports with no header comment. A one-line description at the top orients the next reader immediately instead of forcing them to reverse-engineer the module's purpose from its exports.
Add a short header comment above the imports, for example:
/**
* Builders and helpers for the suggested searches shown in the LHN (query strings, hashes) and
* expense-status matching, split out of SearchUIUtils to avoid an import cycle.
*/
import type {ExpensifyIconName} from '@components/Icon/ExpensifyIconLoader';Reviewed at: 5ecc26d | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
Explanation of Change
src/libs/actions/IOU/SearchUpdate.tsneeds two helpers,getSuggestedSearchesandisEligibleForStatus, and it imported them fromSearchUIUtils.ts. That module is ~6,800 linesand imports back into the IOU actions, which closed a cycle:
Those two helpers only build query strings and compare status values, so I moved them and what
they depend on into a new
src/libs/SearchSuggestionUtils.ts:SEARCH_TYPE_MENU_ICON_NAMESgetSuggestedSearchesand itscreateTopSearchMenuItemhelperexpenseStatusActionMapping,isValidExpenseStatus,isEligibleForStatusSearchKeyandSearchTypeMenuItemtypesThe new module imports two things at runtime,
@src/CONSTand./SearchQueryUtils. Its othernine imports are type-only, so they carry no runtime edge.
SearchQueryUtilsimports neithersearch module, so the move adds nothing new to the graph.
SearchUpdate.tsnow imports from the new module, which takes it out of the cycle.SearchUIUtils.tsre-exports everything it exported before, so its other consumers are untouched.The code moved as-is, with no behaviour change.
npx jest tests/unit/Search/SearchUIUtilsTest.tspasses, 517 testsNothing user facing changed, so there is no QA. The suggested search list is covered by the unit
tests above.
Fixed Issues
$ #99650
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari