blue-exabyte-67168
07/18/2023, 9:28 PMgb.setAttributesidididididswift-helmet-3648
07/19/2023, 3:57 PMidswift-helmet-3648
07/19/2023, 3:58 PMidblue-exabyte-67168
07/19/2023, 6:50 PMloadFeaturesloadFeaturesloadFeaturesswift-helmet-3648
07/19/2023, 7:51 PMGrowthBookblue-exabyte-67168
07/19/2023, 8:16 PMgetGrowthBookSSRData// Get features from API and targeting attributes during SSR
export async function getGrowthBookSSRData(
  context: Context
): Promise<GrowthBookSSRData> {
  // Server-side GrowthBook instance
  const gb = new GrowthBook({
    ...context,
  });
  // Load feature flags from network if needed
  if (context.clientKey) {
    await gb.loadFeatures();
  }
  const data: GrowthBookSSRData = {
    attributes: gb.getAttributes(),
    features: gb.getFeatures(),
  };
  gb.destroy();
  return data;
}loadFeaturesloadFeaturesswift-helmet-3648
07/19/2023, 8:20 PMgetFeaturesgb._ctx.featuresblue-exabyte-67168
07/19/2023, 8:24 PMgb._ctx.featuresblue-exabyte-67168
07/19/2023, 8:26 PMloadFeaturesswift-helmet-3648
07/19/2023, 9:11 PMswift-helmet-3648
07/19/2023, 9:16 PMblue-exabyte-67168
07/19/2023, 9:49 PMblue-exabyte-67168
07/24/2023, 7:37 PMid