mirror of
https://github.com/niels-emmer/pwa-maker-android.git
synced 2026-09-13 23:53:33 +02:00
[PR #4] [MERGED] fix: stream SSE events in real-time (flush gzip buffer + onerror race guard) #4
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
github-mirrors/pwa-maker-android#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/niels-emmer/pwa-maker-android/pull/4
Author: @niels-emmer
Created: 2/27/2026
Status: ✅ Merged
Merged: 2/27/2026
Merged by: @niels-emmer
Base:
main← Head:icon-fix📝 Commits (1)
91ec8d8fix: flush SSE gzip buffer and guard onerror race condition📊 Changes
4 files changed (+80 additions, -13 deletions)
View changed files
📝
backend/src/routes/build.ts(+9 -0)📝
frontend/src/hooks/useBuild.ts(+16 -8)📝
frontend/tests/useBuild.test.ts(+36 -0)📝
stats.md(+19 -5)📄 Description
Summary
backend/src/routes/build.ts: Addedres.flush()after everyres.write()in the SSE route (both insend()and the heartbeat interval). Express'scompressionmiddleware buffers gzip output untilres.end()— without flushing, all progress events were delivered at once when the build completed rather than streaming in real time.frontend/src/hooks/useBuild.ts: Wrappedonerror'ssetStatecall insetTimeout(0). When all buffered events + connection-close arrive in the same TCP segment,onerrorcan fire before React applies the'complete'state update; the timeout yields to any already-queuedonmessagehandlers first so the correct terminal phase is preserved.frontend/tests/useBuild.test.ts: +2 tests — verifies the normalonerrorerror path and verifiesonerrordoes not overwrite a completed build phase.Test plan
npm testin bothbackend/andfrontend/)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.