Seed core views in dev + fixes (#14071)

Seed core views in dev

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Raphaël Bosi
2025-08-26 13:05:20 +02:00
committed by GitHub
parent ab4fd6a182
commit 048455bbb6
13 changed files with 151 additions and 38 deletions
@@ -1,24 +1,10 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { extractFeatureFlagMapFromWorkspace } from '@/workspace/utils/extractFeatureFlagMapFromWorkspace';
import { useRecoilValue } from 'recoil';
import { FeatureFlagKey } from '~/generated/graphql';
import { buildRecordFromKeysWithSameValue } from '~/utils/array/buildRecordFromKeysWithSameValue';
import { type FeatureFlagKey } from '~/generated/graphql';
export const useFeatureFlagsMap = (): Record<FeatureFlagKey, boolean> => {
const currentWorkspace = useRecoilValue(currentWorkspaceState);
const currentWorkspaceFeatureFlags = currentWorkspace?.featureFlags;
const initialFeatureFlags = buildRecordFromKeysWithSameValue(
Object.values(FeatureFlagKey),
false,
);
if (!currentWorkspaceFeatureFlags) {
return initialFeatureFlags;
}
return currentWorkspaceFeatureFlags.reduce((acc, featureFlag) => {
acc[featureFlag.key] = featureFlag.value;
return acc;
}, initialFeatureFlags);
return extractFeatureFlagMapFromWorkspace(currentWorkspace);
};