Skip to content

Commit 3d062df

Browse files
feat(webvitals): Adds useReplaceFidWithInpSetting hook to toggle fid vs inp in web vitals module (#64111)
Adds a `useReplaceFidWithInpSetting` hook to control replacing FID with INP in the web vitals module
1 parent 5baa3a8 commit 3d062df

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const USE_STORED_SCORES = false;
2+
export const REPLACE_FID_WITH_INP = false;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {decodeScalar} from 'sentry/utils/queryString';
2+
import {useLocation} from 'sentry/utils/useLocation';
3+
import useOrganization from 'sentry/utils/useOrganization';
4+
import {REPLACE_FID_WITH_INP} from 'sentry/views/performance/browser/webVitals/settings';
5+
6+
export function useReplaceFidWithInpSetting() {
7+
const location = useLocation();
8+
const {query} = location;
9+
const organization = useOrganization();
10+
11+
if (query.replaceFidWithInp !== undefined) {
12+
return decodeScalar(query.replaceFidWithInp) === 'true';
13+
}
14+
15+
if (organization.features.includes('starfish-browser-webvitals-replace-fid-with-inp')) {
16+
return true;
17+
}
18+
19+
return REPLACE_FID_WITH_INP;
20+
}

0 commit comments

Comments
 (0)