[BUG] Fix: download progress indicator and streaming race condition#25
Open
grMLEqomlkkU5Eeinz4brIrOVCUCkJuN wants to merge 2 commits intorebane2001:manefrom
Conversation
added 2 commits
February 22, 2026 00:39
- prevents contributors from committing the file
progressMonitor() was being called but its return value was discarded. The original networkResponse was cached and returned instead, meaning the monitored ReadableStream was never consumed and progress events were never sent to the client. Changes: - Capture and return monitoredResponse instead of networkResponse - Cache the monitored response so progress works on cache hits too - Refactor progressMonitor to async/await for cleaner flow - Handle null client gracefully (stream data without progress events)
Contributor
Author
|
Also it is one of my first few times working with service workers, so do let me know if there is anything I should know about. Have a nice day. |
Contributor
Author
|
You may also need to bump the version, cheers in advance. |
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.
The progress bar for loading
smoldata.jsonwas broken since it was creating theprogress-monitoredrespons, but it was never actually using it. (the incorrect original response was returned)There was also another race condition bug that gets fixed in this PR.
When the client navigates away or does something to have the context removed or somehow made it unavailable, before the stream started, the response would just fail. Now it falls back to streaming without progress updates instead of breaking.
Also I refactored
progressMonitorto an async-await pattern since the.thenhad the closure variable that made it awkward to handle null cases.I also added a gitignore file for convenience, but you are free to edit this PR's commits and erase that as I see that the pattern of this project seem to be hosted directly, apologies in advance.