feat(core): Remove getCurrentHub from AsyncContextStrategy#11581
feat(core): Remove getCurrentHub from AsyncContextStrategy#11581
getCurrentHub from AsyncContextStrategy#11581Conversation
size-limit report 📦
|
| export function getCurrentHub(): HubInterface { | ||
| // Get main carrier (global for every environment) | ||
| const carrier = getMainCarrier(); | ||
|
|
||
| const acs = getAsyncContextStrategy(carrier); | ||
| return acs.getCurrentHub() || getGlobalHub(); | ||
| } |
There was a problem hiding this comment.
It's no longer necessary to read from the carrier here since acs doesn't have the getCurrentHub method anymore. This means that we can replace this entire implementation with the shim which in turn will again forward its respective calls to the globalHub (to be renamed).
There was a problem hiding this comment.
I think we need to remove getGlobalHub usage and make everything rely on the shim, though that does mean we need to refactor more of the return values in getHubStackAsyncContextStrategy
There was a problem hiding this comment.
yes, I talked about this with @mydea and that's basically what we should do. getHubStackAsyncContextStrategy has to stay in one way or the other since our fallback (i.e. browser) async context strategy is still a stack-based scope hierarchy. getGlobalHub currently returns a Hub class instance which we can probably cut down a lot to only handle the scope stack. At this point we can then also rename this to something like globalScopeStackAsyncContextStrategy.
|
oh god I just opened a whole box of circular dependency problems - these are not fun to resolve 😅 update: nvm, the circular dep was caused by me importing |
4e91097 to
b0ae26d
Compare
21ff82b to
e658aff
Compare
There was a problem hiding this comment.
The imports in this file caused a (rather unrelated but still existing) circular dependency in the core package.
This PR removes the
getCurrentHubproperty from theAsyncContextStrategyinterface and consequently also the property in the interface implementers.There's still some stuff left to clean up but it is only internal anymore.
Hopefully the last breaking change in connection to #11482