fix(browser): stop future requests after worker.stop#2683
fix(browser): stop future requests after worker.stop#2683felmonon wants to merge 2 commits intomswjs:fix/define-networkfrom
Conversation
|
Follow-up: the earlier browser failure was due to lifecycle events still firing after |
kettanaito
left a comment
There was a problem hiding this comment.
Hi, @felmonon. Thanks for an attempt on this, but this isn't the right solution for the problem.
We already handle in-flight requests though, and that doesn't change in the new architecture. The only existing issue is related to fake timers (see #2582) because they lock in in-flight resolution under a user action if they decide to mock timers.
Let me know if you have any thoughts on this pull request, otherwise I'm going to close it.
|
Thanks for the clarification. That makes sense — I was treating this as a general future-request-after-stop regression, but if the remaining issue is specifically the fake-timer behavior tracked in #2582, then this patch is solving the wrong problem. I don't have a stronger non-fake-timer repro to point to here, so I'm going to close this PR rather than push further in the wrong direction. |
Follow-up for #2650.
Addresses #2668 on top of the
defineNetworkbranch.Summary
worker.stop()runs in Service Worker modeworker.start()worker.stop(); fetch()in the same evaluation tickTesting
pnpm exec eslint src/browser/sources/service-worker-source.ts src/browser/utils/workerChannel.ts test/browser/msw-api/setup-worker/stop/in-flight-request.test.tspnpm buildpnpm test:browser -- test/browser/msw-api/setup-worker/stop test/browser/msw-api/setup-worker/stop.test.ts