Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: patch to angular detection in rrweb #1566

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

pauldambra
Copy link
Member

It's really hard to reproduce the bug, and in the one site where I can reproduce it it's really hard to debug what's happening.

Explanation in-line in the review, but this is an attempt to make this detection safer in Safari

Copy link

vercel bot commented Nov 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Nov 27, 2024 11:58am

Comment on lines +11 to +19
+ try {
+ if (!isFunction(x)) {
+ return false;
+ }
+ const prototypeKeys = Object.getOwnPropertyNames(x.prototype || {});
+ return prototypeKeys.some((key) => key.indexOf('__zone'));
+ } catch {
+ // we've seen some intermittent problems in Safari since introducing this check
+ return false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the new thing, so let's wrap it and return false
very speculative

Comment on lines +38 to +43
- if (!untaintedObject) return defaultPrototype;
+ if (!untaintedObject) return defaultObj.prototype;
return untaintedBasePrototype$1[key] = untaintedObject;
} catch {
- return defaultPrototype;
+ return defaultObj.prototype;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we return slightly different things on different lines
we didn't change this but it's nicer to always return the same thing
NB in a site where I could reproduce the problem it was if (!untaintedObject) return defaultPrototype; that was returning

Copy link

Size Change: +357 B (+0.01%)

Total Size: 3.17 MB

Filename Size Change
dist/all-external-dependencies.js 206 kB +51 B (+0.02%)
dist/array.full.js 360 kB +51 B (+0.01%)
dist/array.full.no-external.js 359 kB +51 B (+0.01%)
dist/module.full.js 360 kB +51 B (+0.01%)
dist/module.full.no-external.js 359 kB +51 B (+0.01%)
dist/recorder-v2.js 115 kB +51 B (+0.04%)
dist/recorder.js 115 kB +51 B (+0.04%)
ℹ️ View Unchanged
Filename Size
dist/array.full.es5.js 257 kB
dist/array.js 174 kB
dist/array.no-external.js 173 kB
dist/customizations.full.js 12.2 kB
dist/dead-clicks-autocapture.js 14.3 kB
dist/exception-autocapture.js 9.37 kB
dist/external-scripts-loader.js 2.29 kB
dist/main.js 175 kB
dist/module.js 175 kB
dist/module.no-external.js 173 kB
dist/surveys-preview.js 57.6 kB
dist/surveys.js 63.2 kB
dist/tracing-headers.js 1.75 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

@pauldambra pauldambra added the bump patch Bump patch version when this PR gets merged label Nov 27, 2024
@pauldambra pauldambra merged commit 6904859 into main Nov 27, 2024
17 checks passed
@pauldambra pauldambra deleted the fix/angular-detection-in-rrweb-2 branch November 27, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants