Skip to content

Commit

Permalink
Don't create tree node for Suspense with no fallback
Browse files Browse the repository at this point in the history
No longer required now tracking DOM root with `domRootIndex`.
  • Loading branch information
overlookmotel committed Mar 16, 2019
1 parent f1c6cb1 commit 7da62c2
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions lib/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,21 +262,17 @@ class PartialRenderer extends ReactDOMServerRenderer {
}

handleSuspense(element) {
// If fallback is undefined, it's not treated as a suspense boundary
const {fallback} = element.props;
if (fallback === undefined) return;

// Add boundary node to tree and step into it
// NB If fallback is undefined, it's not treated as a suspense boundary
const frame = last(this.stack);

let node;
const {fallback} = element.props;
if (fallback !== undefined) {
node = this.createChildWithStackState(TYPE_SUSPENSE, frame);
node.fallback = fallback;
node.suspended = false;
this.suspenseNode = node;
this.suspended = false;
} else {
node = this.createChild(null);
}
const node = this.createChildWithStackState(TYPE_SUSPENSE, frame);
node.fallback = fallback;
node.suspended = false;
this.suspenseNode = node;
this.suspended = false;

this.node = node;

Expand Down

0 comments on commit 7da62c2

Please sign in to comment.