MCPcopy Create free account
hub / github.com/dailydotdev/apps / getBootData

Function getBootData

packages/shared/src/lib/boot.ts:189–223  ·  view source on GitHub ↗
({
  app,
  url,
  cookies,
  pathname,
  cachedExp,
}: GetBootDataParams)

Source from the content-addressed store, hash-verified

187};
188
189export async function getBootData({
190 app,
191 url,
192 cookies,
193 pathname,
194 cachedExp,
195}: GetBootDataParams): Promise<Boot> {
196 const cached =
197 cachedExp?.fv && Object.keys(cachedExp.features ?? {}).length
198 ? cachedExp
199 : undefined;
200 const result = await fetchBoot(
201 getBootURL(app, url, pathname, cached?.fv),
202 app,
203 cookies,
204 );
205
206 if (!result.exp || result.exp.f) {
207 return enrichBootWithFeatures(result);
208 }
209
210 if (cached && cached.fv === result.exp.fv) {
211 return {
212 ...result,
213 exp: { ...result.exp, features: cached.features },
214 };
215 }
216
217 const fullResult = await fetchBoot(
218 getBootURL(app, url, pathname),
219 app,
220 cookies,
221 );
222 return enrichBootWithFeatures(fullResult);
223}

Callers 2

boot.spec.tsFile · 0.90
BootDataProviderFunction · 0.90

Calls 3

fetchBootFunction · 0.85
getBootURLFunction · 0.85
enrichBootWithFeaturesFunction · 0.85

Tested by

no test coverage detected