Removed availableFilterDefinitions as a state but kept its usage as a derived state of objectMetadataItems (#9972)

The global record filter refactor will derive everything at runtime from
objectMetadataItemsState, thus removing the need for a filter definition
concept.

Here we don't yet remove available filter definition usage but we
replace the available filter definitions states, we now derive the same
value from objectMetadataItemsState.

This will allow us to progressively remove the usage of the concept of
filter definition, at the end it will then be easy to just remove from
the codebase because nothing will use it anymore.
This commit is contained in:
Lucas Bordeau
2025-02-03 17:29:57 +01:00
committed by GitHub
parent c8af90dc01
commit b29ff9b4e6
32 changed files with 566 additions and 423 deletions

View File

@ -0,0 +1,22 @@
import { CurrentWorkspace } from '@/auth/states/currentWorkspaceState';
import { isDefined } from 'twenty-shared';
import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const checkIfFeatureFlagIsEnabledOnWorkspace = (
featureKey: FeatureFlagKey | null | undefined,
workspace: CurrentWorkspace | null | undefined,
) => {
if (
!isDefined(featureKey) ||
!isDefined(workspace) ||
!isDefined(workspace.featureFlags)
) {
return false;
}
const featureFlag = workspace.featureFlags.find(
(flag) => flag.key === featureKey,
);
return featureFlag?.value === true;
};