-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
ref(hub): Remove _invokeClient #4195
Conversation
size-limit report
|
197701b
to
4b2082b
Compare
We are closing this PR as the bundle savings are low, and it doesn't necessarily justify the impact from removing a method from |
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.
LGTM.
Heh. You beat me to it. I agree that this is a good pattern for the other indirection changes we want to make, so let's bookmark it and we can come back to it then. |
This PR removes the dynamic dispatch of
_invokeClient
in favour of explicitly using client methods. We introduce a_withClient
helper that does this._withClient
grabs the client and scope from the stack of scopes on the hub, and executes a callback with those values. This allows the consumer of the function to directly access the client instance and call methods on it.There are a couple consequences of this change
Although the savings are low here (around
0.7 kb
bundle improved), it also helps us see how we can address refactoringcallOnHub
.It's important to note that this is a breaking change as we are removing the
_callOnClient
public method exported from@sentry/minimal
, so I'm going to apply a blocked label on this until we get consensus. One thing to note here is that is is both@hidden
and prefixed with_
, so it clearly seems like an internal SDK api. In addition, it seems that with Electron v3, there are no external consumers of the_callOnClient
function (no internal consumers either)