.
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import ClientLinkComponent, { useLinkStatus } from './link';
|
||||
export default function LinkComponent(props) {
|
||||
const isLegacyBehavior = props.legacyBehavior;
|
||||
const childIsHostComponent = typeof props.children === 'string' || typeof props.children === 'number' || typeof props.children?.type === 'string';
|
||||
const childIsClientComponent = props.children?.type?.$$typeof === Symbol.for('react.client.reference');
|
||||
if (isLegacyBehavior && !childIsHostComponent && !childIsClientComponent) {
|
||||
if (props.children?.type?.$$typeof === Symbol.for('react.lazy')) {
|
||||
console.error(`Using a Lazy Component as a direct child of \`<Link legacyBehavior>\` from a Server Component is not supported. If you need legacyBehavior, wrap your Lazy Component in a Client Component that renders the Link's \`<a>\` tag.`);
|
||||
} else {
|
||||
console.error(`Using a Server Component as a direct child of \`<Link legacyBehavior>\` is not supported. If you need legacyBehavior, wrap your Server Component in a Client Component that renders the Link's \`<a>\` tag.`);
|
||||
}
|
||||
}
|
||||
return /*#__PURE__*/ _jsx(ClientLinkComponent, {
|
||||
...props
|
||||
});
|
||||
}
|
||||
export { useLinkStatus };
|
||||
|
||||
//# sourceMappingURL=link.react-server.js.map
|
||||
Reference in New Issue
Block a user