fix(worker): reactivate MSW mocking after tab visibility returns - #17
Merged
kep-ria-ang merged 1 commit intoAug 27, 2026
Merged
Conversation
Chromium idle-terminates the Service Worker while its tab is backgrounded, which wipes the worker's in-memory active-client registry even though the page's worker/registration is still alive. The next request from that tab then silently falls through to the real network until a full reload re-runs the MOCK_ACTIVATE handshake. Add MockingGUIWorkerManager.reactivate(), which re-sends that same handshake on the existing worker, and call it from a visibilitychange listener so mocking recovers as soon as the tab is visible again, without requiring a reload. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kep-ria-ang
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#16
Chromium idle-terminates the Service Worker while its tab is backgrounded, which wipes the worker's in-memory active-client registry even though the page's worker/registration is still alive. The next request from that tab then silently falls through to the real network until a full reload re-runs the MOCK_ACTIVATE handshake.
Add MockingGUIWorkerManager.reactivate(), which re-sends that same handshake on the existing worker, and call it from a visibilitychange listener so mocking recovers as soon as the tab is visible again, without requiring a reload.
ko
백그라운드에 있던 탭이 돌아왔을 때 mocking이 조용히 실제 API로 풀리는 문제를 수정했습니다. 브라우저가 유휴 상태의 Service Worker를 종료시키면서 메모리에 있던 활성 클라이언트 상태가 사라지는데, visibilitychange 시점에 MOCK_ACTIVATE 핸드셰이크를 재전송하여 새로고침 없이도 mocking이 복구되도록 했습니다.
What Changed
Screenshot (Optional)
Type
Checklist