Fix: Text Report title and Customize report titles are not grayed out while creating workspace in offline#77719
Conversation
… while creating workspace in offline
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
… while creating workspace in offline
|
@QichenZhu 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] |
| <Section | ||
| isCentralPane | ||
| title={translate('workspace.common.reportTitle')} | ||
| renderTitle={() => ( |
There was a problem hiding this comment.
❌ PERF-4 (docs)
Creating a new inline arrow function for renderTitle on every render creates a new function reference, which can cause unnecessary re-renders of the Section component even when the actual content hasn't changed.
Suggested fix: Memoize the renderTitle function using useCallback:
const renderReportTitle = useCallback(
() => (
<OfflineWithFeedback pendingAction={policy?.pendingAction}>
<Text style={[styles.textHeadline, styles.cardSectionTitle, styles.accountSettingsSectionTitle, styles.mb1]}>
{translate('workspace.common.reportTitle')}
</Text>
</OfflineWithFeedback>
),
[policy?.pendingAction, styles.textHeadline, styles.cardSectionTitle, styles.accountSettingsSectionTitle, styles.mb1, translate],
);
// Then use it as:
<Section
renderTitle={renderReportTitle}
// ...
/>| </Text> | ||
| </OfflineWithFeedback> | ||
| )} | ||
| renderSubtitle={() => ( |
There was a problem hiding this comment.
❌ PERF-4 (docs)
Creating a new inline arrow function for renderSubtitle on every render creates a new function reference, which can cause unnecessary re-renders of the Section component even when the actual content hasn't changed.
Suggested fix: Memoize the renderSubtitle function using useCallback:
const renderReportSubtitle = useCallback(
() => (
<OfflineWithFeedback pendingAction={policy?.pendingAction}>
<View style={[[styles.renderHTML, styles.mt1]]}>
<RenderHTML html={translate('workspace.reports.customReportNamesSubtitle')} />
</View>
</OfflineWithFeedback>
),
[policy?.pendingAction, styles.renderHTML, styles.mt1, translate],
);
// Then use it as:
<Section
renderSubtitle={renderReportSubtitle}
// ...
/>|
@QichenZhu I added an additional MacOS-Chrome.mp4 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-native.webmAndroid: mWeb Chromeandroid-web.webmiOS: HybridAppios-native.moviOS: mWeb Safariios-web.movMacOS: Chrome / Safarimac-web.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/NikkiWines in version: 9.2.82-0 🚀
|
|
🚀 Deployed to staging by https://github.com/NikkiWines in version: 9.2.82-0 🚀
|
|
🚀 Deployed to staging by https://github.com/NikkiWines in version: 9.2.82-0 🚀
|
|
🚀 Deployed to staging by https://github.com/NikkiWines in version: 9.2.84-0 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.2.84-8 🚀
|
Explanation of Change
Wrap the Report section header with
OfflineWithFeedbackto make the title and subtitle greyed out when the workspace has a pending actionFixed Issues
$ #77385
PROPOSAL: #77385 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
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-Native.mp4
Android: mWeb Chrome
Android-mWeb.Chrome.mp4
iOS: Native
iOS-Native.mp4
iOS: mWeb Safari
iOS-mWeb.Safari.mp4
MacOS: Chrome / Safari
MacOS-Chrome.mp4