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] Assign an ID to the first DOM element in a fallback or insert a dummy (and testing infra) by sebmarkbage · Pull Request #21020 · react/react

Conversation

@sebmarkbage

@sebmarkbage sebmarkbage commented Mar 16, 2021

Copy link
Copy Markdown
Contributor

We need some ID attribute so that we can quickly find a Suspense boundary. This approach tries to assign or reuse the ID of the first child element of a Suspense boundary. If the first child is not an element, we insert a dummy hidden span. This breaks CSS pseudo-selectors for this case ofc.

I'm not a fan of how invasive this solution is. It's also not deterministic because it's done in the render phase instead of writing phase. It also seems unnecessary to insert both a comment and a span in the cases where that applies.

As part of this PR I also add actual testing infra to make sure the basics work. It's creating an environment which both streams in the result and hydrates it at the same time. JSDOM can't do HTML streaming parsing so we have to do a bit of a hack to pretend we're streaming it in.

Sorry, something went wrong.

Uh oh!

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

All reactions
sebmarkbage added 2 commits March 16, 2021 10:27
@sebmarkbage
Patches
ac6b939
@sebmarkbage
Add Fizz testing infra structure
a9e8c41
@sebmarkbage
sebmarkbage requested review from acdlite and gaearon March 16, 2021 19:21
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 16, 2021
@sebmarkbage
Assign an ID to the first DOM node in a fallback or insert a dummy
192c039
@sebmarkbage
sebmarkbage force-pushed the fizztesting branch from 99591ea to 192c039 Compare March 16, 2021 19:22
@sizebot

sizebot commented Mar 16, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Comparing: f8979e0...babefe9

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.83 kB 122.83 kB = 39.52 kB 39.52 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.33 kB 129.33 kB = 41.59 kB 41.58 kB
facebook-www/ReactDOM-prod.classic.js = 408.70 kB 408.70 kB = 75.80 kB 75.80 kB
facebook-www/ReactDOM-prod.modern.js = 396.96 kB 396.96 kB = 73.86 kB 73.86 kB
facebook-www/ReactDOMForked-prod.classic.js = 408.71 kB 408.71 kB = 75.80 kB 75.80 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.browser.production.min.js +6.45% 8.95 kB 9.53 kB +5.76% 3.42 kB 3.62 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js +6.31% 9.15 kB 9.72 kB +6.10% 3.44 kB 3.65 kB
oss-experimental/react-dom/umd/react-dom-unstable-fizz.browser.production.min.js +6.28% 9.14 kB 9.72 kB +5.72% 3.50 kB 3.70 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.browser.development.js +4.91% 40.87 kB 42.88 kB +3.89% 10.40 kB 10.81 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.node.development.js +4.88% 41.12 kB 43.13 kB +3.90% 10.41 kB 10.82 kB
oss-experimental/react-dom/umd/react-dom-unstable-fizz.browser.development.js +4.88% 43.07 kB 45.17 kB +3.74% 10.57 kB 10.96 kB
oss-experimental/react-server/cjs/react-server.production.min.js +3.32% 7.36 kB 7.60 kB +2.82% 2.73 kB 2.81 kB
oss-stable/react-server/cjs/react-server.production.min.js +3.32% 7.36 kB 7.60 kB +2.82% 2.73 kB 2.81 kB
oss-experimental/react-server/cjs/react-server.development.js +2.53% 27.80 kB 28.51 kB +1.99% 7.15 kB 7.29 kB
oss-stable/react-server/cjs/react-server.development.js +2.53% 27.80 kB 28.51 kB +1.99% 7.15 kB 7.29 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-dom/cjs/react-dom-unstable-fizz.browser.production.min.js +6.45% 8.95 kB 9.53 kB +5.76% 3.42 kB 3.62 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js +6.31% 9.15 kB 9.72 kB +6.10% 3.44 kB 3.65 kB
oss-experimental/react-dom/umd/react-dom-unstable-fizz.browser.production.min.js +6.28% 9.14 kB 9.72 kB +5.72% 3.50 kB 3.70 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.browser.development.js +4.91% 40.87 kB 42.88 kB +3.89% 10.40 kB 10.81 kB
oss-experimental/react-dom/cjs/react-dom-unstable-fizz.node.development.js +4.88% 41.12 kB 43.13 kB +3.90% 10.41 kB 10.82 kB
oss-experimental/react-dom/umd/react-dom-unstable-fizz.browser.development.js +4.88% 43.07 kB 45.17 kB +3.74% 10.57 kB 10.96 kB
oss-experimental/react-server/cjs/react-server.production.min.js +3.32% 7.36 kB 7.60 kB +2.82% 2.73 kB 2.81 kB
oss-stable/react-server/cjs/react-server.production.min.js +3.32% 7.36 kB 7.60 kB +2.82% 2.73 kB 2.81 kB
oss-experimental/react-server/cjs/react-server.development.js +2.53% 27.80 kB 28.51 kB +1.99% 7.15 kB 7.29 kB
oss-stable/react-server/cjs/react-server.development.js +2.53% 27.80 kB 28.51 kB +1.99% 7.15 kB 7.29 kB

