-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref: Rework DOM Breadcrumbs integration #3208
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
Conversation
size-limit report
|
This looks great! (Sorry, I should have added all of my suggestions as comments under a single review, so you'd see this first.) Other than the stuff above (which is mostly only word-smithing and clarification of comments), my only feedback is that, like we talked about in our retro, it'd be great to have a few sentences in the PR description summarizing the overall problem this fixes and how the changes here solve it. |
Co-authored-by: Katie Byers <[email protected]>
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.
Good change!
Added appropriate tests and verified them on BrowserStack.
Fixes #2197
Fixes #2125
Possibly Fixes #2074
==============================
The previous implementation was faulty, as it instantly triggered a handler during listener registration, not when it was actually called in the future. This caused some breadcrumbs to be captured despite no user action having been performed.
Instead of wrapping the listener provided by the user, we register our own listener on a given element for the same event type and use it as the mechanism for triggering the instrumentation handler.
We always register only one instrumentation listener and keep track of how many listeners are attached overall with
refCount
. When removing custom listeners, we only detach instrumentation once all references are gone. This way we don't store unnecessary data in the memory once it's not necessary.