Repository navigation
[No QA] Add reasonAttributes to MoneyReportHeaderStatusBarSkeleton usage sites - #83693
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.
|
|
@bernhardoj 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3ff1dad0e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| const showNextStepSkeleton = shouldShowNextStep && !optimisticNextStep && !!isLoadingInitialReportActions && !isOffline; | ||
| const shouldShowMoreContent = showNextStepBar || showNextStepSkeleton || !!statusBarProps || isReportInSearch; | ||
|
|
||
| const nextStepSkeletonReasonAttributes: SkeletonSpanReasonAttributes = { |
There was a problem hiding this comment.
Memoize reasonAttributes object before passing to skeleton
nextStepSkeletonReasonAttributes is recreated on every render, so while the skeleton is mounted useSkeletonSpan treats it as changed each time and repeatedly runs the [reasonAttributes, spanId] effect that calls span.addEvent(...) (src/libs/telemetry/useSkeletonSpan.ts). In MoneyReportHeader, which rerenders frequently from Onyx/state updates, this can generate noisy telemetry and unnecessary work even when the boolean values are unchanged.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
These components are inside the React Compiler boundary — manual useMemo is not needed here.
| const shouldShowAccessPlaceHolder = !iouReport && !shouldShowLoading; | ||
| const shouldShowEmptyPlaceholder = transactions.length === 0 && !shouldShowLoading; | ||
| const showStatusAndSkeleton = !shouldShowEmptyPlaceholder; | ||
| const skeletonReasonAttributes: SkeletonSpanReasonAttributes = { |
There was a problem hiding this comment.
Memoize preview skeleton reasonAttributes to avoid event spam
skeletonReasonAttributes is defined as a fresh object each render, which causes useSkeletonSpan's reasonAttributes effect to fire on every rerender and append EVENT_SKELETON_ATTRIBUTES_UPDATE repeatedly even when values did not change. In this preview component, frequent parent updates while loading can flood span events and reduce signal quality for the telemetry this change is meant to improve.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
These components are inside the React Compiler boundary — manual useMemo is not needed here.
| context: 'MoneyReportHeader', | ||
| shouldShowNextStep, | ||
| isLoadingInitialReportActions: !!isLoadingInitialReportActions, | ||
| isOffline, |
There was a problem hiding this comment.
Do we want to add hasOptimisticNextStep here?
hasOptimisticNextStep: !!optimisticNextStepThere was a problem hiding this comment.
Done — added hasOptimisticNextStep: !!optimisticNextStep.
| context: 'MoneyRequestReportPreviewContent', | ||
| shouldShowSkeleton, | ||
| showStatusAndSkeleton, | ||
| shouldShowLoading, |
There was a problem hiding this comment.
I think we can add this instead, since all 3 above depend on the data below. WDYT?
hasOnceLoadedReportActions: chatReportMetadata?.hasOnceLoadedReportActions,
isTransactionsEmpty: transactions.length === 0,
isOptimisticReport: chatReportMetadata?.isOptimisticReport,There was a problem hiding this comment.
Good call — switched to the three root conditions (hasOnceLoadedReportActions, isTransactionsEmpty, isOptimisticReport) that drive shouldShowLoading.
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb Safari |
|
|
||
| const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {selector: reportAttributesSelector}); | ||
| const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, { | ||
| selector: reportAttributesSelector, |
There was a problem hiding this comment.
Are all of this formatting from prettier?
There was a problem hiding this comment.
yes, lately something in prettier changed and there are a lot of formating changes in every PR I make
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @youssef-lr 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/youssef-lr in version: 9.3.31-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.31-12 🚀
|


Explanation of Change
Added
reasonAttributesto the two remaining usage sites ofMoneyReportHeaderStatusBarSkeleton:MoneyReportHeader.tsx- passes context'MoneyReportHeader'along with the boolean state variablesshouldShowNextStep,isLoadingInitialReportActions, andisOfflinethat together control whether the skeleton is shown.MoneyRequestReportPreviewContent.tsx- passes context'MoneyRequestReportPreviewContent'along withshouldShowSkeleton,showStatusAndSkeleton, andshouldShowLoading.These attributes are forwarded to Sentry spans via
useSkeletonSpan, improving observability and making it easier to debug infinite/unexpected skeleton loading states in production.Fixed Issues
$ #83399
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
Same as tests
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