-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: Cleanup hooks when they are not used anymore #12852
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 📦
|
Small optimization using the new hook cleanup capabilities to remove unused hooks.
@@ -288,7 +288,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio | |||
return; | |||
} | |||
|
|||
if (activeSpan) { | |||
if (activeSpan && !spanToJSON(activeSpan).timestamp) { |
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.
While debugging a test failure, I noticed that this surfaced another problem - we were potentially double-ending the span here. If the idle span already ended on it's own, we do not want to/need to end it anymore here! Calling this twice lead to some issues as it tried to remove the hooks twice, ...
const cbIndex = hooks.indexOf(callback); | ||
// @ts-expect-error We assue the types are correct | ||
const cbIndex = hooks.indexOf(callback); | ||
if (cbIndex > -1) { |
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.
Also adding this safeguard that was missing before - if trying to remove a hook twice, this should not fail and remove the first entry or similar.
Small optimization using the new hook cleanup capabilities to remove unused hooks.
Ref PR to do this in angular: #12786