Is it possible for worker.stop()
to return a promise?
#1092
Replies: 3 comments 1 reply
-
Hey, @bertdeblock. Thanks for your kind words! I think msw/src/setupWorker/stop/createStop.ts Line 13 in 6e7ec28 On the worker's side, this means removing the client's ID from the internal set of active client IDs: Lines 64 to 67 in 6e7ec28 Once removed, all requests from this client will still be intercepted but not mocked. Instead, they will be performed as-is: Lines 151 to 157 in 6e7ec28 Do you mind setting a few breakpoints in the Well, I think it's possible that a request happens, triggers the I guess we can consider making the deactivation events bi-directional so that the worker would send back something like |
Beta Was this translation helpful? Give feedback.
-
@kettanaito Thanks for the response. I will take some time to reproduce the issue and provide you with more detailed info. Won't be right away, but I'll make it happen! |
Beta Was this translation helpful? Give feedback.
-
FWIW, this has become less of an issue for us. |
Beta Was this translation helpful? Give feedback.
-
I think
worker.stop()
used to return a promise in older versions of MSW? This doesn't seem to be the case anymore.Is it possible to bring back this functionality or is there a technical reason that prevents
worker.stop()
from returning a promise?The reason I'm asking is because, we have a scenario where we call
worker.stop()
and immediately do afetch
call afterwards. Sometimes the call works as intended, but other times this leaves thefetch
promise in an infinite pending state. The worker seems to intercept the fetch call, but is not able to send back the original response because it has also received the stop command (or something to that extent).Please let me know if you need any more info etc.
Thanks for the great library BTW, it has been very useful to us 👍!
Beta Was this translation helpful? Give feedback.
All reactions