Files
klz-cables.com/.pnpm-store/v10/files/f9/dba48880448bb4ad03cf6e915242a9809e5b0939031306c0ca4fc85c548e50cc662358671e5afbb0ec1a89dd81f691d17d8a3fd11203ff6ac78b273a0e8a5a
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

64 lines
1.9 KiB
Plaintext

import { jsx as _jsx } from "react/jsx-runtime";
import { getFromImportMap, isPlainObject, isReactServerComponentOrFunction } from 'payload/shared';
import React from 'react';
import { removeUndefined } from '../../utilities/removeUndefined.js';
/**
* Can be used to render both MappedComponents and React Components.
*/
export const RenderServerComponent = ({
clientProps = {},
Component,
Fallback,
importMap,
key,
serverProps
}) => {
if (Array.isArray(Component)) {
return Component.map((c, index) => RenderServerComponent({
clientProps,
Component: c,
importMap,
key: index,
serverProps
}));
}
if (typeof Component === 'function') {
const isRSC = isReactServerComponentOrFunction(Component);
// prevent $undefined from being passed through the rsc requests
const sanitizedProps = removeUndefined({
...clientProps,
...(isRSC ? serverProps : {})
});
return /*#__PURE__*/_jsx(Component, {
...sanitizedProps
}, key);
}
if (typeof Component === 'string' || isPlainObject(Component)) {
const ResolvedComponent = getFromImportMap({
importMap,
PayloadComponent: Component,
schemaPath: ''
});
if (ResolvedComponent) {
const isRSC = isReactServerComponentOrFunction(ResolvedComponent);
// prevent $undefined from being passed through rsc requests
const sanitizedProps = removeUndefined({
...clientProps,
...(isRSC ? serverProps : {}),
...(isRSC && typeof Component === 'object' && Component?.serverProps ? Component.serverProps : {}),
...(typeof Component === 'object' && Component?.clientProps ? Component.clientProps : {})
});
return /*#__PURE__*/_jsx(ResolvedComponent, {
...sanitizedProps
}, key);
}
}
return Fallback ? RenderServerComponent({
clientProps,
Component: Fallback,
importMap,
key,
serverProps
}) : null;
};
//# sourceMappingURL=index.js.map