Skip to content

Commit

Permalink
fix: update react-streaming (#1733)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout authored Jul 6, 2024
1 parent 598a3a2 commit c638d40
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 60 deletions.
2 changes: 1 addition & 1 deletion examples/cloudflare-workers-react-full/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"node-fetch": "^2.6.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-streaming": "^0.3.40",
"react-streaming": "^0.3.41",
"vite": "^5.0.10",
"vike": "0.4.178",
"wrangler": "^2.9.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/react-full/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"node-fetch": "^3.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-streaming": "^0.3.40",
"react-streaming": "^0.3.41",
"typescript": "^5.3.3",
"vike": "0.4.178",
"vite": "^5.2.11"
Expand Down
2 changes: 1 addition & 1 deletion examples/react-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"express": "^4.18.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-streaming": "^0.3.40",
"react-streaming": "^0.3.41",
"sirv": "^2.0.2",
"vite": "^5.0.10",
"vike": "0.4.178"
Expand Down
72 changes: 24 additions & 48 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"node-fetch": "^2.6.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-streaming": "^0.3.40",
"react-streaming": "^0.3.41",
"vite": "^5.0.10",
"vike": "0.4.178",
"wrangler": "^2.9.1"
Expand Down
2 changes: 1 addition & 1 deletion test-deprecated-design/react-full/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"node-fetch": "^2.6.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-streaming": "^0.3.40",
"react-streaming": "^0.3.41",
"typescript": "^4.8.4",
"vite": "^5.0.10",
"vike": "0.4.178"
Expand Down
2 changes: 1 addition & 1 deletion test-deprecated-design/react-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"express": "^4.18.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-streaming": "^0.3.40",
"react-streaming": "^0.3.41",
"sirv": "^2.0.2",
"vite": "^5.0.10",
"vike": "0.4.178"
Expand Down
2 changes: 1 addition & 1 deletion vike/node/runtime/html/injectAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function injectHtmlTagsToStream(

let htmlBegin = htmlPartsToString(htmlPartsBegin, pageAssets)
htmlBegin = injectToHtmlBegin(htmlBegin, htmlTags)
await injectHtmlTagsUsingStream(htmlTags, streamFromReactStreamingPackage)
injectHtmlTagsUsingStream(htmlTags, streamFromReactStreamingPackage)

return htmlBegin
}
Expand Down
6 changes: 3 additions & 3 deletions vike/node/runtime/html/injectAssets/injectHtmlTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ function injectHtmlTags(htmlString: string, htmlTags: HtmlTag[], position: Posit
return htmlString
}

async function injectHtmlTagsUsingStream(
function injectHtmlTagsUsingStream(
htmlTags: HtmlTag[],
streamFromReactStreamingPackage: null | StreamFromReactStreamingPackage
): Promise<void> {
): void {
const htmlFragment = joinHtmlTags(htmlTags.filter((h) => h.position === 'STREAM'))
if (htmlFragment) {
assert(streamFromReactStreamingPackage)
assert(!streamFromReactStreamingPackage.hasStreamEnded())
await streamFromReactStreamingPackage.injectToStream(htmlFragment, { flush: true })
streamFromReactStreamingPackage.injectToStream(htmlFragment, { flush: true })
}
}

Expand Down
4 changes: 2 additions & 2 deletions vike/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
}
},
"peerDependencies": {
"react-streaming": ">=0.3.40",
"react-streaming": ">=0.3.41",
"vite": ">=4.4.0"
},
"peerDependenciesMeta": {
Expand Down Expand Up @@ -209,7 +209,7 @@
"es-module-lexer": "^1.4.1",
"esbuild": "^0.19.10",
"fast-glob": "^3.3.2",
"react-streaming": "^0.3.40",
"react-streaming": "^0.3.41",
"rimraf": "^5.0.5",
"sirv": "^2.0.4",
"source-map-support": "^0.5.21",
Expand Down

0 comments on commit c638d40

Please sign in to comment.