fix: caching and fetching of feature flags (#10837)

pull/10937/head
Thibault Mathian 2023-08-24 22:43:52 +02:00 committed by GitHub
parent 8d73d15b8a
commit f480afcace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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);
}