Skip to content

Commit 4690e20

Browse files
authored
Roll out meta links resolution to all sites (#3872)
1 parent 224a44d commit 4690e20

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

packages/gitbook/src/components/SitePage/SitePage.tsx

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ async function getPageDataWithFallback(args: {
297297
}) {
298298
const { context: baseContext, pagePathParams } = args;
299299
const { context, pageTarget } = await fetchPageData(baseContext, pagePathParams);
300-
const pageMetaLinks = await (pageTarget?.page && shouldResolveMetaLinks(context.site.id)
300+
const pageMetaLinks = await (pageTarget?.page
301301
? resolvePageMetaLinks(context, pageTarget.page.id)
302302
: null);
303303

@@ -359,29 +359,6 @@ async function resolvePageMetaLinks(
359359
};
360360
}
361361

362-
/**
363-
* Determine whether to resolve meta links for a site based on a percentage rollout.
364-
*/
365-
function shouldResolveMetaLinks(siteId: string): boolean {
366-
const META_LINKS_PERCENTAGE_ROLLOUT = 50;
367-
const ALLOWED_SITES: Record<string, boolean> = {
368-
site_CZrtk: true,
369-
};
370-
371-
if (ALLOWED_SITES[siteId] || process.env.NODE_ENV === 'development') {
372-
return true;
373-
}
374-
375-
// compute a simple hash of the siteId
376-
let hash = 0;
377-
for (let i = 0; i < siteId.length; i++) {
378-
hash = (hash << 5) - hash + siteId.charCodeAt(i);
379-
hash = hash & hash; // Convert to 32-bit integer
380-
}
381-
382-
return Math.abs(hash % 100) < META_LINKS_PERCENTAGE_ROLLOUT;
383-
}
384-
385362
/**
386363
* Get the <title> for a page.
387364
*/

0 commit comments

Comments
 (0)