Skip to content

Commit

Permalink
[Fizz] Add unsupported Portal/Scope components (#21261)
Browse files Browse the repository at this point in the history
* Update Portal error message

* Add Scope Component
  • Loading branch information
sebmarkbage authored Apr 14, 2021
1 parent f4d7a0f commit a4a940d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/react-server/src/ReactFizzServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,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 @@ -890,6 +892,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 @@ -988,7 +998,12 @@ function renderNodeDestructive(
return;
}
case REACT_PORTAL_TYPE:
throw new Error('Not yet implemented node type.');
invariant(
false,
'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 a4a940d

Please sign in to comment.