Add performance marker for Fast Refresh update (#56176)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56176

NOTE: Resubmission of D84624705.

Adds a prominent vertical "Fast Refresh ⚛︎" marker entry in the performance timeline when a Fast Refresh update is complete.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D97486551

fbshipit-source-id: 4c70b674370bab06f02e8d356bbd2979c9686a44
This commit is contained in:
Alex Hunt authored and meta-codesync[bot] committed 2026-03-20 12:25:07 -07:00
1 parent caf168f309
commit 2771f90dd2
1 file changed
+15 -1
+15 -1
View File
@@ -212,6 +212,7 @@ Error: ${e.message}`;
});
let pendingUpdatesCount = 0;
let lastMarkerChangeId: string | null = null;
client.on('update-start', ({isInitialUpdate}) => {
pendingUpdatesCount++;
currentCompileErrorMessage = null;
@@ -229,10 +230,23 @@ Error: ${e.message}`;
}
});
client.on('update-done', () => {
client.on('update-done', body => {
pendingUpdatesCount--;
if (pendingUpdatesCount === 0) {
DevLoadingView.hide();
const changeId = body?.changeId;
if (changeId != null && changeId !== lastMarkerChangeId) {
lastMarkerChangeId = changeId;
performance.mark('Fast Refresh - Update done', {
detail: {
devtools: {
dataType: 'marker',
color: 'primary',
tooltipText: 'Fast Refresh \u269b',
},
},
});
}
}
});