Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/loose-stars-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/start": patch
---

fix potentially incomplete first chunk for chunk readers
8 changes: 6 additions & 2 deletions packages/start/src/fns/serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,14 @@ export class SerovalChunkReader {
}

async next(): Promise<{ done: true; value: undefined } | { done: false; value: string }> {
// Check if the buffer is empty
if (this.buffer.length === 0) {
// Check if the buffer is empty or incomplete
if (this.buffer.length < 12) {
// if we are already done...
if (this.done) {
// incomplete stream
if (this.buffer.length !== 0) {
throw new Error("Malformed server function stream.");
}
return {
done: true,
value: undefined,
Expand Down
Loading