-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
multiple interceptors causing restore problem #97
Comments
Hey. Thanks for opening this issue. Does this also cause mswjs/msw#474? Keeping a counter doesn't guarantee the proper cleanup phase, as the patches are applied per process. The code above does nothing if If it's a question of identifying which exact patches to restore, each call to |
Yes but the main idea is why we should restore something if it's still used by other ? |
It's deterministic to restore patches when you call We should follow a deterministic pattern: 1 I'm reluctant when it comes to building a custom logic around that, because it doesn't solve the actual problem: context leak in concurrent mode. We may implement a guard to ensure -interceptor.use(handlerA)
-interceptor.use(handlerB)
+const interceptor = createInterceptor({
+ resolver: singleHandler
+})
+interceptor.apply() If we could scope the calls to |
I've redesigned interceptors in #232 and now any interceptor can be instantiated multiple times. They are also disposed of correctly. Once the |
Released: v0.15.2 🎉This has been released in v0.15.2! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
We know that there is a problem when using multiple interceptors.
restore
function will remove monkey patches even if there are other interceptors. The last one is mswjs/msw#637The solution of this problem is not really easy but what you think if we add a counter on the interceptor? I know that is not a complete solution but could be a first start
The text was updated successfully, but these errors were encountered: