Skip to content

Commit 14c34d4

Browse files
committed
feat: include web-vitals#634
1 parent 39bd747 commit 14c34d4

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

packages/browser-utils/src/metrics/web-vitals/types/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export interface ReportOpts {
116116
}
117117

118118
export interface AttributionReportOpts extends ReportOpts {
119-
generateTarget?: (el: Node | null) => string;
119+
generateTarget?: (el: Node | null) => string | undefined;
120120
}
121121

122122
/**

packages/browser-utils/src/metrics/web-vitals/types/cls.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export interface CLSAttribution {
3434
* By default, a selector identifying the first element (in document order)
3535
* that shifted when the single largest layout shift that contributed to the
3636
* page's CLS score occurred. If the `generateTarget` configuration option
37-
* was passed, then this will instead be the return value of that function.
37+
* was passed, then this will instead be the return value of that function,
38+
* falling back to the default if that returns null or undefined.
3839
*/
3940
largestShiftTarget?: string;
4041
/**

packages/browser-utils/src/metrics/web-vitals/types/inp.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export interface INPAttribution {
6060
* occurred. If this value is an empty string, that generally means the
6161
* element was removed from the DOM after the interaction. If the
6262
* `generateTarget` configuration option was passed, then this will instead
63-
* be the return value of that function.
63+
* be the return value of that function, falling back to the default if that
64+
* returns null or undefined.
6465
*/
6566
interactionTarget: string;
6667
/**

packages/browser-utils/src/metrics/web-vitals/types/lcp.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export interface LCPAttribution {
3434
* By default, a selector identifying the element corresponding to the
3535
* largest contentful paint for the page. If the `generateTarget`
3636
* configuration option was passed, then this will instead be the return
37-
* value of that function.
37+
* value of that function, falling back to the default if that returns null
38+
* or undefined.
3839
*/
3940
target?: string;
4041
/**

0 commit comments

Comments
 (0)