Skip to content

fix(worker): reactivate MSW mocking after tab visibility returns - #17

Merged
kep-ria-ang merged 1 commit into
kakaoenterprise:mainfrom
kep-mei-yo:fix/mocking-service-worker
Aug 27, 2026
Merged

fix(worker): reactivate MSW mocking after tab visibility returns#17
kep-ria-ang merged 1 commit into
kakaoenterprise:mainfrom
kep-mei-yo:fix/mocking-service-worker

Conversation

@kep-mei-yo

@kep-mei-yo kep-mei-yo commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

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

  • Bug fix
  • Feature
  • Refactor
  • Breaking change

Checklist

  • Code follows project conventions
  • Self-reviewed
  • Tested locally
  • No console errors / warnings

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-mei-yo kep-mei-yo self-assigned this Aug 7, 2026
@github-actions
github-actions Bot requested a review from kep-ria-ang August 7, 2026 06:55
@kep-mei-yo kep-mei-yo added the bug Something isn't working label Aug 7, 2026
@kep-ria-ang
kep-ria-ang merged commit 3236e89 into kakaoenterprise:main Aug 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants