Skip to content

Commit

Permalink
Merge pull request #64 from Mupu/main
Browse files Browse the repository at this point in the history
fix: #63 simple-stack-stream crash
  • Loading branch information
bholmesdev authored May 6, 2024
2 parents 9c17e9c + 26f203d commit 0f5c187
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-boxes-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"simple-stack-stream": patch
---

Fix unhandled crash when a connection is closed before Suspense components are streamed.
54 changes: 28 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
{
"name": "simple-stack",
"version": "0.0.0",
"description": "Astro for apps",
"scripts": {
"dev": "turbo dev --filter='./packages/*'",
"dev:all": "turbo dev",
"build": "turbo build --filter='./packages/*'",
"build:all": "turbo build",
"check": "biome check packages/*",
"check:apply": "biome check packages/* --apply",
"lint": "biome lint packages/*",
"lint:apply": "biome lint packages/* --apply",
"format": "biome format",
"format:write": "biome format --write",
"version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run check"
},
"keywords": ["withastro"],
"author": "bholmesdev",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "^1.4.1",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"turbo": "^1.11.2"
},
"packageManager": "[email protected]"
"name": "simple-stack",
"version": "0.0.0",
"description": "Astro for apps",
"scripts": {
"dev": "turbo dev --filter='./packages/*'",
"dev:all": "turbo dev",
"build": "turbo build --filter='./packages/*'",
"build:all": "turbo build",
"check": "biome check packages/",
"check:apply": "biome check packages/ --apply",
"lint": "biome lint packages/",
"lint:apply": "biome lint packages/ --apply",
"format": "biome format",
"format:write": "biome format --write",
"version": "changeset version && pnpm install --no-frozen-lockfile && pnpm run check"
},
"keywords": [
"withastro"
],
"author": "bholmesdev",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "^1.4.1",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"turbo": "^1.11.2"
},
"packageManager": "[email protected]"
}
6 changes: 5 additions & 1 deletion packages/stream/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export const onRequest = defineMiddleware(async (ctx, next) => {
// The React team calls this server-side resolution "flushing."
setTimeout(() => {
const flushedChunk = flushableChunks.get(id) ?? chunk;
streamController.enqueue({ id, chunk: flushedChunk });
try {
streamController.enqueue({ id, chunk: flushedChunk });
} catch (e) {
streamController.error(e);
}
flushableChunks.delete(id);
}, FLUSH_THRESHOLD);
return;
Expand Down

0 comments on commit 0f5c187

Please sign in to comment.