Skip to content

fix(web-vitals): Add error handling for invalid object keys in WeakMap #18810

@github-actions

Description

@github-actions

Note

The pull request "fix(web-vitals): Add error handling for invalid object keys in WeakMap" was created by @s1gr1d but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.

A customer experienced the following issue on iOS Safari 18.6.2: TypeError: WeakMap keys must be objects or non-registered symbols.

The culprit is probably in web vitals initUnique function (which is vendored in).

This fix adds a try/catch to handle edge cases where invalid keys are passed to WeakMap, returning a new instance without caching when validation fails.

Metadata

Metadata

Assignees

Labels

No labels
No labels
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions