Function: hydrateV1Components()
hydrateV1Components(
flows):void
Defined in: helpers/cloudRepositoryHelpers.ts:178
The v1 (iframe component) counterpart of hydrateComponents: seed configs that a
server already fetched, so loadComponent needs no /flow request at all.
// server (cache it ~60 s; `prefetch=1` keeps this fetch out of the view count, `for` says which
// page it is for, so the prefetch is attributed to your site — its query string is not stored):
const flow = await (await fetch(`https://cloud.myop.dev/flow?id=${id}&auto=true&prefetch=1&for=${encodeURIComponent(pageUrl)}`)).json();
// embed JSON.stringify(flow) in the page, then on the client:
hydrateV1Components({ [id]: flow });
const cfg = await CloudRepository.Main.fetchComponentV1(id); // no request
Each seeded config is counted as a view the first time it is used (via /clientUsage).
Parameters
flows
Record<string, any>
Returns
void