Effect CommunityEC
Effect Community14mo ago
148 replies
alex

HMR gets stuck when frontend is connected to SSE endpoint using PubSub/Stream

hey, I'm still kinda new to Effect and I tried looking for a solution for a while (here, on the docs and in the effect repo) but I couldnt figure this one out

I think the solution is probably to use the PubSub.shutdown (or awaitShutdown ?) in a finalizer somewhere, but even after adding those in different places I couldnt get it working :(

Issue


saving a backend file (which triggers the restart) doesnt work when FE is connected in SSE; tho whenever the tab is closed the process resume as expected

Restarting './src/main.ts'
Waiting for graceful termination...
# this never ends


Steps to minimal reproduction


https://github.com/astahmer/effect-repro-sse

pnpm i
pnpm dev


- then visit http://localhost:5173/
- then try saving any src file in the backend folder, ex:
./back/src/http/demo.live.ts
- see the issue ("Waiting for graceful termination...")

-> commenting line 9 of ./front/src/App.tsx fixes the
issue:
GitHub
Contribute to astahmer/effect-repro-sse development by creating an account on GitHub.
GitHub - astahmer/effect-repro-sse
Was this page helpful?