[no QA] Remove Onyx.connect() for the RAM_ONLY_ARE_TRANSLATIONS_LOADING key part 1#91996
[no QA] Remove Onyx.connect() for the RAM_ONLY_ARE_TRANSLATIONS_LOADING key part 1#91996daledah wants to merge 2 commits into
Conversation
|
@shubham1206agra 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] |
| const shouldRenderHTML = archiveReason !== CONST.REPORT.ARCHIVE_REASON.DEFAULT && archiveReason !== CONST.REPORT.ARCHIVE_REASON.BOOKING_END_DATE_HAS_PASSED; | ||
|
|
||
| let policyName = getPolicyName({report}); | ||
| let policyName = getPolicyName({report, unavailableTranslation: translate('workspace.common.unavailable')}); |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The expression translate('workspace.common.unavailable') is duplicated across 5 call sites (ArchivedReportFooter, ReportWelcomeText, DynamicReportDetailsPage, ShareCodePage, HeaderView), and more callers exist within ReportUtils.ts that will need the same treatment in future parts of this migration.
Consider having getPolicyName accept the translate function directly and call translate('workspace.common.unavailable') internally, or create a wrapper hook like useGetPolicyName that encapsulates this. This would eliminate the repeated boilerplate at every call site:
// Option A: accept translate function
function getPolicyName({report, translate, ...}: GetPolicyNameParams): string {
const noPolicyFound = returnEmptyIfNotFound ? '' : (translate?.('workspace.common.unavailable') ?? unavailableTranslation);
...
}
// Option B: wrapper hook
function useGetPolicyName(params: Omit<GetPolicyNameParams, 'unavailableTranslation'>) {
const {translate} = useLocalize();
return getPolicyName({...params, unavailableTranslation: translate('workspace.common.unavailable')});
}Reviewed at: b2d18b0 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
I’ll double-check whether using this translation affects performance and will share an update soon.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Explanation of Change
Fixed Issues
$ #66430
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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