Skip to content

Commit

Permalink
Merge pull request #199 from gaearon/another-check
Browse files Browse the repository at this point in the history
Filter out dehydrated Suspense nodes
  • Loading branch information
Brian Vaughn authored Apr 20, 2019
2 parents da2ed30 + a186dc2 commit 3697ed2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/backend/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function getInternalReactConstants(version) {
ContextProvider: 10,
CoroutineComponent: -1, // Removed
CoroutineHandlerPhase: -1, // Removed
DehydratedSuspenseComponent: 18, // Behind a flag
EventComponent: 19, // Added in 16.9
EventTarget: 20, // Added in 16.9
ForwardRef: 11,
Expand All @@ -115,6 +116,7 @@ function getInternalReactConstants(version) {
ContextProvider: 12,
CoroutineComponent: -1, // Removed
CoroutineHandlerPhase: -1, // Removed
DehydratedSuspenseComponent: -1, // Doesn't exist yet
EventComponent: -1, // Doesn't exist yet
EventTarget: -1, // Doesn't exist yet
ForwardRef: 13,
Expand All @@ -141,6 +143,7 @@ function getInternalReactConstants(version) {
ContextProvider: 13,
CoroutineComponent: 7,
CoroutineHandlerPhase: 8,
DehydratedSuspenseComponent: -1, // Doesn't exist yet
EventComponent: -1, // Doesn't exist yet
EventTarget: -1, // Doesn't exist yet
ForwardRef: 14,
Expand Down Expand Up @@ -188,6 +191,7 @@ export function attach(
FunctionComponent,
ClassComponent,
ContextConsumer,
DehydratedSuspenseComponent,
EventComponent,
EventTarget,
Fragment,
Expand Down Expand Up @@ -267,6 +271,13 @@ export function attach(
case MemoComponent:
case SimpleMemoComponent:
return false;
case DehydratedSuspenseComponent:
// TODO: ideally we would show dehydrated Suspense immediately.
// However, it has some special behavior (like disconnecting
// an alternate and turning into real Suspense) which breaks DevTools.
// For now, ignore it, and only show it once it gets hydrated.
// https://github.com/bvaughn/react-devtools-experimental/issues/197
return true;
case EventComponent:
case HostPortal:
case HostComponent:
Expand Down

0 comments on commit 3697ed2

Please sign in to comment.