Skip to content

Commit 4b4d9ad

Browse files
committed
Remove FID wait timeout on OOB trace send. This gets sent at first unload now, so no need to add additional timeouts.
1 parent 865da93 commit 4b4d9ad

File tree

2 files changed

+7
-47
lines changed

2 files changed

+7
-47
lines changed

packages/performance/src/services/oob_resources_service.test.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -250,30 +250,6 @@ describe('Firebase Performance > oob_resources_service', () => {
250250
);
251251
});
252252

253-
it('waits for first input delay if polyfill is available', () => {
254-
getIidStub.returns(MOCK_ID);
255-
const api = Api.getInstance();
256-
//@ts-ignore Assignment to read-only property.
257-
api.onFirstInputDelay = stub();
258-
setupOobResources(performanceController);
259-
clock.tick(1);
260-
261-
// Force the page load event to be sent
262-
stub(mockWindow.document, 'visibilityState').value('hidden');
263-
callEventListener('visibilitychange');
264-
265-
expect(api.onFirstInputDelay).to.be.called;
266-
expect(createOobTraceStub).not.to.be.called;
267-
clock.tick(5000);
268-
expect(createOobTraceStub).to.be.calledWithExactly(
269-
performanceController,
270-
[NAVIGATION_PERFORMANCE_ENTRY],
271-
[PAINT_PERFORMANCE_ENTRY],
272-
{},
273-
undefined
274-
);
275-
});
276-
277253
it('logs first input delay if polyfill is available and callback is called', () => {
278254
getIidStub.returns(MOCK_ID);
279255
const api = Api.getInstance();

packages/performance/src/services/oob_resources_service.ts

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ import { WebVitalMetrics } from '../resources/web_vitals';
3030
import { Api } from './api_service';
3131
import { getIid } from './iid_service';
3232

33-
const FID_WAIT_TIME_MS = 5000;
34-
3533
let webVitalMetrics: WebVitalMetrics = {};
3634
let sentPageLoadTrace: boolean = false;
3735
let firstInputDelay: number | undefined;
@@ -147,27 +145,13 @@ function sendOobTrace(performanceController: PerformanceController): void {
147145
'navigation'
148146
) as PerformanceNavigationTiming[];
149147
const paintTimings = api.getEntriesByType('paint');
150-
// If First Input Delay polyfill is added to the page, report the fid value.
151-
// https://github.com/GoogleChromeLabs/first-input-delay
152-
if (api.onFirstInputDelay && !firstInputDelay) {
153-
setTimeout(() => {
154-
Trace.createOobTrace(
155-
performanceController,
156-
navigationTimings,
157-
paintTimings,
158-
webVitalMetrics,
159-
firstInputDelay
160-
);
161-
}, FID_WAIT_TIME_MS);
162-
} else {
163-
Trace.createOobTrace(
164-
performanceController,
165-
navigationTimings,
166-
paintTimings,
167-
webVitalMetrics,
168-
firstInputDelay
169-
);
170-
}
148+
Trace.createOobTrace(
149+
performanceController,
150+
navigationTimings,
151+
paintTimings,
152+
webVitalMetrics,
153+
firstInputDelay
154+
);
171155
}
172156
}
173157

0 commit comments

Comments
 (0)