From f480afcace370eed1be6575986dcb600f676dd6f Mon Sep 17 00:00:00 2001 From: Thibault Mathian Date: Thu, 24 Aug 2023 22:43:52 +0200 Subject: [PATCH] fix: caching and fetching of feature flags (#10837) --- packages/features/flags/hooks/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/features/flags/hooks/index.ts b/packages/features/flags/hooks/index.ts index 6786ce9038..4b8ca934fb 100644 --- a/packages/features/flags/hooks/index.ts +++ b/packages/features/flags/hooks/index.ts @@ -1,10 +1,12 @@ +import type { AppFlags } from "@calcom/features/flags/config"; import { trpc } from "@calcom/trpc/react"; export function useFlags() { const query = trpc.viewer.features.map.useQuery(undefined, { initialData: process.env.NEXT_PUBLIC_IS_E2E ? { "managed-event-types": true, organizations: true, teams: true } - : {}, + : undefined, + placeholderData: {}, }); - return query.data; + return query.data ?? ({} as AppFlags); }