@@ -3315,6 +3315,7 @@ export function attach(
33153315 }
33163316 let start = -1;
33173317 let end = -1;
3318+ let byteSize = 0;
33183319 // $FlowFixMe[method-unbinding]
33193320 if (typeof performance.getEntriesByType === 'function') {
33203321 // We may be able to collect the start and end time of this resource from Performance Observer.
@@ -3324,6 +3325,8 @@ export function attach(
33243325 if (resourceEntry.name === href) {
33253326 start = resourceEntry.startTime;
33263327 end = start + resourceEntry.duration;
3328+ // $FlowFixMe[prop-missing]
3329+ byteSize = (resourceEntry.encodedBodySize: any) || 0;
33273330 }
33283331 }
33293332 }
@@ -3339,6 +3342,10 @@ export function attach(
33393342 // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
33403343 owner: fiber, // Allow linking to the <link> if it's not filtered.
33413344 };
3345+ if (byteSize > 0) {
3346+ // $FlowFixMe[cannot-write]
3347+ ioInfo.byteSize = byteSize;
3348+ }
33423349 const asyncInfo: ReactAsyncInfo = {
33433350 awaited: ioInfo,
33443351 // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
@@ -3403,7 +3410,7 @@ export function attach(
34033410 }
34043411 let start = -1;
34053412 let end = -1;
3406- let fileSize = 0;
3413+ let byteSize = 0;
34073414 // $FlowFixMe[method-unbinding]
34083415 if (typeof performance.getEntriesByType === 'function') {
34093416 // We may be able to collect the start and end time of this resource from Performance Observer.
@@ -3414,7 +3421,7 @@ export function attach(
34143421 start = resourceEntry.startTime;
34153422 end = start + resourceEntry.duration;
34163423 // $FlowFixMe[prop-missing]
3417- fileSize = (resourceEntry.encodedBodySize: any) || 0;
3424+ byteSize = (resourceEntry.encodedBodySize: any) || 0;
34183425 }
34193426 }
34203427 }
@@ -3433,10 +3440,6 @@ export function attach(
34333440 value.naturalWidth = instance.naturalWidth;
34343441 value.naturalHeight = instance.naturalHeight;
34353442 }
3436- if (fileSize > 0) {
3437- // Cross-origin images won't have a file size that we can access.
3438- value.fileSize = fileSize;
3439- }
34403443 const promise = Promise.resolve(value);
34413444 (promise: any).status = 'fulfilled';
34423445 (promise: any).value = value;
@@ -3448,6 +3451,12 @@ export function attach(
34483451 // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
34493452 owner: fiber, // Allow linking to the <link> if it's not filtered.
34503453 };
3454+ if (byteSize > 0) {
3455+ // Cross-origin images won't have a file size that we can access.
3456+ value.fileSize = byteSize;
3457+ // $FlowFixMe[cannot-write]
3458+ ioInfo.byteSize = byteSize;
3459+ }
34513460 const asyncInfo: ReactAsyncInfo = {
34523461 awaited: ioInfo,
34533462 // $FlowFixMe: This field doesn't usually take a Fiber but we're only using inside this file.
@@ -5778,6 +5787,7 @@ export function attach(
57785787 description: getIODescription(resolvedValue),
57795788 start: ioInfo.start,
57805789 end: ioInfo.end,
5790+ byteSize: ioInfo.byteSize == null ? null : ioInfo.byteSize,
57815791 value: ioInfo.value == null ? null : ioInfo.value,
57825792 env: ioInfo.env == null ? null : ioInfo.env,
57835793 owner:
0 commit comments