[Payment due @DylanDylann] [NO QA] [Phase 2 of #66427, Sub-PR 1/5] Mark current getReportName to be deprecated method#96155
Conversation
…apper
getReportName only ever read one field from the whole ReportAttributes Record
it accepted, forcing callers to subscribe to every report's attributes and
re-render when any of them changed. Narrowing it to take just the name string
is an atomic signature change: the moment the 2nd param becomes `string`, ~40
callers break at once, which is too large to migrate in one reviewable PR.
Split the mechanical part ("make getReportName misuse-proof") from the real
per-site work ("migrate each caller"), and enforce at both levels:
- getReportName is now string-only, `(report?, derivedReportName?: string)`,
so passing a Record is rejected at compile time (TS2345).
- deprecatedGetReportName wraps it for the un-migrated call sites, resolving
`reportAttributes?.[reportID]?.reportName` and delegating. Behavior is
identical, including the `!report?.reportID -> ''` guard.
- All 44 remaining Record-form references (42 calls + 2 callback passes) now
go through the wrapper and are pinned in the seatbelt baseline, so a new
usage exceeds the recorded count and fails CI.
The @deprecated tag ratchets independently of the 112 other baselined
deprecations: the stratify processor rewrites it to a per-API rule ID,
@typescript-eslint/no-deprecated/deprecatedGetReportName. ReportActionsUtils
threads the function as a callback to break a dependency cycle, so its
parameter type propagates the deprecation under its own getReportNameCallback
rule ID, baselined separately.
Counts only ratchet down from here. Subsequent sub-PRs migrate callers to
getReportName with an O(1) name selector -- where the re-render win actually
lands -- and the final one deletes the wrapper.
Part of Expensify#66427.
…-sub1-getreportname-quarantine # Conflicts: # config/eslint/eslint.seatbelt.tsv
|
@DylanDylann 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] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
| "../../src/components/AvatarCropModal/ImageCropView.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1 | ||
| "../../src/components/AvatarCropModal/Slider.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1 | ||
| "../../src/components/AvatarSelector.tsx" "no-restricted-syntax" 2 | ||
| "../../src/components/AvatarWithDisplayName.tsx" "@typescript-eslint/no-deprecated/deprecatedGetReportName" 1 |
There was a problem hiding this comment.
@hoangzinh Could you revert this change? This file is updated automatically, so we don't need to modify it manually.
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-07-15.at.16.31.52.mov |
|
The code change looks good to me |
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
|
🎯 @DylanDylann, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
Melvin didn't work. cc @marcochavezf your turn |
|
Conflicts and eslint failing |
Rename the two remaining Record-form callers the mechanical quarantine rename missed, which were failing to compile against the now string-only getReportName signature: - ReportUtils.getReportPreviewMessageForCopy - BaseReportActionContextMenu (memberChangeLogRoomReportName) Both now call deprecatedGetReportName. Also drop the now-unused deprecatedGetReportName import from ContextMenuActions (fully migrated to the string-form getReportName), and reconcile the eslint-seatbelt baseline: +1 SplitExpenseEditPage (a caller that was never baselined), -1 ContextMenuActions (auto-tightened). Refs: Expensify#66427
Explanation of Change
Part of #66427. Phase 2, Sub-PR 1 of 5 — the quarantine step. No behavior change:
getReportNameis now string-only:(report?, derivedReportName?: string). Passing a Record is a compile error (TS2345).deprecatedGetReportName(report?, reportAttributes?), tagged@deprecated, which resolvesreportAttributes?.[reportID]?.reportNameand delegates. Behavior is identical, including the!report?.reportID → ''guard.config/eslint/eslint.seatbelt.tsv(+33 rows / 50 occurrences), so new wrapper usage exceeds the count and fails CI.Next steps
deprecatedGetReportName→getReportNameper directorysrc/components/**deprecatedGetReportName→getReportNameper directorysrc/libs/**deprecatedGetReportName→getReportNameper directorysrc/pages/**+ tests.deprecatedGetReportName; the compiler proves zero callers remain and its baseline rows go to zero.Fixed Issues
$ #66427
PROPOSAL: #66427 (comment)
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, 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
Screen.Recording.2026-07-15.at.16.15.53.mov