[Fizz] Add unsupported Portal/Scope components (#21261)

* Update Portal error message

* Add Scope Component
This commit is contained in:
Sebastian Markbåge 2021-04-14 17:35:36 -04:00 committed by GitHub
parent f4d7a0f1ea
commit a4a940d7a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -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';
@ -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;
@ -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.');
}