GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Fizz] Expose a method to explicitly start writing to a Node stream by sebmarkbage · Pull Request #21028 · react/react

Conversation

@sebmarkbage

@sebmarkbage sebmarkbage commented Mar 18, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

We use writable Node streams because it's the only one that lets us explicitly flush to the underlying sink. Especially when used with gzip.

However, we don't want to start writing to it until after the header has been received and perhaps part of the initial content like <head> has been written.

This PR makes it so that you have to explicitly call "startWriting" to start flushing to a Node stream. We'll later expose some various callbacks for when it might be a good idea to start.

For Browser streams, we don't need this API because we use readable streams there. There's no writable streams and the gzip problem doesn't have a solution there. For readable streams you can just wait to provide that stream to the sink until you're ready.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sebmarkbage
sebmarkbage requested a review from gaearon March 18, 2021 02:27
@facebook-github-bot facebook-github-bot added React Core Team Opened by a member of the React Core Team CLA Signed labels Mar 18, 2021
@sebmarkbage sebmarkbage changed the title [Fizz] Expose a method to explicitly start a Node stream [Fizz] Expose a method to explicitly start writing to a Node stream Mar 18, 2021
@sizebot

sizebot commented Mar 18, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Comparing: cf485e6...3036225

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 122.89 kB 122.89 kB = 39.55 kB 39.55 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.38 kB 129.38 kB = 41.61 kB 41.61 kB
facebook-www/ReactDOM-prod.classic.js = 409.01 kB 409.01 kB = 75.85 kB 75.85 kB
facebook-www/ReactDOM-prod.modern.js = 397.27 kB 397.27 kB = 73.91 kB 73.91 kB
facebook-www/ReactDOMForked-prod.classic.js = 409.02 kB 409.02 kB = 75.85 kB 75.85 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.development.js +0.80% 5.13 kB 5.17 kB +0.68% 1.47 kB 1.48 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.development.js +0.80% 5.13 kB 5.17 kB +0.68% 1.47 kB 1.48 kB
oss-experimental/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +0.73% 2.48 kB 2.50 kB +0.93% 0.97 kB 0.98 kB
oss-stable/react-noop-renderer/cjs/react-noop-renderer-server.production.min.js +0.73% 2.48 kB 2.50 kB +0.93% 0.97 kB 0.98 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js +0.59% 10.52 kB 10.58 kB +0.41% 3.90 kB 3.92 kB
oss-experimental/react-dom/umd/react-dom-unstable-fizz.browser.development.js = 49.61 kB 49.47 kB = 12.13 kB 12.08 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.browser.development.js = 47.11 kB 46.98 kB = 11.97 kB 11.91 kB
oss-experimental/react-server/cjs/react-server.development.js = 32.52 kB 32.38 kB = 8.39 kB 8.33 kB
oss-stable/react-server/cjs/react-server.development.js = 32.52 kB 32.38 kB = 8.39 kB 8.33 kB

Generated by 🚫 dangerJS against 3036225

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sebmarkbage
sebmarkbage force-pushed the fizzstart branch from 28526d3 to c256a81 Compare March 18, 2021 02:32
gaearon
gaearon approved these changes Mar 18, 2021
View reviewed changes

@gaearon gaearon left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to write a test that does not immediately start writing?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sebmarkbage
sebmarkbage force-pushed the fizzstart branch from c256a81 to 308cde7 Compare March 18, 2021 16:24
sebmarkbage added 2 commits March 18, 2021 12:52
@sebmarkbage
Expose an explicit point when to start writing in the Node API
7d1675c
@sebmarkbage
Add a previously failing test
3036225
@sebmarkbage
sebmarkbage force-pushed the fizzstart branch from 308cde7 to 3036225 Compare March 18, 2021 16:53
@sebmarkbage
sebmarkbage merged commit 154b852 into react:master Mar 18, 2021
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Mar 23, 2021
@sebmarkbage @zhengjitf
[Fizz] Expose a method to explicitly start writing to a Node stream (r…
314dc12
…eact#21028)

* Expose an explicit point when to start writing in the Node API

* Add a previously failing test
facebook-github-bot pushed a commit to react/react-native that referenced this pull request Mar 23, 2021
@rickhanlonii @facebook-github-bot
React Native sync for revisions c9f6d0a...6d3ecb7
563b42b
Summary:
This sync includes the following changes:
- **[6d3ecb7](react/react@6d3ecb70d )**: Remove unstable_changedBits ([#20953](react/react#20953)) //<Andrew Clark>//
- **[754e307](react/react@754e30728 )**: Delete immediateQueueCallbackNode ([#20980](react/react#20980)) //<Andrew Clark>//
- **[be5a2e2](react/react@be5a2e231 )**: Land enableSyncMicrotasks ([#20979](react/react#20979)) //<Andrew Clark>//
- **[f6bc9c8](react/react@f6bc9c824 )**: [Fizz] Expose maxBoundarySize as an option ([#21029](react/react#21029)) //<Sebastian Markbåge>//
- **[154b852](react/react@154b85213 )**: [Fizz] Expose a method to explicitly start writing to a Node stream ([#21028](react/react#21028)) //<Sebastian Markbåge>//
- **[cf485e6](react/react@cf485e6f6 )**: [Fizz] Expose a method to abort a pending request ([#21027](react/react#21027)) //<Sebastian Markbåge>//
- **[3fb11ee](react/react@3fb11eed9 )**: React Native: Touch Instrumentation Interface ([#21024](react/react#21024)) //<Timothy Yung>//
- **[825c302](react/react@825c3021f )**: Don't delete trailing mismatches during hydration at the root ([#21021](react/react#21021)) //<Sebastian Markbåge>//
- **[1d1e49c](react/react@1d1e49cfa )**: [Fizz] Assign an ID to the first DOM element in a fallback or insert a dummy (and testing infra) ([#21020](react/react#21020)) //<Sebastian Markbåge>//
- **[466b26c](react/react@466b26c92 )**: Store commit durations on HostRoot for DevTools access ([#20983](react/react#20983)) //<Brian Vaughn>//
- **[89acfa6](react/react@89acfa639 )**: Fix native event batching in concurrent mode ([#21010](react/react#21010)) //<Ricky>//
- **[0203b65](react/react@0203b6567 )**: chore: update react-reconciler README ([#21016](react/react#21016)) //<susiwen8>//

Changelog:
[General][Changed] - React Native sync for revisions c9f6d0a...6d3ecb7

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross, kacieb

Differential Revision: D27231625

fbshipit-source-id: 89c0c0662e69044ae8890486a693013bee6005dd
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
@sebmarkbage @koto
[Fizz] Expose a method to explicitly start writing to a Node stream (r…
b8765f8
…eact#21028)

* Expose an explicit point when to start writing in the Node API

* Add a previously failing test
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@sebmarkbage
[Fizz] Expose a method to explicitly start writing to a Node stream (r…
7b87c72
…eact#21028)

* Expose an explicit point when to start writing in the Node API

* Add a previously failing test
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
[Fizz] Expose a method to explicitly start writing to a Node stream (r…
6d0c858
…eact#21028)

* Expose an explicit point when to start writing in the Node API

* Add a previously failing test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gaearon gaearon gaearon approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@sebmarkbage @sizebot @gaearon @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.