Add record table widget feature flag (#18960)
Introduce a new feature flag for the record table widget, enabling conditional rendering and state management based on its status. Update related components and tests accordingly. --------- Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
+14
-1
@@ -1,12 +1,16 @@
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { userLookupResultState } from '@/settings/admin-panel/states/userLookupResultState';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { type FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { type FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useFeatureFlagState = () => {
|
||||
const [userLookupResult, setUserLookupResult] = useAtomState(
|
||||
userLookupResultState,
|
||||
);
|
||||
const [currentWorkspace, setCurrentWorkspace] = useAtomState(
|
||||
currentWorkspaceState,
|
||||
);
|
||||
|
||||
const updateFeatureFlagState = (
|
||||
workspaceId: string,
|
||||
@@ -28,6 +32,15 @@ export const useFeatureFlagState = () => {
|
||||
: workspace,
|
||||
),
|
||||
});
|
||||
|
||||
if (isDefined(currentWorkspace) && currentWorkspace.id === workspaceId) {
|
||||
setCurrentWorkspace({
|
||||
...currentWorkspace,
|
||||
featureFlags: currentWorkspace.featureFlags?.map((flag) =>
|
||||
flag.key === featureFlag ? { ...flag, value } : flag,
|
||||
),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user