/** * The part of a server function's result that is sent to the browser (as * `window.__PAGE_PROPS__` and in HMR updates) and passed to the page and * root components. * * An allowlist: everything else (`response_options` with its headers and * cookies, `redirect`, cache settings, `res_transform`) is server-only and * must not end up in the HTML. */ export default function grabClientPageProps(serverRes) { if (!serverRes) return {}; const client_props = {}; if (serverRes.props !== undefined) client_props.props = serverRes.props; if (serverRes.query !== undefined) client_props.query = serverRes.query; if (serverRes.url !== undefined) client_props.url = serverRes.url; if (serverRes.error !== undefined) client_props.error = serverRes.error; return client_props; }