Generated by 🚫 dangerJS against babefe9

All reactions

Sorry, something went wrong.

Uh oh!

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

@sebmarkbage

sebmarkbage commented Mar 16, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

Not sure what's up with that test failure.

All reactions

Sorry, something went wrong.

Uh oh!

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

@gaearon

gaearon commented Mar 16, 2021

Copy link
Copy Markdown
Collaborator

Does unstable_createRoot work?

All reactions

Sorry, something went wrong.

Uh oh!

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

acdlite
acdlite reviewed Mar 16, 2021
View reviewed changes
Comment thread packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
}
}

function getVisibleChildren(element) {

@acdlite acdlite Mar 16, 2021

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.

😍

Sorry, something went wrong.

Uh oh!

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

NE-SmallTown reacted with laugh emoji
All reactions
  • 😄 1 reaction
acdlite
acdlite reviewed Mar 16, 2021
View reviewed changes
Comment thread packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
// But it is not yet hydrated.
expect(ref.current).toBe(null);

Scheduler.unstable_flushAll();

@acdlite acdlite Mar 16, 2021

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.

Maybe you could have two acts: one for Fizz, one for the Scheduler/reconciler?

Sorry, something went wrong.

Uh oh!

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

All reactions

@sebmarkbage sebmarkbage Mar 16, 2021

Copy link
Copy Markdown
Contributor Author

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.

I was kind of expecting to have them all be like one act that does both the server and the client in that act. E.g. I didn't include anything like "scheduler.yield" here.

This was ported from another test though. Not sure if this will come up more.

Sorry, something went wrong.

Uh oh!

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

All reactions
acdlite
acdlite reviewed Mar 16, 2021
View reviewed changes
Comment thread packages/react-server/src/ReactFizzServer.js Outdated

if (Array.isArray(node)) {
for (let i = 0; i < node.length; i++) {
renderNode(request, parentBoundary, segment, node[i]);

@acdlite acdlite Mar 16, 2021

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.

Ah, so nice to be able to use the actual JS stack 😆

Sorry, something went wrong.

Uh oh!

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

All reactions
@acdlite

acdlite commented Mar 16, 2021

Copy link
Copy Markdown
Collaborator

Does unstable_createRoot work?

Yeah createRoot doesn't exist in the experimental builds. Only the FB ones. So either gate the test or switch to unstable_createRoot.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sebmarkbage
unstable_createRoot
babefe9
acdlite
acdlite approved these changes Mar 16, 2021
View reviewed changes

@acdlite acdlite 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.

Neat. Agree it's a bit invasive but fine to land this until you think of something better.

Sorry, something went wrong.

Uh oh!

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

All reactions
@acdlite

acdlite commented Mar 16, 2021

Copy link
Copy Markdown
Collaborator

Love the tests, btw.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sebmarkbage
sebmarkbage merged commit 1d1e49c into react:master Mar 16, 2021
zhengjitf pushed a commit to zhengjitf/react that referenced this pull request Mar 23, 2021
@sebmarkbage @zhengjitf
[Fizz] Assign an ID to the first DOM element in a fallback or insert …
e2a1825
…a dummy (and testing infra) (react#21020)

* Patches

* Add Fizz testing infra structure

* Assign an ID to the first DOM node in a fallback or insert a dummy

* unstable_createRoot
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] Assign an ID to the first DOM element in a fallback or insert …
a1ae068
…a dummy (and testing infra) (react#21020)

* Patches

* Add Fizz testing infra structure

* Assign an ID to the first DOM node in a fallback or insert a dummy

* unstable_createRoot
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@sebmarkbage
[Fizz] Assign an ID to the first DOM element in a fallback or insert …
c7149d6
…a dummy (and testing infra) (react#21020)

* Patches

* Add Fizz testing infra structure

* Assign an ID to the first DOM node in a fallback or insert a dummy

* unstable_createRoot
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
[Fizz] Assign an ID to the first DOM element in a fallback or insert …
2952be8
…a dummy (and testing infra) (react#21020)

* Patches

* Add Fizz testing infra structure

* Assign an ID to the first DOM node in a fallback or insert a dummy

* unstable_createRoot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@acdlite acdlite acdlite approved these changes
@gaearon gaearon Awaiting requested review from gaearon

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.

5 participants

@sebmarkbage @sizebot @gaearon @acdlite @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.