Skip to content

Commit 740f9a3

Browse files
committed
Allow 0x0 viewport in browser context to avoid schema validation errors (#1365)
1 parent 426269c commit 740f9a3

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@snowplow/browser-tracker-core",
5+
"comment": "Allow 0x0 viewport in browser context to avoid schema validation errors",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@snowplow/browser-tracker-core"
10+
}

libraries/browser-tracker-core/src/helpers/browser_props.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,7 @@ function detectViewport() {
103103
height = e['clientHeight'];
104104
}
105105

106-
if (width >= 0 && height >= 0) {
107-
return width + DIMENSION_SEPARATOR + height;
108-
} else {
109-
return null;
110-
}
106+
return Math.max(0, width) + DIMENSION_SEPARATOR + Math.max(0, height);
111107
}
112108

113109
/**

0 commit comments

Comments
 (0)