Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-streaming

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-streaming - npm Package Compare versions

Comparing version 0.3.36 to 0.3.37

12

dist/cjs/server/renderToStream/createBuffer.js

@@ -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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc