react-streaming
Advanced tools
Comparing version 0.3.36 to 0.3.37
@@ -9,6 +9,3 @@ "use strict"; | ||
let state = 'UNSTARTED'; | ||
// Needed to avoid React hydration mismatch. | ||
// - There seem to always(?) be a hydration mismatch whenever something is injected before the first react write. | ||
// - Reproduction: https://github.com/vikejs/vike/commit/45e4ffea06335ddbcf2826b0113be7f925617daa | ||
// - Thus, we delay any write to the stream until react wrote its first chunk. | ||
// See Rule 2: https://github.com/brillout/react-streaming/tree/main/src#rule-2 | ||
let writePermission = false; | ||
@@ -68,3 +65,8 @@ return { injectToStream, onReactWrite, onBeforeEnd, hasStreamEnded }; | ||
writePermission = true; | ||
await flushBuffer(); | ||
await new Promise((resolve) => { | ||
// We delay flushing because of Rule 1: https://github.com/brillout/react-streaming/tree/main/src#rule-1 | ||
setTimeout(() => { | ||
resolve(flushBuffer()); | ||
}, 0); | ||
}); | ||
} | ||
@@ -71,0 +73,0 @@ async function onBeforeEnd() { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const getGlobalObject_1 = require("./getGlobalObject"); | ||
const PROJECT_VERSION = '0.3.36'; | ||
const PROJECT_VERSION = '0.3.37'; | ||
const projectInfo = { | ||
@@ -8,0 +8,0 @@ projectName: 'react-streaming', |
@@ -7,6 +7,3 @@ export { createBuffer }; | ||
let state = 'UNSTARTED'; | ||
// Needed to avoid React hydration mismatch. | ||
// - There seem to always(?) be a hydration mismatch whenever something is injected before the first react write. | ||
// - Reproduction: https://github.com/vikejs/vike/commit/45e4ffea06335ddbcf2826b0113be7f925617daa | ||
// - Thus, we delay any write to the stream until react wrote its first chunk. | ||
// See Rule 2: https://github.com/brillout/react-streaming/tree/main/src#rule-2 | ||
let writePermission = false; | ||
@@ -66,3 +63,8 @@ return { injectToStream, onReactWrite, onBeforeEnd, hasStreamEnded }; | ||
writePermission = true; | ||
await flushBuffer(); | ||
await new Promise((resolve) => { | ||
// We delay flushing because of Rule 1: https://github.com/brillout/react-streaming/tree/main/src#rule-1 | ||
setTimeout(() => { | ||
resolve(flushBuffer()); | ||
}, 0); | ||
}); | ||
} | ||
@@ -69,0 +71,0 @@ async function onBeforeEnd() { |
export { projectInfo }; | ||
import { getGlobalObject } from './getGlobalObject'; | ||
const PROJECT_VERSION = '0.3.36'; | ||
const PROJECT_VERSION = '0.3.37'; | ||
const projectInfo = { | ||
@@ -5,0 +5,0 @@ projectName: 'react-streaming', |
{ | ||
"name": "react-streaming", | ||
"description": "React 18 Streaming. Full-fledged & Easy.", | ||
"version": "0.3.36", | ||
"version": "0.3.37", | ||
"peerDependencies": { | ||
@@ -6,0 +6,0 @@ "react": ">=18", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3128
149536