Commit Graph

14 Commits

Author SHA1 Message Date
Sebastian Markbåge 3ad076472c
Update Fixtures to use new APIs (#17380)
Also renamed unstable-async to concurrent
2019-11-17 14:42:47 -08:00
Sebastian Markbåge 6fbe630549
[Partial Hydration] Attempt hydration at a higher pri first if props/context changes (#16352)
* Test that we can suspend updates while waiting to hydrate

* Attempt hydration at a higher pri first if props/context changes

* Retrying a dehydrated boundary pings at the earliest forced time

This might quickly become an already expired time.

* Mark the render as delayed if we have to retry

This allows the suspense config to kick in and we can wait for much longer
before we're forced to give up on hydrating.
2019-08-13 18:26:21 -07:00
Sebastian Markbåge f3a14951ab
Partial Hydration (#14717)
* Basic partial hydration test

* Render comments around Suspense components

We need this to be able to identify how far to skip ahead if we're not
going to hydrate this subtree yet.

* Add DehydratedSuspenseComponent type of work

Will be used for Suspense boundaries that are left with their server
rendered content intact.

* Add comment node as hydratable instance type as placeholder for suspense

* Skip past nodes within the Suspense boundary

This lets us continue hydrating sibling nodes.

* A dehydrated suspense boundary comment should be considered a sibling

* Retry hydrating at offscreen pri or after ping if suspended

* Enter hydration state when retrying dehydrated suspense boundary

* Delete all children within a dehydrated suspense boundary when it's deleted

* Delete server rendered content when props change before hydration completes

* Make test internal

* Wrap in act

* Change SSR Fixture to use Partial Hydration

This requires the enableSuspenseServerRenderer flag to be manually enabled
for the build to work.

* Changes to any parent Context forces clearing dehydrated content

We mark dehydrated boundaries as having child work, since they might have
components that read from the changed context.

We check this in beginWork and if it does we treat it as if the input
has changed (same as if props changes).

* Wrap in feature flag

* Treat Suspense boundaries without fallbacks as if not-boundaries

These don't come into play for purposes of hydration.

* Fix clearing of nested suspense boundaries

* ping -> retry

Co-Authored-By: sebmarkbage <sebastian@calyptus.eu>

* Typo

Co-Authored-By: sebmarkbage <sebastian@calyptus.eu>

* Use didReceiveUpdate instead of manually comparing props

* Leave comment for why it's ok to ignore the timeout
2019-02-11 21:25:44 -08:00
ryota-murakami bb48622a36 [SSR Fixture] Update yarn.lock (#13481)
* Update yarn.lock
2018-08-27 08:28:06 -07:00
Dan Abramov 1ebeb0542f
Move npm output from build/packages/* to build/node_modules/* (#11962)
* Move build/packages/* to build/node_modules/*

This fixes Node resolution in that folder and lets us require() packages in it in Node shell for manual testing.

* Link fixtures to packages/node_modules

This updates the location and also uses link: instead of file: to avoid Yarn caching the folder contents.
2018-01-04 19:01:31 +00:00
Clement Hoang 94f44aeba7
Update prettier to 1.8.1 (#10785)
* Change prettier dependency in package.json version 1.8.1

* Update yarn.lock

* Apply prettier changes

* Fix ReactDOMServerIntegration-test.js

* Fix test for ReactDOMComponent-test.js
2017-11-07 18:09:33 +00:00
Dan Abramov d9c1dbd617 Use Yarn Workspaces (#11252)
* Enable Yarn workspaces for packages/*

* Move src/isomorphic/* into packages/react/src/*

* Create index.js stubs for all packages in packages/*

This makes the test pass again, but breaks the build because npm/ folders aren't used yet.
I'm not sure if we'll keep this structure--I'll just keep working and fix the build after it settles down.

* Put FB entry point for react-dom into packages/*

* Move src/renderers/testing/* into packages/react-test-renderer/src/*

Note that this is currently broken because Jest ignores node_modules,
and so Yarn linking makes Jest skip React source when transforming.

* Remove src/node_modules

It is now unnecessary. Some tests fail though.

* Add a hacky workaround for Jest/Workspaces issue

Jest sees node_modules and thinks it's third party code.

This is a hacky way to teach Jest to still transform anything in node_modules/react*
if it resolves outside of node_modules (such as to our packages/*) folder.

I'm not very happy with this and we should revisit.

* Add a fake react-native package

* Move src/renderers/art/* into packages/react-art/src/*

* Move src/renderers/noop/* into packages/react-noop-renderer/src/*

* Move src/renderers/dom/* into packages/react-dom/src/*

* Move src/renderers/shared/fiber/* into packages/react-reconciler/src/*

* Move DOM/reconciler tests I previously forgot to move

* Move src/renderers/native-*/* into packages/react-native-*/src/*

* Move shared code into packages/shared

It's not super clear how to organize this properly yet.

* Add back files that somehow got lost

* Fix the build

* Prettier

* Add missing license headers

* Fix an issue that caused mocks to get included into build

* Update other references to src/

* Re-run Prettier

* Fix lint

* Fix weird Flow violation

I didn't change this file but Flow started complaining.
Caleb said this annotation was unnecessarily using $Abstract though so I removed it.

* Update sizes

* Fix stats script

* Fix packaging fixtures

Use file: instead of NODE_PATH since NODE_PATH.
NODE_PATH trick only worked because we had no react/react-dom in root node_modules, but now we do.

file: dependency only works as I expect in Yarn, so I moved the packaging fixtures to use Yarn and committed lockfiles.
Verified that the page shows up.

* Fix art fixture

* Fix reconciler fixture

* Fix SSR fixture

* Rename native packages
2017-10-19 00:22:21 +01:00
Dan Abramov 2228f497f3 Keep autoFocus attribute in the DOM (#11192)
* Keep autoFocus attribute in the DOM

* Don't emit autoFocus attribute on the client

* Test that hydration doesn't call focus

* Add autoFocus to SSR fixture
2017-10-11 18:52:12 +01:00
Dan Abramov e5db5302ac Fix false positive <noscript> rehydration text difference warning in React 16 (#11157)
* Add <noscript> with HTML in it to SSR fixture

* Wrap <noscript> into a <div> to get its "client HTML"

* Revert "Wrap <noscript> into a <div> to get its "client HTML""

This reverts commit 27a42503e2.

* Always use parent.ownerDocument
2017-10-10 19:35:43 +01:00
Sebastian Markbåge 4131af3e4b Ignore SSR warning using explicit suppressHydrationWarning option (#11126)
* Pass parent type and props to insert/delete hydration warning hooks

For this to work, we need to split the API into a container and normal
version. Since the root doesn't have a type nor props.

* Ignore SSR warning using explicit suppressHydrationWarning option

This lets you ignore the warning on a single element and its direct child
content. This is useful for simple fields that you're expecting to fail
such as time stamps.

Note that this still won't patch up such content so it'll remain
inconsistent. It's also not suitable for nested complex content that may
change.

* Suppress warning of inserted/deleted direct children

* Add fixture testing hydration warning

Also fixing the render->hydrate API change in the fixture

* Add hooks when text hydration doesn't match up

The purpose of these hooks is to pass the parent context to them. I don't
want to do that in the normal hydrateTextInstance hooks since this is
only used in DEV. This is also in line with what happens if there is no
text instance at all and we invoke didNotFindHydratableTextInstance.

* Move mismatch text hydration warning to the new hooks

This lets us ignore this call when we have parent props available and
the suppression flag is set.
2017-10-06 19:50:01 -07:00
Brian Vaughn 171149a4b0 Fix failing Prettier command (#10268)
* Ran prettier over non-modified files to change them
* Fixed output of failing Prettier message to show invalid files
* Failing Prettier command now suggests 'yarn prettier-all'
2017-07-24 13:59:16 -07:00
Brandon Dail d04618b28b Run all fixtures through Prettier (#10157)
* Include fixtures in prettier default pattern

* Run all fixtures through Prettier
2017-07-12 11:19:24 -05:00
Sebastian Markbage 50d6f9656d Don't try to load asset manifest in dev mode
We're not going to use it so don't try to load it since it may not have
been built yet.
2017-04-27 21:57:01 -07:00
Sebastian Markbåge b9da1741cb SSR fixture (#9547)
Adds a server-rendering fixture based on create-react-app without ejecting.

This is using the full-page strategy because I wanted to flush out any issues with it. Turns out there's a lot of little things that are fixable and some non-fixable. This actually surfaced some differences between the current strategy and the one I had in mind.

This uses the asset manifest from webpack to pass the final URLs to the client. This ensures that we can render the same exact mark up on the client - including the URL to our own script that we're running in.

Doing full document renders work with 15.x as long as the checksum matches. However, with the patch up reviving strategy I had in mind it would end up removing the CSS tags that webpack injects before running our render call. This is a behavior change.

In dev mode the server runs a proxy in front of the normal CRA webpack server so that we can replace the HTML request for the root page.

I don't know what the best way to link in the react and react-dom packages. Each fixture has a different strategy so here's another one. Just add NODE_PATH=../../build/packages in front of all commands.
2017-04-27 21:03:32 -07:00