-
Notifications
You must be signed in to change notification settings - Fork 129
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 angular wrap detection in rrweb #1543
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
patches/@[email protected]
Outdated
+const isFunction = (x) => typeof x === 'function'; | ||
+const isNativeFunction = () => isFunction(x) && x.toString().includes("[native code]"); | ||
+const isAngularZonePatchedFunction = (x) => { | ||
+ if (!isFunction(x)) { | ||
+ return false; | ||
+ } | ||
+ const prototypeKeys = Object.getOwnPropertyNames(x.prototype || {}); | ||
+ return prototypeKeys.some((key) => key.indexOf('__zone')); | ||
+} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copies these three functions from posthog-js that are already being used in #1531
patches/@[email protected]
Outdated
+ let isUntainted = isNativeFunction(candidate); | ||
+ if (key === 'MutationObserver') { | ||
+ isUntainted = isUntainted && !isAngularZonePatchedFunction(candidate); | ||
+ } | ||
+ return isUntainted; | ||
+ }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when testing mutation observer it has to be native code and not have angular zone prototypes
Size Change: +1.04 kB (+0.03%) Total Size: 3.12 MB
ℹ️ View Unchanged
|
|
113a71e
to
702929a
Compare
follow-up to #1531 which fixed this for dead clicks
patch rrweb to correctly detect angular's change detection
🎉 tested locally by installing patched version in an angular application and seeing it no longer freezes 🎉
also opened upstream PR here rrweb-io/rrweb#1597