Skip to content

Commit 3b890ce

Browse files
committed
[Tracks] Annotate rnPerfIssue for Cascading Updates in DEV
1 parent 6160773 commit 3b890ce

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/react-reconciler/src/ReactFiberPerformanceTrack.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ const reusableComponentOptions: PerformanceMeasureOptions = {
203203

204204
const reusableChangedPropsEntry = ['Changed Props', ''];
205205

206+
const reusableCascadingUpdateIssue = {
207+
name: 'React: Cascading Update',
208+
severity: 'warning',
209+
description:
210+
'A cascading update is a update that is triggered by a previous update. This can lead to performance issues and should be avoided.',
211+
learnMoreUrl:
212+
'https://react.dev/reference/dev-tools/react-performance-tracks#cascading-updates',
213+
};
214+
206215
const DEEP_EQUALITY_WARNING =
207216
'This component received deeply equal props. It might benefit from useMemo or the React Compiler in its owner.';
208217

@@ -761,6 +770,10 @@ export function logBlockingStart(
761770
},
762771
},
763772
};
773+
if (label === 'Cascading Update') {
774+
// $FlowFixMe[prop-missing] - detail is untyped
775+
measureOptions.detail.rnPerfIssue = reusableCascadingUpdateIssue;
776+
}
764777

765778
if (debugTask) {
766779
debugTask.run(

0 commit comments

Comments
 (0)