-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Bump Onyx to 3.0.58 [v2] #87484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mountiny
merged 5 commits into
Expensify:main
from
callstack-internal:feature/structural-sharing-cache-pr-2-v2
Apr 12, 2026
Merged
Bump Onyx to 3.0.58 [v2] #87484
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cf7e26e
Bump Onyx to 3.0.58
fabioh8010 484b7f5
Avoid mutations in Onyx Derived files
fabioh8010 2bbafd0
Fix prettier
fabioh8010 c4b3e92
fix: clone report attribute entry before mutating during error propag…
fabioh8010 bf00062
Merge branch 'main' into feature/structural-sharing-cache-pr-2-v2
fabioh8010 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,95 +236,98 @@ export default createOnyxDerivedValueConfig({ | |
| } | ||
| } | ||
|
|
||
| const reportAttributes = dataToIterate.reduce<ReportAttributesDerivedValue['reports']>((acc, key) => { | ||
| // source value sends partial data, so we need an entire report object to do computations | ||
| const report = reports[key]; | ||
|
|
||
| if (!report || !isValidReport(report)) { | ||
| const reportID = key.replace(ONYXKEYS.COLLECTION.REPORT, ''); | ||
| if (acc[reportID]) { | ||
| delete acc[reportID]; | ||
| const reportAttributes = dataToIterate.reduce<ReportAttributesDerivedValue['reports']>( | ||
| (acc, key) => { | ||
| // source value sends partial data, so we need an entire report object to do computations | ||
| const report = reports[key]; | ||
|
|
||
| if (!report || !isValidReport(report)) { | ||
| const reportID = key.replace(ONYXKEYS.COLLECTION.REPORT, ''); | ||
| if (acc[reportID]) { | ||
| delete acc[reportID]; | ||
| } | ||
| return acc; | ||
| } | ||
| return acc; | ||
| } | ||
|
|
||
| const chatReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${report.chatReportID}`]; | ||
| const reportNameValuePair = reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`]; | ||
| const reportActionsList = reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`]; | ||
| const isReportArchived = isArchivedReport(reportNameValuePair); | ||
| const { | ||
| hasAnyViolations, | ||
| requiresAttention, | ||
| reportErrors, | ||
| oneTransactionThreadReportID, | ||
| actionBadge: actionGreenBadge, | ||
| actionTargetReportActionID: actionGreenTargetReportActionID, | ||
| } = generateReportAttributes({ | ||
| report, | ||
| chatReport, | ||
| reportActions, | ||
| transactionViolations, | ||
| isReportArchived, | ||
| allTransactions: transactions, | ||
| reports, | ||
| }); | ||
|
|
||
| const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`]; | ||
| const hasFieldViolations = hasVisibleReportFieldViolations(report, policy); | ||
|
|
||
| let brickRoadStatus; | ||
| let actionBadge; | ||
| let actionTargetReportActionID; | ||
| const reasonAndReportAction = SidebarUtils.getReasonAndReportActionThatHasRedBrickRoad( | ||
| report, | ||
| chatReport, | ||
| reportActionsList, | ||
| hasAnyViolations || hasFieldViolations, | ||
| reportErrors, | ||
| transactions, | ||
| transactionViolations, | ||
| !!isReportArchived, | ||
| reports, | ||
| ); | ||
| // if report has errors or violations, show red dot | ||
| if (reasonAndReportAction) { | ||
| brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR; | ||
| actionBadge = CONST.REPORT.ACTION_BADGE.FIX; | ||
| actionTargetReportActionID = reasonAndReportAction.reportAction?.reportActionID; | ||
| } | ||
| // if report does not have error, check if it should show green dot | ||
| if (brickRoadStatus !== CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR && requiresAttention) { | ||
| brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.INFO; | ||
| actionBadge = actionGreenBadge; | ||
| actionTargetReportActionID = actionGreenTargetReportActionID; | ||
| } | ||
| const chatReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${report.chatReportID}`]; | ||
| const reportNameValuePair = reportNameValuePairs?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report.reportID}`]; | ||
| const reportActionsList = reportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`]; | ||
| const isReportArchived = isArchivedReport(reportNameValuePair); | ||
| const { | ||
| hasAnyViolations, | ||
| requiresAttention, | ||
| reportErrors, | ||
| oneTransactionThreadReportID, | ||
| actionBadge: actionGreenBadge, | ||
| actionTargetReportActionID: actionGreenTargetReportActionID, | ||
| } = generateReportAttributes({ | ||
| report, | ||
| chatReport, | ||
| reportActions, | ||
| transactionViolations, | ||
| isReportArchived, | ||
| allTransactions: transactions, | ||
| reports, | ||
| }); | ||
|
|
||
| const policy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`]; | ||
| const hasFieldViolations = hasVisibleReportFieldViolations(report, policy); | ||
|
|
||
| let brickRoadStatus; | ||
| let actionBadge; | ||
| let actionTargetReportActionID; | ||
| const reasonAndReportAction = SidebarUtils.getReasonAndReportActionThatHasRedBrickRoad( | ||
| report, | ||
| chatReport, | ||
| reportActionsList, | ||
| hasAnyViolations || hasFieldViolations, | ||
| reportErrors, | ||
| transactions, | ||
| transactionViolations, | ||
| !!isReportArchived, | ||
| reports, | ||
| ); | ||
| // if report has errors or violations, show red dot | ||
| if (reasonAndReportAction) { | ||
| brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR; | ||
| actionBadge = CONST.REPORT.ACTION_BADGE.FIX; | ||
| actionTargetReportActionID = reasonAndReportAction.reportAction?.reportActionID; | ||
| } | ||
| // if report does not have error, check if it should show green dot | ||
| if (brickRoadStatus !== CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR && requiresAttention) { | ||
| brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.INFO; | ||
| actionBadge = actionGreenBadge; | ||
| actionTargetReportActionID = actionGreenTargetReportActionID; | ||
| } | ||
|
|
||
| acc[report.reportID] = { | ||
| reportName: report | ||
| ? computeReportName({ | ||
| report, | ||
| reports, | ||
| policies, | ||
| transactions, | ||
| allReportNameValuePairs: reportNameValuePairs, | ||
| personalDetailsList: personalDetails, | ||
| reportActions, | ||
| currentUserAccountID: session?.accountID ?? CONST.DEFAULT_NUMBER_ID, | ||
| currentUserLogin: session?.email ?? '', | ||
| allPolicyTags: policyTags, | ||
| }) | ||
| : '', | ||
| isEmpty: generateIsEmptyReport(report, isReportArchived), | ||
| brickRoadStatus, | ||
| requiresAttention, | ||
| actionBadge, | ||
| actionTargetReportActionID, | ||
| reportErrors, | ||
| oneTransactionThreadReportID, | ||
| }; | ||
| acc[report.reportID] = { | ||
| reportName: report | ||
| ? computeReportName({ | ||
| report, | ||
| reports, | ||
| policies, | ||
| transactions, | ||
| allReportNameValuePairs: reportNameValuePairs, | ||
| personalDetailsList: personalDetails, | ||
| reportActions, | ||
| currentUserAccountID: session?.accountID ?? CONST.DEFAULT_NUMBER_ID, | ||
| currentUserLogin: session?.email ?? '', | ||
| allPolicyTags: policyTags, | ||
| }) | ||
| : '', | ||
| isEmpty: generateIsEmptyReport(report, isReportArchived), | ||
| brickRoadStatus, | ||
| requiresAttention, | ||
| actionBadge, | ||
| actionTargetReportActionID, | ||
| reportErrors, | ||
| oneTransactionThreadReportID, | ||
| }; | ||
|
|
||
| return acc; | ||
| }, currentValue?.reports ?? {}); | ||
| return acc; | ||
| }, | ||
| currentValue?.reports ? {...currentValue.reports} : {}, | ||
| ); | ||
|
|
||
| // Propagate errors from IOU reports to their parent chat reports. | ||
| const chatReportIDsWithErrors = new Set<string>(); | ||
|
|
@@ -347,8 +350,13 @@ export default createOnyxDerivedValueConfig({ | |
| continue; | ||
| } | ||
|
|
||
| reportAttributes[chatReportID].brickRoadStatus = CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR; | ||
| reportAttributes[chatReportID].actionBadge = CONST.REPORT.ACTION_BADGE.FIX; | ||
| // Clone the entry before mutating — it may be a reference carried over from | ||
| // currentValue.reports that wasn't recomputed in this incremental run. | ||
| reportAttributes[chatReportID] = { | ||
| ...reportAttributes[chatReportID], | ||
| brickRoadStatus: CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, | ||
| actionBadge: CONST.REPORT.ACTION_BADGE.FIX, | ||
|
Comment on lines
329
to
+358
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For easy code review, these are only the changes in this file. |
||
| }; | ||
| } | ||
|
|
||
| return { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.