Skip to content

Commit

Permalink
Add Scope Component
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Apr 14, 2021
1 parent c43e29b commit d2efafd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react-server/src/ReactFizzServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ import {
REACT_MEMO_TYPE,
REACT_PROVIDER_TYPE,
REACT_CONTEXT_TYPE,
REACT_SCOPE_TYPE,
} from 'shared/ReactSymbols';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import {
disableLegacyContext,
disableModulePatternComponents,
warnAboutDefaultPropsOnFunctionComponents,
enableScopeAPI,
} from 'shared/ReactFeatureFlags';

import getComponentNameFromType from 'shared/getComponentNameFromType';
Expand Down Expand Up @@ -888,6 +890,14 @@ function renderElement(
renderNodeDestructive(request, task, props.children);
return;
}
case REACT_SCOPE_TYPE: {
if (enableScopeAPI) {
renderNodeDestructive(request, task, props.children);
return;
}
invariant(false, 'ReactDOMServer does not yet support scope components.');
}
// eslint-disable-next-line-no-fallthrough
case REACT_SUSPENSE_TYPE: {
renderSuspenseBoundary(request, task, props);
return;
Expand Down Expand Up @@ -991,6 +1001,7 @@ function renderNodeDestructive(
'Portals are not currently supported by the server renderer. ' +
'Render them conditionally so that they only appear on the client render.',
);
// eslint-disable-next-line-no-fallthrough
case REACT_LAZY_TYPE:
throw new Error('Not yet implemented node type.');
}
Expand Down

0 comments on commit d2efafd

Please sign in to comment.