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 in-flight being unable to track event requests made by cloned clients #1881

Merged
merged 2 commits into from
Dec 7, 2022

Conversation

imjoehaines
Copy link
Contributor

Goal

The in-flight package was unable to track event requests made by cloned clients because the _notify monkey patch was not copied over to the clones. This is actually a good thing because the monkey patch holds onto a reference to the original client, so it would have been broken even if the clone got the patch

I've added support for "on clone callbacks" in clone-client, which other packages can register to be notified when a client is cloned. The in-flight package can then register a callback to patch any new clones

This was only a problem for events as the session request tracking is done via the session delegate and this is copied straight onto the clone, so is shared by both clients

Base automatically changed from clone-client-unit-tests to next December 6, 2022 17:33
This allows plugins to make changes to any new clones, which may be
necessary if they are monkey patching clients
clone-client doesn't copy over monkey patched methods on to new clones¹,
so we have to hook into the cloning process to monkey patch them

¹ This is actually a good thing as monkey patched methods will usually
work by holding a reference to an old client to call the un-patched
method. If we copied them over then they would still reference the
original client, not the clone
@github-actions
Copy link

github-actions bot commented Dec 6, 2022

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 43.19 kB 13.21 kB
After 43.19 kB 13.21 kB
± No change No change

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against 65642a8

@imjoehaines imjoehaines merged commit 9f64bf1 into next Dec 7, 2022
@imjoehaines imjoehaines deleted the in-flight-cloned-clients branch December 7, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants