Skip to main content

Function: hydrateComponents()

hydrateComponents(configs, env?, preview?): void

Defined in: helpers/cloudRepositoryHelpers.ts:150

Seed already-resolved component configs into the SDK cache, with no network request. The counterpart to preloadComponents.

Use it when the configs were resolved somewhere else — typically on a server and embedded in the page — so the component renders with zero round trips:

// server: const configs = { [id]: await new CloudRepository().fetchComponentV2(id) }
// client:
hydrateComponents(configs);
// <MyopComponent componentId={id} /> now renders without fetching

Pass the same env / preview the configs were resolved with; the defaults match what a plain preloadComponents([id]) would have used.

Parameters​

configs​

Record<string, IComponentConfig>

env?​

string

preview?​

boolean

Returns​

void