diff --git a/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts b/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts index c3066dbf5c..27fabff12e 100644 --- a/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts +++ b/packages/twenty-front/src/hooks/__tests__/usePageChangeEffectNavigateLocation.test.ts @@ -3,7 +3,7 @@ import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePat import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus'; import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo'; import { useParams } from 'react-router-dom'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { AppPath, SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; @@ -63,14 +63,14 @@ const setupMockUseParams = (objectNamePlural?: string) => { .mockReturnValueOnce({ objectNamePlural: objectNamePlural ?? '' }); }; -jest.mock('@/ui/utilities/state/jotai/hooks/useRecoilValueV2'); +jest.mock('@/ui/utilities/state/jotai/hooks/useAtomStateValue'); const setupMockRecoil = ( objectNamePlural?: string, verifyEmailRedirectPath?: string, calendarBookingPageId?: string | null, ) => { jest - .mocked(useRecoilValueV2) + .mocked(useAtomStateValue) .mockReturnValueOnce(calendarBookingPageId ?? 'mock-calendar-id') .mockReturnValueOnce([{ namePlural: objectNamePlural ?? '' }]) .mockReturnValueOnce(verifyEmailRedirectPath); diff --git a/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts b/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts index 4f2687f486..e88684fce7 100644 --- a/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts +++ b/packages/twenty-front/src/hooks/usePageChangeEffectNavigateLocation.ts @@ -5,7 +5,7 @@ import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCu import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePath'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo'; import { useLocation, useParams } from 'react-router-dom'; import { AppPath, SettingsPath } from 'twenty-shared/types'; @@ -23,7 +23,7 @@ export const usePageChangeEffectNavigateLocation = () => { ); const { defaultHomePagePath } = useDefaultHomePagePath(); const location = useLocation(); - const calendarBookingPageId = useRecoilValueV2(calendarBookingPageIdState); + const calendarBookingPageId = useAtomStateValue(calendarBookingPageIdState); const someMatchingLocationOf = (appPaths: AppPath[]): boolean => appPaths.some((appPath) => isMatchingLocation(location, appPath)); @@ -45,11 +45,11 @@ export const usePageChangeEffectNavigateLocation = () => { ]; const objectNamePlural = useParams().objectNamePlural ?? ''; - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems?.find( (objectMetadataItem) => objectMetadataItem.namePlural === objectNamePlural, ); - const verifyEmailRedirectPath = useRecoilValueV2( + const verifyEmailRedirectPath = useAtomStateValue( verifyEmailRedirectPathState, ); diff --git a/packages/twenty-front/src/localization/states/dateLocaleState.ts b/packages/twenty-front/src/localization/states/dateLocaleState.ts index 09ad6457e4..f531263c17 100644 --- a/packages/twenty-front/src/localization/states/dateLocaleState.ts +++ b/packages/twenty-front/src/localization/states/dateLocaleState.ts @@ -2,14 +2,14 @@ import { type Locale } from 'date-fns'; import { enUS } from 'date-fns/locale'; import { type APP_LOCALES } from 'twenty-shared/translations'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; type DateLocaleState = { locale?: keyof typeof APP_LOCALES; localeCatalog: Locale; }; -export const dateLocaleState = createStateV2({ +export const dateLocaleState = createAtomState({ key: 'dateLocaleState', defaultValue: { locale: undefined, diff --git a/packages/twenty-front/src/modules/action-menu/actions/components/ActionModal.tsx b/packages/twenty-front/src/modules/action-menu/actions/components/ActionModal.tsx index 13d0cb9298..6895f3e013 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/components/ActionModal.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/components/ActionModal.tsx @@ -8,7 +8,7 @@ import { useCloseActionMenu } from '@/action-menu/hooks/useCloseActionMenu'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type ButtonAccent } from 'twenty-ui/input'; export type ActionModalProps = { @@ -49,7 +49,7 @@ export const ActionModal = ({ const modalId = `${actionConfig?.key}-action-modal-${actionMenuType}`; - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx b/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx index d63f92cd32..0ed770838c 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/components/ActionOpenSidePanelPage.tsx @@ -2,7 +2,7 @@ import { ActionDisplay } from '@/action-menu/actions/display/components/ActionDi import { ActionConfigContext } from '@/action-menu/contexts/ActionConfigContext'; import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu'; import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type MessageDescriptor } from '@lingui/core'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; @@ -26,7 +26,7 @@ export const ActionOpenSidePanelPage = ({ const { navigateCommandMenu } = useNavigateCommandMenu(); - const setCommandMenuSearchState = useSetRecoilStateV2(commandMenuSearchState); + const setCommandMenuSearchState = useSetAtomState(commandMenuSearchState); if (!actionConfig) { return null; diff --git a/packages/twenty-front/src/modules/action-menu/actions/display/components/ActionDropdownItem.tsx b/packages/twenty-front/src/modules/action-menu/actions/display/components/ActionDropdownItem.tsx index 805c4464d8..55abb466e5 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/display/components/ActionDropdownItem.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/display/components/ActionDropdownItem.tsx @@ -4,7 +4,7 @@ import { SelectableListItem } from '@/ui/layout/selectable-list/components/Selec import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { useNavigate } from 'react-router-dom'; import { isDefined } from 'twenty-shared/utils'; import { MenuItem } from 'twenty-ui/navigation'; @@ -31,7 +31,7 @@ export const ActionDropdownItem = ({ SelectableListComponentInstanceContext, ); - const isSelected = useRecoilComponentFamilyValueV2( + const isSelected = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, action.key, selectableListInstanceId, diff --git a/packages/twenty-front/src/modules/action-menu/actions/display/components/HeadlessFrontComponentAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/display/components/HeadlessFrontComponentAction.tsx index 95bff6f83c..4fe5d740d6 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/display/components/HeadlessFrontComponentAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/display/components/HeadlessFrontComponentAction.tsx @@ -1,7 +1,7 @@ import { ActionConfigContext } from '@/action-menu/contexts/ActionConfigContext'; import { useCloseActionMenu } from '@/action-menu/hooks/useCloseActionMenu'; import { isHeadlessFrontComponentMountedFamilySelector } from '@/front-components/selectors/isHeadlessFrontComponentMountedFamilySelector'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useContext } from 'react'; import { ActionDisplay } from './ActionDisplay'; @@ -20,7 +20,7 @@ export const HeadlessFrontComponentAction = ({ closeSidePanelOnCommandMenuListActionExecution: false, }); - const isMounted = useFamilySelectorValueV2( + const isMounted = useAtomFamilySelectorValue( isHeadlessFrontComponentMountedFamilySelector, frontComponentId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DeleteMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DeleteMultipleRecordsAction.tsx index 2ff1d7d00b..d48bb900b7 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DeleteMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DeleteMultipleRecordsAction.tsx @@ -14,7 +14,7 @@ import { useRemoveSelectedRecordsFromRecordBoard } from '@/object-record/record- import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore'; import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -22,7 +22,7 @@ export const DeleteMultipleRecordsAction = () => { const { recordIndexId, objectMetadataItem } = useRecordIndexIdFromCurrentContextStore(); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, recordIndexId, ); @@ -33,22 +33,22 @@ export const DeleteMultipleRecordsAction = () => { const { resetTableRowSelection } = useResetTableRowSelection(recordIndexId); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, recordIndexId, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, recordIndexId, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DestroyMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DestroyMultipleRecordsAction.tsx index db0a4a50cb..2bd06c04ff 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DestroyMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/DestroyMultipleRecordsAction.tsx @@ -14,7 +14,7 @@ import { useRemoveSelectedRecordsFromRecordBoard } from '@/object-record/record- import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore'; import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; import { type RecordGqlOperationFilter } from 'twenty-shared/types'; @@ -24,7 +24,7 @@ export const DestroyMultipleRecordsAction = () => { const { recordIndexId, objectMetadataItem } = useRecordIndexIdFromCurrentContextStore(); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, recordIndexId, ); @@ -37,22 +37,22 @@ export const DestroyMultipleRecordsAction = () => { const { removeSelectedRecordsFromRecordBoard } = useRemoveSelectedRecordsFromRecordBoard(recordIndexId); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, recordIndexId, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, recordIndexId, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/ExportMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/ExportMultipleRecordsAction.tsx index 79ab2219e4..0442b10923 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/ExportMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/ExportMultipleRecordsAction.tsx @@ -7,14 +7,14 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { useRecordIndexExportRecords } from '@/object-record/record-index/export/hooks/useRecordIndexExportRecords'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const ExportMultipleRecordsAction = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx index 4e17d26f6a..5a52993083 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/MergeMultipleRecordsAction.tsx @@ -3,12 +3,12 @@ import { useSelectedRecordIds } from '@/action-menu/actions/record-actions/singl import { useOpenMergeRecordsPageInCommandMenu } from '@/command-menu/hooks/useOpenMergeRecordsPageInCommandMenu'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const MergeMultipleRecordsAction = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/RestoreMultipleRecordsAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/RestoreMultipleRecordsAction.tsx index 665f21bb97..ac51f94b42 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/RestoreMultipleRecordsAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/multiple-records/components/RestoreMultipleRecordsAction.tsx @@ -12,7 +12,7 @@ import { useRemoveSelectedRecordsFromRecordBoard } from '@/object-record/record- import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore'; import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { type RecordGqlOperationFilter } from 'twenty-shared/types'; @@ -20,7 +20,7 @@ export const RestoreMultipleRecordsAction = () => { const { recordIndexId, objectMetadataItem } = useRecordIndexIdFromCurrentContextStore(); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, recordIndexId, ); @@ -37,22 +37,22 @@ export const RestoreMultipleRecordsAction = () => { objectNameSingular: objectMetadataItem.nameSingular, }); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, recordIndexId, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, recordIndexId, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/CreateNewViewNoSelectionRecord.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/CreateNewViewNoSelectionRecord.tsx index 68ec33ccf9..c81db6342c 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/CreateNewViewNoSelectionRecord.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/CreateNewViewNoSelectionRecord.tsx @@ -3,8 +3,8 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId'; import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode'; import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState'; @@ -13,7 +13,7 @@ export const CreateNewViewNoSelectionRecord = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); const { openDropdown } = useOpenDropdown(); - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); @@ -26,7 +26,7 @@ export const CreateNewViewNoSelectionRecord = () => { currentViewId, ); - const setViewPickerReferenceViewId = useSetRecoilComponentStateV2( + const setViewPickerReferenceViewId = useSetAtomComponentState( viewPickerReferenceViewIdComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/HideDeletedRecordsNoSelectionRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/HideDeletedRecordsNoSelectionRecordAction.tsx index 0a306f97bb..512e157699 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/HideDeletedRecordsNoSelectionRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/HideDeletedRecordsNoSelectionRecordAction.tsx @@ -6,13 +6,13 @@ import { useRemoveRecordFilter } from '@/object-record/record-filter/hooks/useRe import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { useHandleToggleTrashColumnFilter } from '@/object-record/record-index/hooks/useHandleToggleTrashColumnFilter'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const HideDeletedRecordsNoSelectionRecordAction = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); @@ -32,7 +32,7 @@ export const HideDeletedRecordsNoSelectionRecordAction = () => { const { isRecordFilterAboutSoftDelete } = useCheckIsSoftDeleteFilter(); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/SeeDeletedRecordsNoSelectionRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/SeeDeletedRecordsNoSelectionRecordAction.tsx index 65a89c7560..b457b269d3 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/SeeDeletedRecordsNoSelectionRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/no-selection/components/SeeDeletedRecordsNoSelectionRecordAction.tsx @@ -3,12 +3,12 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { useHandleToggleTrashColumnFilter } from '@/object-record/record-index/hooks/useHandleToggleTrashColumnFilter'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const SeeDeletedRecordsNoSelectionRecordAction = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsx index 8974a381bb..1a60eba4ea 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/run-workflow-actions/hooks/useRunWorkflowRecordActions.tsx @@ -8,7 +8,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useActiveWorkflowVersionsWithManualTrigger } from '@/workflow/hooks/useActiveWorkflowVersionsWithManualTrigger'; import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion'; @@ -33,12 +33,12 @@ export const useRunWorkflowRecordActions = ({ const { enqueueWarningSnackBar } = useSnackBar(); const { recordIndexId } = useRecordIndexIdFromCurrentContextStore(); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); - const isPageInEditMode = useRecoilComponentValueV2( + const isPageInEditMode = useAtomComponentStateValue( contextStoreIsPageInEditModeComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/AddToFavoritesSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/AddToFavoritesSingleRecordAction.tsx index 302dcd41b3..40c043c09a 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/AddToFavoritesSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/AddToFavoritesSingleRecordAction.tsx @@ -3,7 +3,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { useCreateFavorite } from '@/favorites/hooks/useCreateFavorite'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; export const AddToFavoritesSingleRecordAction = () => { @@ -13,7 +13,7 @@ export const AddToFavoritesSingleRecordAction = () => { const { createFavorite } = useCreateFavorite(); - const selectedRecord = useFamilyRecoilValueV2( + const selectedRecord = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportNoteActionSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportNoteActionSingleRecordAction.tsx index 4f6df7f5f2..88c85b7862 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportNoteActionSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportNoteActionSingleRecordAction.tsx @@ -1,13 +1,13 @@ import { Action } from '@/action-menu/actions/components/Action'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; export const ExportNoteActionSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const selectedRecord = useFamilyRecoilValueV2( + const selectedRecord = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportSingleRecordAction.tsx index 71e3c36d76..1f341c6e19 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/components/ExportSingleRecordAction.tsx @@ -2,14 +2,14 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { useExportSingleRecord } from '@/object-record/record-show/hooks/useExportSingleRecord'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { Action } from '@/action-menu/actions/components/Action'; export const ExportSingleRecordAction = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx index 5cd84cef3a..cf35093ea6 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/CancelDashboardSingleRecordAction.tsx @@ -4,12 +4,12 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useResetDraftPageLayoutToPersistedPageLayout } from '@/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout'; import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; export const CancelDashboardSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const selectedRecord = useFamilyRecoilValueV2( + const selectedRecord = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx index ba3378279e..9c7649910f 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/EditDashboardSingleRecordAction.tsx @@ -2,13 +2,13 @@ import { Action } from '@/action-menu/actions/components/Action'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useResetLocationHash } from 'twenty-ui/utilities'; export const EditDashboardSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const selectedRecord = useFamilyRecoilValueV2( + const selectedRecord = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx index 370d551afc..2967c689c9 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/dashboard-actions/components/SaveDashboardSingleRecordAction.tsx @@ -4,12 +4,12 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useSavePageLayout } from '@/page-layout/hooks/useSavePageLayout'; import { useSetIsPageLayoutInEditMode } from '@/page-layout/hooks/useSetIsPageLayoutInEditMode'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; export const SaveDashboardSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const selectedRecord = useFamilyRecoilValueV2( + const selectedRecord = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow.tsx index a5bc5a5ebd..2b01308dc0 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow.tsx @@ -1,8 +1,8 @@ import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useSelectedRecordIdOrThrow = () => { - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIds.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIds.tsx index 2395e90219..0d57e7a3bf 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIds.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIds.tsx @@ -1,8 +1,8 @@ import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useSelectedRecordIds = () => { - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeVersionWorkflowRunSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeVersionWorkflowRunSingleRecordAction.tsx index 0da2cb62ac..ae9d135400 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeVersionWorkflowRunSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeVersionWorkflowRunSingleRecordAction.tsx @@ -2,13 +2,13 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { AppPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const SeeVersionWorkflowRunSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const workflowRun = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const workflowRun = useAtomFamilyStateValue(recordStoreFamilyState, recordId); if (!isDefined(workflowRun) || !isDefined(workflowRun?.workflowVersion?.id)) { return null; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeWorkflowWorkflowRunSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeWorkflowWorkflowRunSingleRecordAction.tsx index 2b9dddf4ef..0b48c2556a 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeWorkflowWorkflowRunSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/SeeWorkflowWorkflowRunSingleRecordAction.tsx @@ -2,13 +2,13 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { AppPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const SeeWorkflowWorkflowRunSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const workflowRun = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const workflowRun = useAtomFamilyStateValue(recordStoreFamilyState, recordId); if (!isDefined(workflowRun) || !isDefined(workflowRun?.workflow?.id)) { return null; diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/StopWorkflowRunSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/StopWorkflowRunSingleRecordAction.tsx index 0312268f6f..337b667485 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/StopWorkflowRunSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-run-actions/components/StopWorkflowRunSingleRecordAction.tsx @@ -9,29 +9,29 @@ import { DEFAULT_QUERY_PAGE_SIZE } from '@/object-record/constants/DefaultQueryP import { useLazyFetchAllRecords } from '@/object-record/hooks/useLazyFetchAllRecords'; import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useStopWorkflowRun } from '@/workflow/hooks/useStopWorkflowRun'; export const StopWorkflowRunSingleRecordAction = () => { const { objectMetadataItem, recordIndexId } = useRecordIndexIdFromCurrentContextStore(); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, recordIndexId, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, recordIndexId, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeRunsWorkflowVersionSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeRunsWorkflowVersionSingleRecordAction.tsx index c5c3f074a5..dcc90967b9 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeRunsWorkflowVersionSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeRunsWorkflowVersionSingleRecordAction.tsx @@ -2,7 +2,7 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { AppPath, ViewFilterOperand } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -40,7 +40,7 @@ const SeeRunsWorkflowVersionSingleRecordActionContent = ({ export const SeeRunsWorkflowVersionSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const workflowVersion = useFamilyRecoilValueV2( + const workflowVersion = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeVersionsWorkflowVersionSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeVersionsWorkflowVersionSingleRecordAction.tsx index bd71e4a33c..44b40f01cf 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeVersionsWorkflowVersionSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeVersionsWorkflowVersionSingleRecordAction.tsx @@ -3,7 +3,7 @@ import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { AppPath, ViewFilterOperand } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -33,7 +33,7 @@ const SeeVersionsWorkflowVersionSingleRecordActionContent = ({ export const SeeVersionsWorkflowVersionSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const workflowVersion = useFamilyRecoilValueV2( + const workflowVersion = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeWorkflowWorkflowVersionSingleRecordAction.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeWorkflowWorkflowVersionSingleRecordAction.tsx index be7aa2adb4..77a3666cb0 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeWorkflowWorkflowVersionSingleRecordAction.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-actions/single-record/workflow-version-actions/components/SeeWorkflowWorkflowVersionSingleRecordAction.tsx @@ -2,12 +2,12 @@ import { ActionLink } from '@/action-menu/actions/components/ActionLink'; import { useSelectedRecordIdOrThrow } from '@/action-menu/actions/record-actions/single-record/hooks/useSelectedRecordIdOrThrow'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { AppPath } from 'twenty-shared/types'; export const SeeWorkflowWorkflowVersionSingleRecordAction = () => { const recordId = useSelectedRecordIdOrThrow(); - const workflowVersion = useFamilyRecoilValueV2( + const workflowVersion = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx index ed5a8c8b18..fb01ceac65 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx +++ b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx @@ -4,7 +4,7 @@ import { ActionType } from '@/action-menu/actions/types/ActionType'; import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useActiveWorkflowVersionsWithManualTrigger } from '@/workflow/hooks/useActiveWorkflowVersionsWithManualTrigger'; import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion'; import { COMMAND_MENU_DEFAULT_ICON } from '@/workflow/workflow-trigger/constants/CommandMenuDefaultIcon'; @@ -15,7 +15,7 @@ import { useIcons } from 'twenty-ui/display'; export const useRunWorkflowRecordAgnosticActions = () => { const { getIcon } = useIcons(); - const isPageInEditMode = useRecoilComponentValueV2( + const isPageInEditMode = useAtomComponentStateValue( contextStoreIsPageInEditModeComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/action-menu/actions/states/forceRegisteredActionsMapComponentState.ts b/packages/twenty-front/src/modules/action-menu/actions/states/forceRegisteredActionsMapComponentState.ts index f64b60267b..01ed4e5f1e 100644 --- a/packages/twenty-front/src/modules/action-menu/actions/states/forceRegisteredActionsMapComponentState.ts +++ b/packages/twenty-front/src/modules/action-menu/actions/states/forceRegisteredActionsMapComponentState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const forceRegisteredActionsByKeyState = createStateV2< +export const forceRegisteredActionsByKeyState = createAtomState< Record >({ key: 'forceRegisteredActionsByKeyComponentState', diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx index 22bc6ae1f9..0b35d8c340 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenu.tsx @@ -3,11 +3,11 @@ import { RecordIndexActionMenuDropdown } from '@/action-menu/components/RecordIn import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuContextProvider'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsMobile } from 'twenty-ui/utilities'; export const RecordIndexActionMenu = () => { - const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2( + const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx index 422e65f8f5..d371fd2127 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordIndexActionMenuDropdown.tsx @@ -15,7 +15,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { useContext } from 'react'; @@ -49,7 +49,7 @@ export const RecordIndexActionMenuDropdown = () => { const dropdownId = getActionMenuDropdownIdFromActionMenuId(actionMenuId); const { closeDropdown } = useCloseDropdown(); - const actionMenuDropdownPosition = useRecoilComponentValueV2( + const actionMenuDropdownPosition = useAtomComponentStateValue( recordIndexActionMenuDropdownPositionComponentState, dropdownId, ); @@ -61,7 +61,7 @@ export const RecordIndexActionMenuDropdown = () => { 'more-actions', ]; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx index cee4ee76c6..d11e0f214a 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowActionMenu.tsx @@ -3,16 +3,16 @@ import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuCont import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsMobile } from 'twenty-ui/utilities'; export const RecordShowActionMenu = () => { - const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2( + const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerActionMenu.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerActionMenu.tsx index 37accb98b8..5567b54d6e 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerActionMenu.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerActionMenu.tsx @@ -2,10 +2,10 @@ import { CommandMenuActionMenuDropdown } from '@/action-menu/components/CommandM import { ActionMenuContextProvider } from '@/action-menu/contexts/ActionMenuContextProvider'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const RecordShowRightDrawerActionMenu = () => { - const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2( + const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx index be4fce8c46..1cc2722196 100644 --- a/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx +++ b/packages/twenty-front/src/modules/action-menu/components/RecordShowRightDrawerOpenRecordButton.tsx @@ -14,11 +14,11 @@ import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTab import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { t } from '@lingui/core/macro'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { AppPath } from 'twenty-shared/types'; @@ -37,7 +37,7 @@ export const RecordShowRightDrawerOpenRecordButton = ({ objectNameSingular, recordId, }: RecordShowRightDrawerOpenRecordButtonProps) => { - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId) as + const record = useAtomFamilyStateValue(recordStoreFamilyState, recordId) as | ObjectRecord | null | undefined; @@ -52,7 +52,7 @@ export const RecordShowRightDrawerOpenRecordButton = ({ targetObjectId: recordId, }); - const activeTabIdInRightDrawer = useRecoilComponentValueV2( + const activeTabIdInRightDrawer = useAtomComponentStateValue( activeTabIdComponentState, tabListComponentId, ); @@ -61,12 +61,12 @@ export const RecordShowRightDrawerOpenRecordButton = ({ targetObjectId: recordId, }); - const setActiveTabIdInRecordPage = useSetRecoilComponentStateV2( + const setActiveTabIdInRecordPage = useSetAtomComponentState( activeTabIdComponentState, tabListComponentIdInRecordPage, ); - const parentViewState = useRecoilComponentStateCallbackStateV2( + const parentViewState = useAtomComponentStateCallbackState( contextStoreRecordShowParentViewComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx index ee52c30ce9..01cf7e0d47 100644 --- a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx +++ b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx @@ -6,8 +6,8 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; export const ActionMenuContextProvider = ({ @@ -20,12 +20,12 @@ export const ActionMenuContextProvider = ({ children: React.ReactNode; objectMetadataItemOverride?: ObjectMetadataItem; }) => { - const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2( + const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItemOverride ?? diff --git a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderDefault.tsx b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderDefault.tsx index 322a230cb6..7c6d4adcaf 100644 --- a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderDefault.tsx +++ b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderDefault.tsx @@ -10,7 +10,7 @@ import { useCommandMenuItemFrontComponentActions } from '@/command-menu-item/hoo import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const ActionMenuContextProviderDefault = ({ objectMetadataItem, @@ -35,7 +35,7 @@ export const ActionMenuContextProviderDefault = ({ const actions = useRegisteredActions(shouldBeRegisteredParams); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderWorkflowObjects.tsx b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderWorkflowObjects.tsx index cd97f1b001..50e6b4e9dd 100644 --- a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderWorkflowObjects.tsx +++ b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProviderWorkflowObjects.tsx @@ -10,8 +10,8 @@ import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainCo import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { type WorkflowWithCurrentVersion } from '@/workflow/types/Workflow'; import { isDefined } from 'twenty-shared/utils'; @@ -123,7 +123,7 @@ export const ActionMenuContextProviderWorkflowObjects = ({ actionMenuType, children, }: ActionMenuContextProviderWorkflowObjectsProps) => { - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); @@ -135,7 +135,8 @@ export const ActionMenuContextProviderWorkflowObjects = ({ : undefined; const selectedRecord = - useFamilyRecoilValueV2(recordStoreFamilyState, recordId ?? '') || undefined; + useAtomFamilyStateValue(recordStoreFamilyState, recordId ?? '') || + undefined; if (isDefined(selectedRecord?.id)) { return ( diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.ts b/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.ts index 0a0bb7a00b..04349dbb90 100644 --- a/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.ts +++ b/packages/twenty-front/src/modules/action-menu/hooks/useRegisteredActions.ts @@ -10,7 +10,7 @@ import { contextStoreIsPageInEditModeComponentState } from '@/context-store/stat import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore'; import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; @@ -22,19 +22,19 @@ export const useRegisteredActions = ( const { getIcon } = useIcons(); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const contextStoreCurrentViewType = useRecoilComponentValueV2( + const contextStoreCurrentViewType = useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); const { recordIndexId } = useRecordIndexIdFromCurrentContextStore(); - const isFullTabWidgetInEditMode = useRecoilComponentValueV2( + const isFullTabWidgetInEditMode = useAtomComponentStateValue( contextStoreIsPageInEditModeComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts index 07a28ae548..563c14535b 100644 --- a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts +++ b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts @@ -17,10 +17,10 @@ import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record- import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject'; import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/record-filter/states/hasAnySoftDeleteFilterOnView'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useCallback, useContext, useMemo } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -39,7 +39,7 @@ export const useShouldActionBeRegisteredParams = ({ FeatureFlagKey.IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED, ); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); @@ -76,7 +76,8 @@ export const useShouldActionBeRegisteredParams = ({ ]); const selectedRecord = - useFamilyRecoilValueV2(recordStoreFamilyState, recordId ?? '') || undefined; + useAtomFamilyStateValue(recordStoreFamilyState, recordId ?? '') || + undefined; const objectPermissions = useObjectPermissionsForObject( objectMetadataItem?.id ?? '', @@ -90,23 +91,23 @@ export const useShouldActionBeRegisteredParams = ({ const { recordIndexId } = useRecordIndexIdFromCurrentContextStore(); - const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2( + const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue( hasAnySoftDeleteFilterOnViewComponentSelector, recordIndexId, ); const isShowPage = - useRecoilComponentValueV2( + useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ) === ContextStoreViewType.ShowPage; - const numberOfSelectedRecords = useRecoilComponentValueV2( + const numberOfSelectedRecords = useAtomComponentStateValue( contextStoreNumberOfSelectedRecordsComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const contextStoreCurrentViewType = useRecoilComponentValueV2( + const contextStoreCurrentViewType = useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); @@ -140,11 +141,11 @@ export const useShouldActionBeRegisteredParams = ({ [store], ); - const forceRegisteredActionsByKey = useRecoilValueV2( + const forceRegisteredActionsByKey = useAtomStateValue( forceRegisteredActionsByKeyState, ); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const isFeatureFlagEnabled = (featureFlagKey: FeatureFlagKey) => { const featureFlag = currentWorkspace?.featureFlags?.find( diff --git a/packages/twenty-front/src/modules/action-menu/states/recordIndexActionMenuDropdownPositionComponentState.ts b/packages/twenty-front/src/modules/action-menu/states/recordIndexActionMenuDropdownPositionComponentState.ts index 5116c24d21..d0e471d94f 100644 --- a/packages/twenty-front/src/modules/action-menu/states/recordIndexActionMenuDropdownPositionComponentState.ts +++ b/packages/twenty-front/src/modules/action-menu/states/recordIndexActionMenuDropdownPositionComponentState.ts @@ -1,9 +1,9 @@ import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; import { type PositionType } from '@/action-menu/types/PositionType'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordIndexActionMenuDropdownPositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexActionMenuDropdownPositionComponentState', defaultValue: { x: null, diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx index cfb9b2dcd1..6e22ff98f1 100644 --- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx +++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventRow.tsx @@ -2,7 +2,7 @@ import { css, useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { format } from 'date-fns'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CalendarChannelVisibility, type TimelineCalendarEvent, @@ -85,7 +85,7 @@ export const CalendarEventRow = ({ className, }: CalendarEventRowProps) => { const theme = useTheme(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { openCalendarEventInCommandMenu } = useOpenCalendarEventInCommandMenu(); diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsx index b6b91017de..ad509af693 100644 --- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsx +++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventsCard.tsx @@ -1,4 +1,4 @@ -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { format, getYear } from 'date-fns'; @@ -49,7 +49,7 @@ const StyledTitleContainer = styled.div` export const CalendarEventsCard = () => { const { t } = useLingui(); const targetRecord = useTargetRecord(); - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const [query, queryName] = targetRecord.targetObjectNameSingular === CoreObjectNameSingular.Person diff --git a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx index 091e748206..c15354a89d 100644 --- a/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx +++ b/packages/twenty-front/src/modules/activities/components/ActivityRichTextEditor.tsx @@ -5,7 +5,7 @@ import { v4 } from 'uuid'; import { useUploadAttachmentFile } from '@/activities/files/hooks/useUploadAttachmentFile'; import { useUpsertActivity } from '@/activities/hooks/useUpsertActivity'; import { canCreateActivityState } from '@/activities/states/canCreateActivityState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { getActivityTargetObjectFieldIdName } from '@/activities/utils/getActivityTargetObjectFieldIdName'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; @@ -126,7 +126,7 @@ export const ActivityRichTextEditor = ({ } }, 300); - const [canCreateActivity, setCanCreateActivity] = useRecoilStateV2( + const [canCreateActivity, setCanCreateActivity] = useAtomState( canCreateActivityState, ); diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadHeader.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadHeader.tsx index 6fa88d5c3f..d83acafbe4 100644 --- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadHeader.tsx +++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadHeader.tsx @@ -1,4 +1,4 @@ -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -43,7 +43,7 @@ export const EmailThreadHeader = ({ subject, lastMessageSentAt, }: EmailThreadHeaderProps) => { - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const lastMessageSentAtFormatted = beautifyPastDateRelativeToNow( lastMessageSentAt, localeCatalog, diff --git a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsx b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsx index c0147a8ebe..6dc9809bd2 100644 --- a/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsx +++ b/packages/twenty-front/src/modules/activities/emails/components/EmailThreadMessageSender.tsx @@ -2,7 +2,7 @@ import styled from '@emotion/styled'; import { ParticipantChip } from '@/activities/components/ParticipantChip'; import { type EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { AppTooltip, TooltipPosition } from 'twenty-ui/display'; import { dateLocaleState } from '~/localization/states/dateLocaleState'; import { @@ -31,7 +31,7 @@ export const EmailThreadMessageSender = ({ sender, sentAt, }: EmailThreadMessageSenderProps) => { - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const tooltipId = `date-tooltip-${sentAt.replace(/[^a-zA-Z0-9]/g, '-')}`; return ( diff --git a/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.ts b/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.ts index b7cb289080..3691441325 100644 --- a/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.ts +++ b/packages/twenty-front/src/modules/activities/emails/states/lastViewableEmailThreadIdState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const emailThreadIdWhenEmailThreadWasClosedState = createStateV2< +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const emailThreadIdWhenEmailThreadWasClosedState = createAtomState< string | null >({ key: 'emailThreadIdWhenEmailThreadWasClosedState', diff --git a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx index 536c0ca50a..c19ba08009 100644 --- a/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx +++ b/packages/twenty-front/src/modules/activities/files/components/AttachmentList.tsx @@ -11,7 +11,7 @@ import { type ActivityTargetableObject } from '@/activities/types/ActivityTarget import { isAttachmentPreviewEnabledState } from '@/client-config/states/isAttachmentPreviewEnabledState'; import { Modal } from '@/ui/layout/modal/components/Modal'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { ActivityList } from '@/activities/components/ActivityList'; import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag'; @@ -135,7 +135,7 @@ export const AttachmentList = ({ const [previewedAttachment, setPreviewedAttachment] = useState(null); - const isAttachmentPreviewEnabled = useRecoilValueV2( + const isAttachmentPreviewEnabled = useAtomStateValue( isAttachmentPreviewEnabledState, ); diff --git a/packages/twenty-front/src/modules/activities/hooks/__tests__/useActivityTargetObjectRecords.test.tsx b/packages/twenty-front/src/modules/activities/hooks/__tests__/useActivityTargetObjectRecords.test.tsx index 470e197bbc..a027b2c759 100644 --- a/packages/twenty-front/src/modules/activities/hooks/__tests__/useActivityTargetObjectRecords.test.tsx +++ b/packages/twenty-front/src/modules/activities/hooks/__tests__/useActivityTargetObjectRecords.test.tsx @@ -9,7 +9,7 @@ import { useActivityTargetObjectRecords } from '@/activities/hooks/useActivityTa import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext'; import { JestObjectMetadataItemSetter } from '~/testing/jest/JestObjectMetadataItemSetter'; @@ -140,7 +140,7 @@ describe('useActivityTargetObjectRecords', () => { const { result } = renderHook( () => { - const setRecordFromStore = useSetFamilyRecoilStateV2( + const setRecordFromStore = useSetAtomFamilyState( recordStoreFamilyState, task.id, ); diff --git a/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx b/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx index 1dad9988b4..846910fcbd 100644 --- a/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx +++ b/packages/twenty-front/src/modules/activities/hooks/__tests__/useOpenCreateActivityDrawer.test.tsx @@ -5,7 +5,7 @@ import { useOpenCreateActivityDrawer } from '@/activities/hooks/useOpenCreateAct import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import gql from 'graphql-tag'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; @@ -83,7 +83,7 @@ describe('useOpenCreateActivityDrawer', () => { const openActivityRightDrawer = useOpenCreateActivityDrawer({ activityObjectNameSingular: CoreObjectNameSingular.Note, }); - const viewableRecordId = useRecoilValueV2(viewableRecordIdState); + const viewableRecordId = useAtomStateValue(viewableRecordIdState); return { openActivityRightDrawer, viewableRecordId, diff --git a/packages/twenty-front/src/modules/activities/hooks/useActivityTargetObjectRecords.ts b/packages/twenty-front/src/modules/activities/hooks/useActivityTargetObjectRecords.ts index 38a5fab531..4c192c60fa 100644 --- a/packages/twenty-front/src/modules/activities/hooks/useActivityTargetObjectRecords.ts +++ b/packages/twenty-front/src/modules/activities/hooks/useActivityTargetObjectRecords.ts @@ -5,8 +5,8 @@ import { type TaskTarget } from '@/activities/types/TaskTarget'; import { getActivityTargetObjectRecords } from '@/activities/utils/getActivityTargetObjectRecords'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type Nullable } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -14,9 +14,9 @@ export const useActivityTargetObjectRecords = ( activityRecordId?: string, activityTargets?: Nullable, ) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); - const activity = useFamilyRecoilValueV2( + const activity = useAtomFamilyStateValue( recordStoreFamilyState, activityRecordId ?? '', ) as Note | Task | null; diff --git a/packages/twenty-front/src/modules/activities/hooks/useActivityTargetsForTargetableObjects.ts b/packages/twenty-front/src/modules/activities/hooks/useActivityTargetsForTargetableObjects.ts index d0470b62e9..67682e0336 100644 --- a/packages/twenty-front/src/modules/activities/hooks/useActivityTargetsForTargetableObjects.ts +++ b/packages/twenty-front/src/modules/activities/hooks/useActivityTargetsForTargetableObjects.ts @@ -9,7 +9,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; @@ -32,7 +32,7 @@ export const useActivityTargetsForTargetableObjects = ({ activityTargetsOrderByVariables: RecordGqlOperationOrderBy; limit: number; }) => { - const objectMetadataItems = useRecoilValueV2( + const objectMetadataItems = useAtomStateValue( objectMetadataItemsState, ); const isNoteTargetMigrated = useIsFeatureEnabled( diff --git a/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts b/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts index 3834611674..44bd5ff5c0 100644 --- a/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts +++ b/packages/twenty-front/src/modules/activities/hooks/useOpenCreateActivityDrawer.ts @@ -5,7 +5,7 @@ import { viewableRecordNameSingularState } from '@/object-record/record-right-dr import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember'; import { isUpsertingActivityInDBState } from '@/activities/states/isCreatingActivityInDBState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity'; import { type Note } from '@/activities/types/Note'; import { type NoteTarget } from '@/activities/types/NoteTarget'; @@ -39,15 +39,15 @@ export const useOpenCreateActivityDrawer = ({ shouldMatchRootQueryFilter: true, }); - const setActivityTargetableEntityArray = useSetRecoilStateV2( + const setActivityTargetableEntityArray = useSetAtomState( activityTargetableEntityArrayState, ); - const setViewableRecordId = useSetRecoilStateV2(viewableRecordIdState); - const setViewableRecordNameSingular = useSetRecoilStateV2( + const setViewableRecordId = useSetAtomState(viewableRecordIdState); + const setViewableRecordNameSingular = useSetAtomState( viewableRecordNameSingularState, ); - const setIsUpsertingActivityInDB = useSetRecoilStateV2( + const setIsUpsertingActivityInDB = useSetAtomState( isUpsertingActivityInDBState, ); diff --git a/packages/twenty-front/src/modules/activities/hooks/useRefreshShowPageFindManyActivitiesQueries.ts b/packages/twenty-front/src/modules/activities/hooks/useRefreshShowPageFindManyActivitiesQueries.ts index e20559cbe6..f80fffb1eb 100644 --- a/packages/twenty-front/src/modules/activities/hooks/useRefreshShowPageFindManyActivitiesQueries.ts +++ b/packages/twenty-front/src/modules/activities/hooks/useRefreshShowPageFindManyActivitiesQueries.ts @@ -1,7 +1,7 @@ import { usePrepareFindManyActivitiesQuery } from '@/activities/hooks/usePrepareFindManyActivitiesQuery'; import { objectShowPageTargetableObjectStateV2 } from '@/activities/timeline-activities/states/objectShowPageTargetableObjectStateV2'; import { type CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; // This hook should only be executed if the normalized cache is up-to-date @@ -12,7 +12,7 @@ export const useRefreshShowPageFindManyActivitiesQueries = ({ }: { activityObjectNameSingular: CoreObjectNameSingular; }) => { - const objectShowPageTargetableObject = useRecoilValueV2( + const objectShowPageTargetableObject = useAtomStateValue( objectShowPageTargetableObjectStateV2, ); diff --git a/packages/twenty-front/src/modules/activities/hooks/useUpsertActivity.ts b/packages/twenty-front/src/modules/activities/hooks/useUpsertActivity.ts index 7064b671fb..b3e62042d2 100644 --- a/packages/twenty-front/src/modules/activities/hooks/useUpsertActivity.ts +++ b/packages/twenty-front/src/modules/activities/hooks/useUpsertActivity.ts @@ -8,8 +8,8 @@ import { type Task } from '@/activities/types/Task'; import { type CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { isDefined } from 'twenty-shared/utils'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useUpsertActivity = ({ activityObjectNameSingular, @@ -18,9 +18,7 @@ export const useUpsertActivity = ({ | CoreObjectNameSingular.Task | CoreObjectNameSingular.Note; }) => { - const [isActivityInCreateMode] = useRecoilStateV2( - isActivityInCreateModeState, - ); + const [isActivityInCreateMode] = useAtomState(isActivityInCreateModeState); const { updateOneRecord: updateOneActivity } = useUpdateOneRecord(); @@ -28,11 +26,11 @@ export const useUpsertActivity = ({ activityObjectNameSingular, }); - const [, setIsUpsertingActivityInDB] = useRecoilStateV2( + const [, setIsUpsertingActivityInDB] = useAtomState( isUpsertingActivityInDBState, ); - const objectShowPageTargetableObject = useRecoilValueV2( + const objectShowPageTargetableObject = useAtomStateValue( objectShowPageTargetableObjectStateV2, ); diff --git a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useUpdateActivityTargetFromCell.ts b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useUpdateActivityTargetFromCell.ts index 676062f64b..bea4a1e29f 100644 --- a/packages/twenty-front/src/modules/activities/inline-cell/hooks/useUpdateActivityTargetFromCell.ts +++ b/packages/twenty-front/src/modules/activities/inline-cell/hooks/useUpdateActivityTargetFromCell.ts @@ -10,7 +10,7 @@ import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord'; import { searchRecordStoreFamilyState } from '@/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState'; import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useCallback } from 'react'; import { useStore } from 'jotai'; @@ -66,7 +66,7 @@ export const useUpdateActivityTargetFromCell = ({ : isNoteTargetMigrated; const store = useStore(); - const setActivityFromStore = useSetFamilyRecoilStateV2( + const setActivityFromStore = useSetAtomFamilyState( recordStoreFamilyState, activityId, ); diff --git a/packages/twenty-front/src/modules/activities/notes/hooks/useNotes.ts b/packages/twenty-front/src/modules/activities/notes/hooks/useNotes.ts index 683aae9482..fff3a27276 100644 --- a/packages/twenty-front/src/modules/activities/notes/hooks/useNotes.ts +++ b/packages/twenty-front/src/modules/activities/notes/hooks/useNotes.ts @@ -9,7 +9,7 @@ import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; export const useNotes = (targetableObject: ActivityTargetableObject) => { const notesQueryVariables = useMemo( @@ -34,7 +34,7 @@ export const useNotes = (targetableObject: ActivityTargetableObject) => { }); const [currentNotesQueryVariables, setCurrentNotesQueryVariables] = - useRecoilStateV2(currentNotesQueryVariablesStateV2); + useAtomState(currentNotesQueryVariablesStateV2); // TODO: fix useEffect, remove with better pattern useEffect(() => { diff --git a/packages/twenty-front/src/modules/activities/notes/states/currentNotesQueryVariablesStateV2.ts b/packages/twenty-front/src/modules/activities/notes/states/currentNotesQueryVariablesStateV2.ts index 8e0a76a2bd..fb4896be36 100644 --- a/packages/twenty-front/src/modules/activities/notes/states/currentNotesQueryVariablesStateV2.ts +++ b/packages/twenty-front/src/modules/activities/notes/states/currentNotesQueryVariablesStateV2.ts @@ -1,9 +1,9 @@ import { type RecordGqlOperationVariables } from 'twenty-shared/types'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const currentNotesQueryVariablesStateV2 = - createStateV2({ + createAtomState({ key: 'currentNotesQueryVariablesStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/activities/states/activityBodyFamilyState.ts b/packages/twenty-front/src/modules/activities/states/activityBodyFamilyState.ts index 94cb81297b..e8393c5d6b 100644 --- a/packages/twenty-front/src/modules/activities/states/activityBodyFamilyState.ts +++ b/packages/twenty-front/src/modules/activities/states/activityBodyFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const activityBodyFamilyState = createFamilyStateV2< +export const activityBodyFamilyState = createAtomFamilyState< string, { activityId: string } >({ diff --git a/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.ts b/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.ts index c89dd1b33a..fdd6e8daf8 100644 --- a/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.ts +++ b/packages/twenty-front/src/modules/activities/states/activityTargetableEntityArrayState.ts @@ -1,7 +1,7 @@ import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const activityTargetableEntityArrayState = createStateV2< +export const activityTargetableEntityArrayState = createAtomState< ActivityTargetableObject[] >({ key: 'activities/targetable-entity-array', diff --git a/packages/twenty-front/src/modules/activities/states/canCreateActivityState.ts b/packages/twenty-front/src/modules/activities/states/canCreateActivityState.ts index 63e59a07af..ac8d753506 100644 --- a/packages/twenty-front/src/modules/activities/states/canCreateActivityState.ts +++ b/packages/twenty-front/src/modules/activities/states/canCreateActivityState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const canCreateActivityState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const canCreateActivityState = createAtomState({ key: 'canCreateActivityState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.ts b/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.ts index 13a6172ecb..9e04c32024 100644 --- a/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.ts +++ b/packages/twenty-front/src/modules/activities/states/isActivityInCreateModeState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isActivityInCreateModeState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isActivityInCreateModeState = createAtomState({ key: 'isActivityInCreateModeState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.ts b/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.ts index 3bba22da26..e51f23b59e 100644 --- a/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.ts +++ b/packages/twenty-front/src/modules/activities/states/isCreatingActivityInDBState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isUpsertingActivityInDBState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isUpsertingActivityInDBState = createAtomState({ key: 'isUpsertingActivityInDBState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/activities/tasks/components/TaskGroups.tsx b/packages/twenty-front/src/modules/activities/tasks/components/TaskGroups.tsx index 94e39f41ce..4d6e6eca67 100644 --- a/packages/twenty-front/src/modules/activities/tasks/components/TaskGroups.tsx +++ b/packages/twenty-front/src/modules/activities/tasks/components/TaskGroups.tsx @@ -9,7 +9,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import groupBy from 'lodash.groupby'; import { IconPlus } from 'twenty-ui/display'; @@ -55,7 +55,7 @@ export const TaskGroups = ({ targetableObject }: TaskGroupsProps) => { activityObjectNameSingular: CoreObjectNameSingular.Task, }); - const activeTabId = useRecoilComponentValueV2(activeTabIdComponentState); + const activeTabId = useAtomComponentStateValue(activeTabIdComponentState); const isLoading = (activeTabId !== 'done' && tasksLoading) || diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/components/EventRow.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/components/EventRow.tsx index 0f1306ccec..4ebb5ddfdc 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/components/EventRow.tsx +++ b/packages/twenty-front/src/modules/activities/timeline-activities/components/EventRow.tsx @@ -1,5 +1,5 @@ import styled from '@emotion/styled'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useContext } from 'react'; import { TimelineActivityContext } from '@/activities/timeline-activities/contexts/TimelineActivityContext'; @@ -13,7 +13,7 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembe import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { getObjectRecordIdentifier } from '@/object-metadata/utils/getObjectRecordIdentifier'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { dateLocaleState } from '~/localization/states/dateLocaleState'; import { beautifyPastDateRelativeToNow } from '~/utils/date-utils'; import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull'; @@ -93,17 +93,17 @@ export const EventRow = ({ event, mainObjectMetadataItem, }: EventRowProps) => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const { recordId } = useContext(TimelineActivityContext); - const recordFromStore = useFamilyRecoilValueV2( + const recordFromStore = useAtomFamilyStateValue( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/hooks/useLinkedObjectObjectMetadataItem.ts b/packages/twenty-front/src/modules/activities/timeline-activities/hooks/useLinkedObjectObjectMetadataItem.ts index ad92b5a353..b493089a6e 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/hooks/useLinkedObjectObjectMetadataItem.ts +++ b/packages/twenty-front/src/modules/activities/timeline-activities/hooks/useLinkedObjectObjectMetadataItem.ts @@ -1,9 +1,9 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useLinkedObjectObjectMetadataItem = (id: string | null) => { - const objectMetadataItems: ObjectMetadataItem[] = useRecoilValueV2( + const objectMetadataItems: ObjectMetadataItem[] = useAtomStateValue( objectMetadataItemsState, ); diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventFieldDiffValueEffect.tsx b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventFieldDiffValueEffect.tsx index 400a470cb5..d559eed26b 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventFieldDiffValueEffect.tsx +++ b/packages/twenty-front/src/modules/activities/timeline-activities/rows/main-object/components/EventFieldDiffValueEffect.tsx @@ -3,7 +3,7 @@ import { useEffect } from 'react'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { isDefined } from 'twenty-shared/utils'; export const EventFieldDiffValueEffect = ({ @@ -17,7 +17,7 @@ export const EventFieldDiffValueEffect = ({ mainObjectMetadataItem: ObjectMetadataItem; fieldMetadataItem: FieldMetadataItem; }) => { - const setEntity = useSetFamilyRecoilStateV2( + const setEntity = useSetAtomFamilyState( recordStoreFamilyState, diffArtificialRecordStoreId, ); diff --git a/packages/twenty-front/src/modules/activities/timeline-activities/states/objectShowPageTargetableObjectStateV2.ts b/packages/twenty-front/src/modules/activities/timeline-activities/states/objectShowPageTargetableObjectStateV2.ts index 87dbf332e5..fdf61999fb 100644 --- a/packages/twenty-front/src/modules/activities/timeline-activities/states/objectShowPageTargetableObjectStateV2.ts +++ b/packages/twenty-front/src/modules/activities/timeline-activities/states/objectShowPageTargetableObjectStateV2.ts @@ -1,9 +1,9 @@ import { type ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const objectShowPageTargetableObjectStateV2 = - createStateV2({ + createAtomState({ key: 'objectShowPageTargetableObjectStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ai/components/AIChatMessage.tsx b/packages/twenty-front/src/modules/ai/components/AIChatMessage.tsx index 14685ac5aa..c8838011d9 100644 --- a/packages/twenty-front/src/modules/ai/components/AIChatMessage.tsx +++ b/packages/twenty-front/src/modules/ai/components/AIChatMessage.tsx @@ -6,7 +6,7 @@ import { AgentMessageRole } from '@/ai/constants/AgentMessageRole'; import { AIChatAssistantMessageRenderer } from '@/ai/components/AIChatAssistantMessageRenderer'; import { AIChatErrorRenderer } from '@/ai/components/AIChatErrorRenderer'; import { LightCopyIconButton } from '@/object-record/record-field/ui/components/LightCopyIconButton'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type ExtendedUIMessage } from 'twenty-shared/ai'; import { isDefined } from 'twenty-shared/utils'; import { dateLocaleState } from '~/localization/states/dateLocaleState'; @@ -141,7 +141,7 @@ export const AIChatMessage = ({ isLastMessageStreaming: boolean; error?: Error | null; }) => { - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const isUser = message.role === AgentMessageRole.USER; const showError = diff --git a/packages/twenty-front/src/modules/ai/components/AIChatTab.tsx b/packages/twenty-front/src/modules/ai/components/AIChatTab.tsx index 9407a666b3..13c6d10beb 100644 --- a/packages/twenty-front/src/modules/ai/components/AIChatTab.tsx +++ b/packages/twenty-front/src/modules/ai/components/AIChatTab.tsx @@ -22,7 +22,7 @@ import { useAIChatFileUpload } from '@/ai/hooks/useAIChatFileUpload'; import { useAgentChatContextOrThrow } from '@/ai/hooks/useAgentChatContextOrThrow'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledContainer = styled.div<{ isDraggingFile: boolean }>` background: ${({ theme }) => theme.background.primary}; @@ -144,7 +144,7 @@ export const AIChatTab = () => { const hasMessages = messages.length > 0; const { uploadFiles } = useAIChatFileUpload(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const smartModelLabel = useAiModelLabel(currentWorkspace?.smartModel, false); const { editor, handleSendAndClear } = useAIChatEditor({ diff --git a/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx b/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx index 297a15b05a..84a05b4766 100644 --- a/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx +++ b/packages/twenty-front/src/modules/ai/components/AIChatThreadGroup.tsx @@ -2,8 +2,8 @@ import { agentChatUsageStateV2 } from '@/ai/states/agentChatUsageStateV2'; import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadStateV2'; import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState'; import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; @@ -79,13 +79,11 @@ export const AIChatThreadGroup = ({ }) => { const { t } = useLingui(); const theme = useTheme(); - const [, setCurrentAIChatThread] = useRecoilStateV2( - currentAIChatThreadStateV2, - ); - const setCurrentAIChatThreadTitle = useSetRecoilStateV2( + const [, setCurrentAIChatThread] = useAtomState(currentAIChatThreadStateV2); + const setCurrentAIChatThreadTitle = useSetAtomState( currentAIChatThreadTitleState, ); - const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2); + const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2); const { openAskAIPage } = useOpenAskAIPageInCommandMenu(); const handleThreadClick = (thread: AgentChatThread) => { diff --git a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx index 54ad716bb0..99d60caaec 100644 --- a/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx +++ b/packages/twenty-front/src/modules/ai/components/ThinkingStepsDisplay.tsx @@ -26,7 +26,7 @@ import { isThinkingStepPartActive } from '@/ai/utils/isThinkingStepPartActive'; import { type ThinkingStepPart } from '@/ai/utils/thinkingStepPart'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCopyToClipboard } from '~/hooks/useCopyToClipboard'; const StyledContainer = styled.div` @@ -277,7 +277,7 @@ const ThinkingToolStepRow = ({ ? unwrappedResult.data.result : unwrappedOutput; const toolTabListComponentInstanceId = `ai-thinking-tool-tabs-${part.toolCallId ?? rawToolName}-${rowIndex}`; - const activeToolTabId = useRecoilComponentValueV2( + const activeToolTabId = useAtomComponentStateValue( activeTabIdComponentState, toolTabListComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx b/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx index 896a04318f..ff742f7da1 100644 --- a/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx +++ b/packages/twenty-front/src/modules/ai/components/internal/AIChatContextUsageButton.tsx @@ -13,7 +13,7 @@ import { agentChatUsageStateV2, type AgentChatLastMessageUsage, } from '@/ai/states/agentChatUsageStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledContainer = styled.div` position: relative; @@ -114,7 +114,7 @@ export const AIChatContextUsageButton = () => { const { t } = useLingui(); const theme = useTheme(); const [isHovered, setIsHovered] = useState(false); - const agentChatUsage = useRecoilValueV2(agentChatUsageStateV2); + const agentChatUsage = useAtomStateValue(agentChatUsageStateV2); if (!agentChatUsage) { return ( diff --git a/packages/twenty-front/src/modules/ai/components/internal/AgentChatContextPreview.tsx b/packages/twenty-front/src/modules/ai/components/internal/AgentChatContextPreview.tsx index 41271a65e6..b4dfb43059 100644 --- a/packages/twenty-front/src/modules/ai/components/internal/AgentChatContextPreview.tsx +++ b/packages/twenty-front/src/modules/ai/components/internal/AgentChatContextPreview.tsx @@ -1,6 +1,6 @@ import { agentChatSelectedFilesStateV2 } from '@/ai/states/agentChatSelectedFilesStateV2'; import { agentChatUploadedFilesStateV2 } from '@/ai/states/agentChatUploadedFilesStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import styled from '@emotion/styled'; import { AgentChatFilePreview } from './AgentChatFilePreview'; @@ -19,10 +19,10 @@ const StyledPreviewsContainer = styled.div` `; export const AgentChatContextPreview = () => { - const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useRecoilStateV2( + const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useAtomState( agentChatSelectedFilesStateV2, ); - const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useRecoilStateV2( + const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useAtomState( agentChatUploadedFilesStateV2, ); diff --git a/packages/twenty-front/src/modules/ai/components/internal/AgentChatFileUploadButton.tsx b/packages/twenty-front/src/modules/ai/components/internal/AgentChatFileUploadButton.tsx index c2732305ad..7bcc9caa26 100644 --- a/packages/twenty-front/src/modules/ai/components/internal/AgentChatFileUploadButton.tsx +++ b/packages/twenty-front/src/modules/ai/components/internal/AgentChatFileUploadButton.tsx @@ -1,6 +1,6 @@ import { useAIChatFileUpload } from '@/ai/hooks/useAIChatFileUpload'; import { agentChatSelectedFilesStateV2 } from '@/ai/states/agentChatSelectedFilesStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import React, { useRef } from 'react'; @@ -18,7 +18,7 @@ const StyledFileInput = styled.input` `; export const AgentChatFileUploadButton = () => { - const setAgentChatSelectedFiles = useSetRecoilStateV2( + const setAgentChatSelectedFiles = useSetAtomState( agentChatSelectedFilesStateV2, ); const fileInputRef = useRef(null); diff --git a/packages/twenty-front/src/modules/ai/components/internal/SendMessageButton.tsx b/packages/twenty-front/src/modules/ai/components/internal/SendMessageButton.tsx index 053cceff95..df6b3c166b 100644 --- a/packages/twenty-front/src/modules/ai/components/internal/SendMessageButton.tsx +++ b/packages/twenty-front/src/modules/ai/components/internal/SendMessageButton.tsx @@ -1,6 +1,6 @@ import { useAgentChatContextOrThrow } from '@/ai/hooks/useAgentChatContextOrThrow'; import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { IconArrowUp, IconPlayerStop } from 'twenty-ui/display'; import { RoundedIconButton } from 'twenty-ui/input'; @@ -9,7 +9,7 @@ type SendMessageButtonProps = { }; export const SendMessageButton = ({ onSend }: SendMessageButtonProps) => { - const agentChatInput = useRecoilValueV2(agentChatInputStateV2); + const agentChatInput = useAtomStateValue(agentChatInputStateV2); const { handleStop, isLoading, isStreaming } = useAgentChatContextOrThrow(); if (isStreaming) { diff --git a/packages/twenty-front/src/modules/ai/components/suggested-prompts/AIChatSuggestedPrompts.tsx b/packages/twenty-front/src/modules/ai/components/suggested-prompts/AIChatSuggestedPrompts.tsx index 65dcb8d4e6..114f2dc9f3 100644 --- a/packages/twenty-front/src/modules/ai/components/suggested-prompts/AIChatSuggestedPrompts.tsx +++ b/packages/twenty-front/src/modules/ai/components/suggested-prompts/AIChatSuggestedPrompts.tsx @@ -9,7 +9,7 @@ import { type SuggestedPrompt, } from '@/ai/components/suggested-prompts/default-suggested-prompts'; import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; const StyledContainer = styled.div` display: flex; @@ -43,7 +43,7 @@ export const AIChatSuggestedPrompts = ({ editor, }: AIChatSuggestedPromptsProps) => { const { t: resolveMessage } = useLingui(); - const setAgentChatInput = useSetRecoilStateV2(agentChatInputStateV2); + const setAgentChatInput = useSetAtomState(agentChatInputStateV2); const handleClick = (prompt: SuggestedPrompt) => { const picked = pickRandom(prompt.prefillPrompts); diff --git a/packages/twenty-front/src/modules/ai/hooks/useAIChatEditor.ts b/packages/twenty-front/src/modules/ai/hooks/useAIChatEditor.ts index 727955c0c5..19eb2c358d 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAIChatEditor.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAIChatEditor.ts @@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils'; import { AI_CHAT_INPUT_ID } from '@/ai/constants/AiChatInputId'; import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { MENTION_SUGGESTION_PLUGIN_KEY } from '@/mention/constants/MentionSuggestionPluginKey'; import { MentionSuggestion } from '@/mention/extensions/MentionSuggestion'; import { MentionTag } from '@/mention/extensions/MentionTag'; @@ -25,7 +25,7 @@ type UseAIChatEditorProps = { }; export const useAIChatEditor = ({ onSendMessage }: UseAIChatEditorProps) => { - const setAgentChatInput = useSetRecoilStateV2(agentChatInputStateV2); + const setAgentChatInput = useSetAtomState(agentChatInputStateV2); const { searchMentionRecords } = useMentionSearch(); const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); const { removeFocusItemFromFocusStackById } = diff --git a/packages/twenty-front/src/modules/ai/hooks/useAIChatFileUpload.ts b/packages/twenty-front/src/modules/ai/hooks/useAIChatFileUpload.ts index 0bf857eb5d..d95e8ee24d 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAIChatFileUpload.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAIChatFileUpload.ts @@ -1,7 +1,7 @@ import { agentChatSelectedFilesStateV2 } from '@/ai/states/agentChatSelectedFilesStateV2'; import { agentChatUploadedFilesStateV2 } from '@/ai/states/agentChatUploadedFilesStateV2'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useApolloClient } from '@apollo/client'; import { useLingui } from '@lingui/react/macro'; import { type FileUIPart } from 'ai'; @@ -17,10 +17,10 @@ export const useAIChatFileUpload = () => { const [uploadFile] = useUploadFileMutation({ client: apolloClient }); const { t } = useLingui(); const { enqueueErrorSnackBar } = useSnackBar(); - const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useRecoilStateV2( + const [agentChatSelectedFiles, setAgentChatSelectedFiles] = useAtomState( agentChatSelectedFilesStateV2, ); - const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useRecoilStateV2( + const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useAtomState( agentChatUploadedFilesStateV2, ); diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts index a5d24a2a2b..ed1b326525 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChat.ts @@ -6,9 +6,9 @@ import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadState import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState'; import { agentChatInputStateV2 } from '@/ai/states/agentChatInputStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { REST_API_BASE_URL } from '@/apollo/constant/rest-api-base-url'; import { getTokenPair } from '@/apollo/utils/getTokenPair'; import { renewToken } from '@/auth/services/AuthService'; @@ -21,25 +21,25 @@ import { REACT_APP_SERVER_BASE_URL } from '~/config'; import { cookieStorage } from '~/utils/cookie-storage'; export const useAgentChat = (uiMessages: ExtendedUIMessage[]) => { - const setTokenPair = useSetRecoilStateV2(tokenPairState); - const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2); + const setTokenPair = useSetAtomState(tokenPairState); + const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2); const { getBrowsingContext } = useGetBrowsingContext(); - const setCurrentAIChatThreadTitle = useSetRecoilStateV2( + const setCurrentAIChatThreadTitle = useSetAtomState( currentAIChatThreadTitleState, ); - const agentChatSelectedFiles = useRecoilValueV2( + const agentChatSelectedFiles = useAtomStateValue( agentChatSelectedFilesStateV2, ); - const currentAIChatThread = useRecoilValueV2(currentAIChatThreadStateV2); + const currentAIChatThread = useAtomStateValue(currentAIChatThreadStateV2); - const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useRecoilStateV2( + const [agentChatUploadedFiles, setAgentChatUploadedFiles] = useAtomState( agentChatUploadedFilesStateV2, ); - const [agentChatInput, setAgentChatInput] = useRecoilStateV2( + const [agentChatInput, setAgentChatInput] = useAtomState( agentChatInputStateV2, ); diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChatData.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChatData.ts index 71fab08ce6..0845b5839d 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAgentChatData.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChatData.ts @@ -7,8 +7,8 @@ import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadState import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState'; import { isCreatingChatThreadStateV2 } from '@/ai/states/isCreatingChatThreadStateV2'; import { mapDBMessagesToUIMessages } from '@/ai/utils/mapDBMessagesToUIMessages'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type SetterOrUpdater } from 'recoil'; import { isDefined } from 'twenty-shared/utils'; import { @@ -41,14 +41,14 @@ const setUsageFromThread = ( }; export const useAgentChatData = () => { - const [currentAIChatThread, setCurrentAIChatThread] = useRecoilStateV2( + const [currentAIChatThread, setCurrentAIChatThread] = useAtomState( currentAIChatThreadStateV2, ); - const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2); - const setCurrentAIChatThreadTitle = useSetRecoilStateV2( + const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2); + const setCurrentAIChatThreadTitle = useSetAtomState( currentAIChatThreadTitleState, ); - const [isCreatingChatThread, setIsCreatingChatThread] = useRecoilStateV2( + const [isCreatingChatThread, setIsCreatingChatThread] = useAtomState( isCreatingChatThreadStateV2, ); diff --git a/packages/twenty-front/src/modules/ai/hooks/useAgentChatScrollToBottom.ts b/packages/twenty-front/src/modules/ai/hooks/useAgentChatScrollToBottom.ts index 7acf0f9bdc..c659891c65 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAgentChatScrollToBottom.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAgentChatScrollToBottom.ts @@ -1,7 +1,7 @@ import { AI_CHAT_SCROLL_WRAPPER_ID } from '@/ai/constants/AiChatScrollWrapperId'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; import { scrollWrapperScrollBottomComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollBottomComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; const SCROLL_BOTTOM_THRESHOLD_PX = 10; @@ -11,7 +11,7 @@ export const useAgentChatScrollToBottom = () => { AI_CHAT_SCROLL_WRAPPER_ID, ); - const scrollBottom = useRecoilComponentValueV2( + const scrollBottom = useAtomComponentStateValue( scrollWrapperScrollBottomComponentState, AI_CHAT_SCROLL_WRAPPER_ID, ); diff --git a/packages/twenty-front/src/modules/ai/hooks/useAiModelOptions.ts b/packages/twenty-front/src/modules/ai/hooks/useAiModelOptions.ts index e5a5eaf6c2..51f6309650 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useAiModelOptions.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useAiModelOptions.ts @@ -4,13 +4,13 @@ import { DEFAULT_FAST_MODEL } from '@/ai/constants/DefaultFastModel'; import { DEFAULT_SMART_MODEL } from '@/ai/constants/DefaultSmartModel'; import { useWorkspaceAiModelAvailability } from '@/ai/hooks/useWorkspaceAiModelAvailability'; import { aiModelsState } from '@/client-config/states/aiModelsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getModelProviderLabel } from '~/pages/settings/ai/utils/getModelProviderLabel'; export const useAiModelOptions = ( includeDeprecated = false, ): SelectOption[] => { - const aiModels = useRecoilValueV2(aiModelsState); + const aiModels = useAtomStateValue(aiModelsState); const { isModelEnabled } = useWorkspaceAiModelAvailability(); return aiModels @@ -34,7 +34,7 @@ export const useAiModelLabel = ( modelId: string | undefined, includeProvider = true, ): string => { - const aiModels = useRecoilValueV2(aiModelsState); + const aiModels = useAtomStateValue(aiModelsState); if (!modelId) { return ''; diff --git a/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts b/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts index bb4a72aa2b..2d680dea5f 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useCreateNewAIChatThread.ts @@ -2,16 +2,14 @@ import { agentChatUsageStateV2 } from '@/ai/states/agentChatUsageStateV2'; import { currentAIChatThreadStateV2 } from '@/ai/states/currentAIChatThreadStateV2'; import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState'; import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useCreateChatThreadMutation } from '~/generated-metadata/graphql'; export const useCreateNewAIChatThread = () => { - const [, setCurrentAIChatThread] = useRecoilStateV2( - currentAIChatThreadStateV2, - ); - const setAgentChatUsage = useSetRecoilStateV2(agentChatUsageStateV2); - const setCurrentAIChatThreadTitle = useSetRecoilStateV2( + const [, setCurrentAIChatThread] = useAtomState(currentAIChatThreadStateV2); + const setAgentChatUsage = useSetAtomState(agentChatUsageStateV2); + const setCurrentAIChatThreadTitle = useSetAtomState( currentAIChatThreadTitleState, ); diff --git a/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelAvailability.ts b/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelAvailability.ts index 7240343989..4e6b52ecb4 100644 --- a/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelAvailability.ts +++ b/packages/twenty-front/src/modules/ai/hooks/useWorkspaceAiModelAvailability.ts @@ -2,7 +2,7 @@ import { DEFAULT_FAST_MODEL } from '@/ai/constants/DefaultFastModel'; import { DEFAULT_SMART_MODEL } from '@/ai/constants/DefaultSmartModel'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { aiModelsState } from '@/client-config/states/aiModelsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type ClientAiModelConfig } from '~/generated-metadata/graphql'; const VIRTUAL_MODEL_IDS: Set = new Set([ @@ -13,8 +13,8 @@ const VIRTUAL_MODEL_IDS: Set = new Set([ const isVirtualModel = (modelId: string) => VIRTUAL_MODEL_IDS.has(modelId); export const useWorkspaceAiModelAvailability = () => { - const aiModels = useRecoilValueV2(aiModelsState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const aiModels = useAtomStateValue(aiModelsState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const useRecommendedModels = currentWorkspace?.useRecommendedModels ?? true; const autoEnableNewAiModels = currentWorkspace?.autoEnableNewAiModels ?? true; diff --git a/packages/twenty-front/src/modules/ai/states/agentChatInputStateV2.ts b/packages/twenty-front/src/modules/ai/states/agentChatInputStateV2.ts index 76be61e5f4..b9a7fc1415 100644 --- a/packages/twenty-front/src/modules/ai/states/agentChatInputStateV2.ts +++ b/packages/twenty-front/src/modules/ai/states/agentChatInputStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const agentChatInputStateV2 = createStateV2({ +export const agentChatInputStateV2 = createAtomState({ key: 'agentChatInputStateV2', defaultValue: '', }); diff --git a/packages/twenty-front/src/modules/ai/states/agentChatMessagesComponentState.ts b/packages/twenty-front/src/modules/ai/states/agentChatMessagesComponentState.ts index d87e69405f..7333116fc9 100644 --- a/packages/twenty-front/src/modules/ai/states/agentChatMessagesComponentState.ts +++ b/packages/twenty-front/src/modules/ai/states/agentChatMessagesComponentState.ts @@ -1,11 +1,11 @@ import { createComponentInstanceContext } from '@/ui/utilities/state/component-state/utils/createComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type AgentMessage } from '~/generated-metadata/graphql'; export const AgentChatMessagesComponentInstanceContext = createComponentInstanceContext(); -export const agentChatMessagesComponentState = createComponentStateV2< +export const agentChatMessagesComponentState = createAtomComponentState< AgentMessage[] >({ key: 'agentChatMessagesComponentState', diff --git a/packages/twenty-front/src/modules/ai/states/agentChatSelectedFilesStateV2.ts b/packages/twenty-front/src/modules/ai/states/agentChatSelectedFilesStateV2.ts index e805a8feda..94451c30b1 100644 --- a/packages/twenty-front/src/modules/ai/states/agentChatSelectedFilesStateV2.ts +++ b/packages/twenty-front/src/modules/ai/states/agentChatSelectedFilesStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const agentChatSelectedFilesStateV2 = createStateV2({ +export const agentChatSelectedFilesStateV2 = createAtomState({ key: 'ai/agentChatSelectedFilesStateV2', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/ai/states/agentChatUploadedFilesStateV2.ts b/packages/twenty-front/src/modules/ai/states/agentChatUploadedFilesStateV2.ts index b3782ab45b..7c2fa3ad22 100644 --- a/packages/twenty-front/src/modules/ai/states/agentChatUploadedFilesStateV2.ts +++ b/packages/twenty-front/src/modules/ai/states/agentChatUploadedFilesStateV2.ts @@ -1,8 +1,8 @@ import { type FileUIPart } from 'ai'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const agentChatUploadedFilesStateV2 = createStateV2({ +export const agentChatUploadedFilesStateV2 = createAtomState({ key: 'ai/agentChatUploadedFilesStateV2', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/ai/states/agentChatUsageStateV2.ts b/packages/twenty-front/src/modules/ai/states/agentChatUsageStateV2.ts index 449dc0a744..c635c6f375 100644 --- a/packages/twenty-front/src/modules/ai/states/agentChatUsageStateV2.ts +++ b/packages/twenty-front/src/modules/ai/states/agentChatUsageStateV2.ts @@ -1,4 +1,4 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export type AgentChatLastMessageUsage = { inputTokens: number; @@ -18,7 +18,8 @@ export type AgentChatUsageState = { outputCredits: number; }; -export const agentChatUsageStateV2 = createStateV2({ - key: 'agentChatUsageStateV2', - defaultValue: null, -}); +export const agentChatUsageStateV2 = + createAtomState({ + key: 'agentChatUsageStateV2', + defaultValue: null, + }); diff --git a/packages/twenty-front/src/modules/ai/states/currentAIChatThreadStateV2.ts b/packages/twenty-front/src/modules/ai/states/currentAIChatThreadStateV2.ts index 878067e1cb..b7827e7e8b 100644 --- a/packages/twenty-front/src/modules/ai/states/currentAIChatThreadStateV2.ts +++ b/packages/twenty-front/src/modules/ai/states/currentAIChatThreadStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentAIChatThreadStateV2 = createStateV2({ +export const currentAIChatThreadStateV2 = createAtomState({ key: 'ai/currentAIChatThreadStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ai/states/currentAIChatThreadTitleState.ts b/packages/twenty-front/src/modules/ai/states/currentAIChatThreadTitleState.ts index d11788ffd5..72a9aac137 100644 --- a/packages/twenty-front/src/modules/ai/states/currentAIChatThreadTitleState.ts +++ b/packages/twenty-front/src/modules/ai/states/currentAIChatThreadTitleState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentAIChatThreadTitleState = createStateV2({ +export const currentAIChatThreadTitleState = createAtomState({ key: 'ai/currentAIChatThreadTitleState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ai/states/isCreatingChatThreadStateV2.ts b/packages/twenty-front/src/modules/ai/states/isCreatingChatThreadStateV2.ts index cc2253694c..b6c5eb54ab 100644 --- a/packages/twenty-front/src/modules/ai/states/isCreatingChatThreadStateV2.ts +++ b/packages/twenty-front/src/modules/ai/states/isCreatingChatThreadStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isCreatingChatThreadStateV2 = createStateV2({ +export const isCreatingChatThreadStateV2 = createAtomState({ key: 'ai/isCreatingChatThreadStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts b/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts index f16dd58f27..614a0e0ed7 100644 --- a/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts +++ b/packages/twenty-front/src/modules/apollo/hooks/useApolloFactory.ts @@ -11,9 +11,9 @@ import { previousUrlState } from '@/auth/states/previousUrlState'; import { tokenPairState } from '@/auth/states/tokenPairState'; import { appVersionState } from '@/client-config/states/appVersionState'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { AppPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { REACT_APP_SERVER_BASE_URL } from '~/config'; @@ -25,20 +25,18 @@ export const useApolloFactory = (options: Partial> = {}) => { const apolloRef = useRef | null>(null); const navigate = useNavigate(); - const setTokenPair = useSetRecoilStateV2(tokenPairState); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const setTokenPair = useSetAtomState(tokenPairState); + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); - const appVersion = useRecoilValueV2(appVersionState); - const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilStateV2( + const appVersion = useAtomStateValue(appVersionState); + const [currentWorkspaceMember, setCurrentWorkspaceMember] = useAtomState( currentWorkspaceMemberState, ); - const setCurrentUser = useSetRecoilStateV2(currentUserState); - const setCurrentUserWorkspace = useSetRecoilStateV2( - currentUserWorkspaceState, - ); + const setCurrentUser = useSetAtomState(currentUserState); + const setCurrentUserWorkspace = useSetAtomState(currentUserWorkspaceState); - const setPreviousUrl = useSetRecoilStateV2(previousUrlState); + const setPreviousUrl = useSetAtomState(previousUrlState); const location = useLocation(); const { enqueueErrorSnackBar } = useSnackBar(); diff --git a/packages/twenty-front/src/modules/app/components/AppRouter.tsx b/packages/twenty-front/src/modules/app/components/AppRouter.tsx index 3c172479d6..a9586102ec 100644 --- a/packages/twenty-front/src/modules/app/components/AppRouter.tsx +++ b/packages/twenty-front/src/modules/app/components/AppRouter.tsx @@ -1,13 +1,13 @@ import { useCreateAppRouter } from '@/app/hooks/useCreateAppRouter'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { RouterProvider } from 'react-router-dom'; export const AppRouter = () => { // We want to disable logic function settings but keep the code for now const isFunctionSettingsEnabled = false; - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const isAdminPageEnabled = (currentUser?.canImpersonate || currentUser?.canAccessFullAdminPanel) ?? diff --git a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx index 1582a1cc50..7ea093a6b3 100644 --- a/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx +++ b/packages/twenty-front/src/modules/app/effect-components/PageChangeEffect.tsx @@ -6,7 +6,7 @@ import { useExecuteTasksOnAnyLocationChange } from '@/app/hooks/useExecuteTasksO import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState'; import { useRequestFreshCaptchaToken } from '@/captcha/hooks/useRequestFreshCaptchaToken'; import { isCaptchaScriptLoadedState } from '@/captcha/states/isCaptchaScriptLoadedState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useCallback, useEffect, useState } from 'react'; import { matchPath, @@ -34,7 +34,7 @@ import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/u import { PageFocusId } from '@/types/PageFocusId'; import { useResetFocusStackToFocusItem } from '@/ui/utilities/focus/hooks/useResetFocusStackToFocusItem'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { AppBasePath, AppPath, CommandMenuPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { AnalyticsType } from '~/generated-metadata/graphql'; @@ -66,12 +66,12 @@ export const PageChangeEffect = () => { const objectNamePlural = useParams().objectNamePlural ?? CoreObjectNamePlural.Person; - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const contextStoreCurrentViewType = useRecoilComponentValueV2( + const contextStoreCurrentViewType = useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); @@ -93,7 +93,7 @@ export const PageChangeEffect = () => { const { executeTasksOnAnyLocationChange } = useExecuteTasksOnAnyLocationChange(); - const isAppEffectRedirectEnabled = useRecoilValueV2( + const isAppEffectRedirectEnabled = useAtomStateValue( isAppEffectRedirectEnabledState, ); @@ -360,7 +360,7 @@ export const PageChangeEffect = () => { }, [eventTracker, location.pathname]); const { requestFreshCaptchaToken } = useRequestFreshCaptchaToken(); - const isCaptchaScriptLoaded = useRecoilValueV2(isCaptchaScriptLoadedState); + const isCaptchaScriptLoaded = useAtomStateValue(isCaptchaScriptLoadedState); useEffect(() => { if (isCaptchaScriptLoaded && isCaptchaRequiredForPath(location.pathname)) { diff --git a/packages/twenty-front/src/modules/app/states/isAppEffectRedirectEnabledState.ts b/packages/twenty-front/src/modules/app/states/isAppEffectRedirectEnabledState.ts index 739694fb94..35521b69ad 100644 --- a/packages/twenty-front/src/modules/app/states/isAppEffectRedirectEnabledState.ts +++ b/packages/twenty-front/src/modules/app/states/isAppEffectRedirectEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isAppEffectRedirectEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isAppEffectRedirectEnabledState = createAtomState({ key: 'isAppEffectRedirectEnabledState', defaultValue: true, }); diff --git a/packages/twenty-front/src/modules/app/states/verifyEmailRedirectPathState.ts b/packages/twenty-front/src/modules/app/states/verifyEmailRedirectPathState.ts index af1409f3e1..382dd4a9f6 100644 --- a/packages/twenty-front/src/modules/app/states/verifyEmailRedirectPathState.ts +++ b/packages/twenty-front/src/modules/app/states/verifyEmailRedirectPathState.ts @@ -1,6 +1,8 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const verifyEmailRedirectPathState = createStateV2({ - key: 'verifyEmailRedirectPathState', - defaultValue: undefined, -}); +export const verifyEmailRedirectPathState = createAtomState( + { + key: 'verifyEmailRedirectPathState', + defaultValue: undefined, + }, +); diff --git a/packages/twenty-front/src/modules/auth/components/AuthProvider.tsx b/packages/twenty-front/src/modules/auth/components/AuthProvider.tsx index 0bcddad5ba..6d2f9b49f0 100644 --- a/packages/twenty-front/src/modules/auth/components/AuthProvider.tsx +++ b/packages/twenty-front/src/modules/auth/components/AuthProvider.tsx @@ -3,13 +3,13 @@ import React from 'react'; import { AuthContext } from '@/auth/contexts/AuthContext'; import { currentWorkspaceDeletedMembersState } from '@/auth/states/currentWorkspaceDeletedMembersState'; import { currentWorkspaceMembersState } from '@/auth/states/currentWorkspaceMembersState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const AuthProvider = ({ children }: React.PropsWithChildren) => { - const currentWorkspaceMembers = useRecoilValueV2( + const currentWorkspaceMembers = useAtomStateValue( currentWorkspaceMembersState, ); - const currentWorkspaceDeletedMembers = useRecoilValueV2( + const currentWorkspaceDeletedMembers = useAtomStateValue( currentWorkspaceDeletedMembersState, ); diff --git a/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsx b/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsx index 6e19e67886..cb5f3295b4 100644 --- a/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsx +++ b/packages/twenty-front/src/modules/auth/components/TwoFactorAuthenticationProvisionEffect.tsx @@ -5,11 +5,11 @@ import { useCurrentUserWorkspaceTwoFactorAuthentication } from '@/settings/two-f import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { useLingui } from '@lingui/react/macro'; import { useEffect } from 'react'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { AppPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { useNavigateApp } from '~/hooks/useNavigateApp'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const TwoFactorAuthenticationSetupEffect = () => { const { initiateCurrentUserWorkspaceOtpProvisioning } = @@ -18,9 +18,9 @@ export const TwoFactorAuthenticationSetupEffect = () => { const navigate = useNavigateApp(); const { origin } = useOrigin(); - const loginToken = useRecoilValueV2(loginTokenState); - const qrCode = useRecoilValueV2(qrCodeState); - const setQrCodeState = useSetRecoilStateV2(qrCodeState); + const loginToken = useAtomStateValue(loginTokenState); + const qrCode = useAtomStateValue(qrCodeState); + const setQrCodeState = useSetAtomState(qrCodeState); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx b/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx index 58623c232c..8f87ee9eb4 100644 --- a/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx +++ b/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx @@ -12,12 +12,12 @@ import { Modal } from '@/ui/layout/modal/components/Modal'; import { useLingui } from '@lingui/react/macro'; import { useEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { useNavigateApp } from '~/hooks/useNavigateApp'; import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl'; import { EmailVerificationSent } from '@/auth/sign-in-up/components/EmailVerificationSent'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const VerifyEmailEffect = () => { const { @@ -30,7 +30,7 @@ export const VerifyEmailEffect = () => { const [searchParams] = useSearchParams(); const [isError, setIsError] = useState(false); - const setVerifyEmailRedirectPath = useSetRecoilStateV2( + const setVerifyEmailRedirectPath = useSetAtomState( verifyEmailRedirectPathState, ); @@ -42,7 +42,7 @@ export const VerifyEmailEffect = () => { const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain(); const { verifyLoginToken } = useVerifyLogin(); const { isOnAWorkspace } = useIsCurrentLocationOnAWorkspace(); - const clientConfigApiStatus = useRecoilValueV2(clientConfigApiStatusState); + const clientConfigApiStatus = useAtomStateValue(clientConfigApiStatusState); const { t } = useLingui(); useEffect(() => { diff --git a/packages/twenty-front/src/modules/auth/components/VerifyLoginTokenEffect.tsx b/packages/twenty-front/src/modules/auth/components/VerifyLoginTokenEffect.tsx index 006ef62255..fe0adab784 100644 --- a/packages/twenty-front/src/modules/auth/components/VerifyLoginTokenEffect.tsx +++ b/packages/twenty-front/src/modules/auth/components/VerifyLoginTokenEffect.tsx @@ -4,7 +4,7 @@ import { useSearchParams } from 'react-router-dom'; import { useIsLogged } from '@/auth/hooks/useIsLogged'; import { useVerifyLogin } from '@/auth/hooks/useVerifyLogin'; import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { AppPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { useNavigateApp } from '~/hooks/useNavigateApp'; @@ -17,7 +17,7 @@ export const VerifyLoginTokenEffect = () => { const navigate = useNavigateApp(); const { verifyLoginToken } = useVerifyLogin(); - const { isSaved: clientConfigLoaded } = useRecoilValueV2( + const { isSaved: clientConfigLoaded } = useAtomStateValue( clientConfigApiStatusState, ); diff --git a/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsx b/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsx index a8b23bbe71..6e4d46b7ee 100644 --- a/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsx +++ b/packages/twenty-front/src/modules/auth/hooks/__tests__/useAuth.test.tsx @@ -4,7 +4,7 @@ import { isDeveloperDefaultSignInPrefilledState } from '@/client-config/states/i import { supportChatState } from '@/client-config/states/supportChatState'; import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useApolloClient } from '@apollo/client'; import { MockedProvider } from '@apollo/client/testing'; import { type ReactNode, act } from 'react'; @@ -159,15 +159,15 @@ describe('useAuth', () => { const { result } = renderHook( () => { const client = useApolloClient(); - const workspaceAuthProviders = useRecoilValueV2( + const workspaceAuthProviders = useAtomStateValue( workspaceAuthProvidersState, ); - const billing = useRecoilValueV2(billingState); - const isDeveloperDefaultSignInPrefilled = useRecoilValueV2( + const billing = useAtomStateValue(billingState); + const isDeveloperDefaultSignInPrefilled = useAtomStateValue( isDeveloperDefaultSignInPrefilledState, ); - const supportChat = useRecoilValueV2(supportChatState); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const supportChat = useAtomStateValue(supportChatState); + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); return { diff --git a/packages/twenty-front/src/modules/auth/hooks/__tests__/useIsLogged.test.ts b/packages/twenty-front/src/modules/auth/hooks/__tests__/useIsLogged.test.ts index 9bec4278a8..6bc434ba95 100644 --- a/packages/twenty-front/src/modules/auth/hooks/__tests__/useIsLogged.test.ts +++ b/packages/twenty-front/src/modules/auth/hooks/__tests__/useIsLogged.test.ts @@ -3,13 +3,13 @@ import { RecoilRoot } from 'recoil'; import { useIsLogged } from '@/auth/hooks/useIsLogged'; import { tokenPairState } from '@/auth/states/tokenPairState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; const renderHooks = () => { const { result } = renderHook( () => { const isLogged = useIsLogged(); - const setTokenPair = useSetRecoilStateV2(tokenPairState); + const setTokenPair = useSetAtomState(tokenPairState); return { isLogged, diff --git a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts b/packages/twenty-front/src/modules/auth/hooks/useAuth.ts index bdb5d51932..401b968daf 100644 --- a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts +++ b/packages/twenty-front/src/modules/auth/hooks/useAuth.ts @@ -19,8 +19,8 @@ import { } from '~/generated-metadata/graphql'; import { tokenPairState } from '@/auth/states/tokenPairState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState'; import { availableWorkspacesState } from '@/auth/states/availableWorkspacesState'; @@ -66,19 +66,19 @@ import { useStore } from 'jotai'; export const useAuth = () => { const store = useStore(); - const setTokenPair = useSetRecoilStateV2(tokenPairState); - const setLoginToken = useSetRecoilStateV2(loginTokenState); - const setIsAppEffectRedirectEnabled = useSetRecoilStateV2( + const setTokenPair = useSetAtomState(tokenPairState); + const setLoginToken = useSetAtomState(loginTokenState); + const setIsAppEffectRedirectEnabled = useSetAtomState( isAppEffectRedirectEnabledState, ); const { origin } = useOrigin(); const { requestFreshCaptchaToken } = useRequestFreshCaptchaToken(); - const isCaptchaScriptLoaded = useRecoilValueV2(isCaptchaScriptLoadedState); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isCaptchaScriptLoaded = useAtomStateValue(isCaptchaScriptLoadedState); + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); - const isEmailVerificationRequired = useRecoilValueV2( + const isEmailVerificationRequired = useAtomStateValue( isEmailVerificationRequiredState, ); const { loadCurrentUser } = useLoadCurrentUser(); @@ -87,7 +87,7 @@ export const useAuth = () => { useReloadWorkspaceMetadata(); const { createWorkspace } = useSignUpInNewWorkspace(); - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); + const setSignInUpStep = useSetAtomState(signInUpStepState); const { redirect } = useRedirect(); const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain(); @@ -104,7 +104,7 @@ export const useAuth = () => { useVerifyEmailAndGetWorkspaceAgnosticTokenMutation(); const [getAuthTokensFromOtp] = useGetAuthTokensFromOtpMutation(); - const workspacePublicData = useRecoilValueV2(workspacePublicDataState); + const workspacePublicData = useAtomStateValue(workspacePublicDataState); const { setLastAuthenticateWorkspaceDomain } = useLastAuthenticatedWorkspaceDomain(); diff --git a/packages/twenty-front/src/modules/auth/hooks/useIsLogged.ts b/packages/twenty-front/src/modules/auth/hooks/useIsLogged.ts index 6b41f3e4ad..a7fda28fd9 100644 --- a/packages/twenty-front/src/modules/auth/hooks/useIsLogged.ts +++ b/packages/twenty-front/src/modules/auth/hooks/useIsLogged.ts @@ -1,7 +1,7 @@ import { tokenPairState } from '@/auth/states/tokenPairState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; export const useIsLogged = (): boolean => { - const [tokenPair] = useRecoilStateV2(tokenPairState); + const [tokenPair] = useAtomState(tokenPairState); return !!tokenPair; }; diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx index a6ba4f5fa5..1c1cad803c 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/EmailVerificationSent.tsx @@ -9,7 +9,7 @@ import { } from '@/auth/states/signInUpStepState'; import { OnboardingModalCircularIcon } from '@/onboarding/components/OnboardingModalCircularIcon'; import { t } from '@lingui/core/macro'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { IconGmail, IconMail, @@ -89,7 +89,7 @@ export const EmailVerificationSent = ({ email: string | null; isError?: boolean; }) => { - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); + const setSignInUpStep = useSetAtomState(signInUpStepState); const { handleResendEmailVerificationToken, loading: isLoading } = useHandleResendEmailVerificationToken(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx index ee0082e906..95e88d5601 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpGlobalScopeForm.tsx @@ -28,7 +28,7 @@ import { } from 'twenty-ui/display'; import { type AvailableWorkspace } from '~/generated-metadata/graphql'; import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledContentContainer = styled(motion.div)` margin-bottom: ${({ theme }) => theme.spacing(8)}; @@ -124,13 +124,13 @@ const StyledActionLinkContainer = styled.div` `; export const SignInUpGlobalScopeForm = () => { - const authProviders = useRecoilValueV2(authProvidersState); - const signInUpStep = useRecoilValueV2(signInUpStepState); + const authProviders = useAtomStateValue(authProvidersState); + const signInUpStep = useAtomStateValue(signInUpStepState); const { buildWorkspaceUrl } = useBuildWorkspaceUrl(); const { signOut } = useAuth(); const { createWorkspace } = useSignUpInNewWorkspace(); - const availableWorkspaces = useRecoilValueV2(availableWorkspacesState); + const availableWorkspaces = useAtomStateValue(availableWorkspacesState); const theme = useTheme(); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeForm.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeForm.tsx index 99d3a49e67..484a30eb4d 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeForm.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeForm.tsx @@ -14,7 +14,7 @@ import { Trans } from '@lingui/react/macro'; import { FormProvider } from 'react-hook-form'; import { HorizontalSeparator } from 'twenty-ui/display'; import { ClickToActionLink } from 'twenty-ui/navigation'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledContentContainer = styled.div` margin-bottom: ${({ theme }) => theme.spacing(8)}; @@ -23,8 +23,8 @@ const StyledContentContainer = styled.div` `; export const SignInUpWorkspaceScopeForm = () => { - const workspaceAuthProviders = useRecoilValueV2(workspaceAuthProvidersState); - const workspaceAuthBypassProviders = useRecoilValueV2( + const workspaceAuthProviders = useAtomStateValue(workspaceAuthProvidersState); + const workspaceAuthBypassProviders = useAtomStateValue( workspaceAuthBypassProvidersState, ); const { shouldOfferBypass, shouldUseBypass } = useWorkspaceBypass(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpGlobalScopeFormEffect.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpGlobalScopeFormEffect.tsx index fecfc67d72..1b22299c54 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpGlobalScopeFormEffect.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpGlobalScopeFormEffect.tsx @@ -6,11 +6,11 @@ import { import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser'; import { useEffect } from 'react'; import { useSearchParams } from 'react-router-dom'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; export const SignInUpGlobalScopeFormEffect = () => { - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); + const setSignInUpStep = useSetAtomState(signInUpStepState); const [searchParams, setSearchParams] = useSearchParams(); const { setAuthTokens } = useAuth(); const { loadCurrentUser } = useLoadCurrentUser(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpSSOIdentityProviderSelection.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpSSOIdentityProviderSelection.tsx index 32d86ef8ed..88fbfc65a6 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpSSOIdentityProviderSelection.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpSSOIdentityProviderSelection.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { isDefined } from 'twenty-shared/utils'; import { HorizontalSeparator } from 'twenty-ui/display'; import { MainButton } from 'twenty-ui/input'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledContentContainer = styled.div` margin-bottom: ${({ theme }) => theme.spacing(8)}; @@ -17,7 +17,7 @@ const StyledContentContainer = styled.div` `; export const SignInUpSSOIdentityProviderSelection = () => { - const workspaceAuthProviders = useRecoilValueV2(workspaceAuthProvidersState); + const workspaceAuthProviders = useAtomStateValue(workspaceAuthProvidersState); const { redirectToSSOLoginPage } = useSSO(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx index 300e894a4c..0b5f05ddc8 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationProvision.tsx @@ -9,11 +9,11 @@ import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { Trans, useLingui } from '@lingui/react/macro'; import QRCode from 'react-qr-code'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { IconCopy } from 'twenty-ui/display'; import { Loader } from 'twenty-ui/feedback'; import { MainButton } from 'twenty-ui/input'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useCopyToClipboard } from '~/hooks/useCopyToClipboard'; const StyledMainContentContainer = styled.div` @@ -70,8 +70,8 @@ export const SignInUpTwoFactorAuthenticationProvision = () => { const { t } = useLingui(); const theme = useTheme(); const { copyToClipboard } = useCopyToClipboard(); - const qrCode = useRecoilValueV2(qrCodeState); - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); + const qrCode = useAtomStateValue(qrCodeState); + const setSignInUpStep = useSetAtomState(signInUpStepState); const handleClick = () => { setSignInUpStep(SignInUpStep.TwoFactorAuthenticationVerification); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsx index bf50d1d6e1..dba5f1bc38 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpTwoFactorAuthenticationVerification.tsx @@ -22,8 +22,8 @@ import { AppPath } from 'twenty-shared/types'; import { MainButton } from 'twenty-ui/input'; import { ClickToActionLink } from 'twenty-ui/navigation'; import { useNavigateApp } from '~/hooks/useNavigateApp'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; const StyledMainContentContainer = styled.div` margin-bottom: ${({ theme }) => theme.spacing(8)}; @@ -187,8 +187,8 @@ export const SignInUpTOTPVerification = () => { const navigate = useNavigateApp(); const { readCaptchaToken } = useReadCaptchaToken(); const { isCaptchaReady } = useCaptcha(); - const loginToken = useRecoilValueV2(loginTokenState); - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); + const loginToken = useAtomStateValue(loginTokenState); + const setSignInUpStep = useSetAtomState(signInUpStepState); const { t } = useLingui(); const { form } = useTwoFactorAuthenticationForm(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithCredentials.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithCredentials.tsx index 9d709b8e39..f99e43d79b 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithCredentials.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithCredentials.tsx @@ -22,8 +22,8 @@ import { useFormContext } from 'react-hook-form'; import { isDefined } from 'twenty-shared/utils'; import { Loader } from 'twenty-ui/feedback'; import { MainButton } from 'twenty-ui/input'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledForm = styled.form` align-items: center; @@ -40,13 +40,13 @@ export const SignInUpWithCredentials = ({ const { t } = useLingui(); const form = useFormContext
(); - const [signInUpStep, setSignInUpStep] = useRecoilStateV2(signInUpStepState); + const [signInUpStep, setSignInUpStep] = useAtomState(signInUpStepState); const [showErrors, setShowErrors] = useState(false); - const captcha = useRecoilValueV2(captchaState); - const isRequestingCaptchaToken = useRecoilValueV2( + const captcha = useAtomStateValue(captchaState); + const isRequestingCaptchaToken = useAtomStateValue( isRequestingCaptchaTokenState, ); - const lastAuthenticatedMethod = useRecoilValueV2( + const lastAuthenticatedMethod = useAtomStateValue( lastAuthenticatedMethodState, ); const hasMultipleAuthMethods = useHasMultipleAuthMethods(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx index 4e61f26477..e05e948932 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithGoogle.tsx @@ -12,8 +12,8 @@ import { useLingui } from '@lingui/react/macro'; import { memo } from 'react'; import { HorizontalSeparator, IconGoogle } from 'twenty-ui/display'; import { MainButton } from 'twenty-ui/input'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { LastUsedPill } from './LastUsedPill'; import { StyledSSOButtonContainer } from './SignInUpSSOButtonStyles'; @@ -30,9 +30,10 @@ export const SignInUpWithGoogle = ({ isGlobalScope?: boolean; }) => { const { t } = useLingui(); - const signInUpStep = useRecoilValueV2(signInUpStepState); - const [lastAuthenticatedMethod, setLastAuthenticatedMethod] = - useRecoilStateV2(lastAuthenticatedMethodState); + const signInUpStep = useAtomStateValue(signInUpStepState); + const [lastAuthenticatedMethod, setLastAuthenticatedMethod] = useAtomState( + lastAuthenticatedMethodState, + ); const { signInWithGoogle } = useSignInWithGoogle(); const hasMultipleAuthMethods = useHasMultipleAuthMethods(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx index f16b95a541..eeb4c581a2 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithMicrosoft.tsx @@ -11,8 +11,8 @@ import { useTheme } from '@emotion/react'; import { useLingui } from '@lingui/react/macro'; import { HorizontalSeparator, IconMicrosoft } from 'twenty-ui/display'; import { MainButton } from 'twenty-ui/input'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { LastUsedPill } from './LastUsedPill'; import { StyledSSOButtonContainer } from './SignInUpSSOButtonStyles'; @@ -26,9 +26,10 @@ export const SignInUpWithMicrosoft = ({ const theme = useTheme(); const { t } = useLingui(); - const signInUpStep = useRecoilValueV2(signInUpStepState); - const [lastAuthenticatedMethod, setLastAuthenticatedMethod] = - useRecoilStateV2(lastAuthenticatedMethodState); + const signInUpStep = useAtomStateValue(signInUpStepState); + const [lastAuthenticatedMethod, setLastAuthenticatedMethod] = useAtomState( + lastAuthenticatedMethodState, + ); const { signInWithMicrosoft } = useSignInWithMicrosoft(); const hasMultipleAuthMethods = useHasMultipleAuthMethods(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx index a5c160aefa..e4fa255792 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWithSSO.tsx @@ -7,9 +7,9 @@ import { } from '@/auth/states/signInUpStepState'; import { AuthenticatedMethod } from '@/auth/types/AuthenticatedMethod.enum'; import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useTheme } from '@emotion/react'; import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; @@ -21,11 +21,12 @@ import { StyledSSOButtonContainer } from './SignInUpSSOButtonStyles'; export const SignInUpWithSSO = () => { const theme = useTheme(); const { t } = useLingui(); - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); - const workspaceAuthProviders = useRecoilValueV2(workspaceAuthProvidersState); - const signInUpStep = useRecoilValueV2(signInUpStepState); - const [lastAuthenticatedMethod, setLastAuthenticatedMethod] = - useRecoilStateV2(lastAuthenticatedMethodState); + const setSignInUpStep = useSetAtomState(signInUpStepState); + const workspaceAuthProviders = useAtomStateValue(workspaceAuthProvidersState); + const signInUpStep = useAtomStateValue(signInUpStepState); + const [lastAuthenticatedMethod, setLastAuthenticatedMethod] = useAtomState( + lastAuthenticatedMethodState, + ); const hasMultipleAuthMethods = useHasMultipleAuthMethods(); const { redirectToSSOLoginPage } = useSSO(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceScopeFormEffect.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceScopeFormEffect.tsx index cc903b0305..75a782192e 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceScopeFormEffect.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/SignInUpWorkspaceScopeFormEffect.tsx @@ -7,8 +7,8 @@ import { import { isRequestingCaptchaTokenState } from '@/captcha/states/isRequestingCaptchaTokenState'; import { captchaState } from '@/client-config/states/captchaState'; import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useEffect, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -22,13 +22,13 @@ enum LoadingStatus { } export const SignInUpWorkspaceScopeFormEffect = () => { - const workspaceAuthProviders = useRecoilValueV2(workspaceAuthProvidersState); + const workspaceAuthProviders = useAtomStateValue(workspaceAuthProvidersState); - const isRequestingCaptchaToken = useRecoilValueV2( + const isRequestingCaptchaToken = useAtomStateValue( isRequestingCaptchaTokenState, ); - const captcha = useRecoilValueV2(captchaState); + const captcha = useAtomStateValue(captchaState); const [loadingStatus, setLoadingStatus] = useState( LoadingStatus.Loading, @@ -39,7 +39,7 @@ export const SignInUpWorkspaceScopeFormEffect = () => { const { signInUpStep, continueWithEmail, continueWithCredentials } = useSignInUp(form); - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); + const setSignInUpStep = useSetAtomState(signInUpStepState); useEffect(() => { if (!workspaceAuthProviders) { diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.ts index 3cbdcca6b0..8b55af99a7 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.ts +++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHandleResetPassword.ts @@ -6,13 +6,13 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ApolloError } from '@apollo/client'; import { useLingui } from '@lingui/react/macro'; import { useEmailPasswordResetLinkMutation } from '~/generated-metadata/graphql'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useHandleResetPassword = () => { const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar(); const [emailPasswordResetLink] = useEmailPasswordResetLinkMutation(); - const workspacePublicData = useRecoilValueV2(workspacePublicDataState); - const currentUser = useRecoilValueV2(currentUserState); + const workspacePublicData = useAtomStateValue(workspacePublicDataState); + const currentUser = useAtomStateValue(currentUserState); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHasMultipleAuthMethods.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHasMultipleAuthMethods.ts index 12d97b5488..e7852d3c67 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHasMultipleAuthMethods.ts +++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useHasMultipleAuthMethods.ts @@ -1,8 +1,8 @@ import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useHasMultipleAuthMethods = () => { - const workspaceAuthProviders = useRecoilValueV2(workspaceAuthProvidersState); + const workspaceAuthProviders = useAtomStateValue(workspaceAuthProvidersState); if (!workspaceAuthProviders) { return false; diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts index 8c0a1444fc..eb83ae2804 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts +++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.ts @@ -23,18 +23,18 @@ import { isDefined } from 'twenty-shared/utils'; import { buildAppPathWithQueryParams } from '~/utils/buildAppPathWithQueryParams'; import { isMatchingLocation } from '~/utils/isMatchingLocation'; import { useAuth } from '@/auth/hooks/useAuth'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useSignInUp = (form: UseFormReturn) => { const { enqueueErrorSnackBar } = useSnackBar(); const { t } = useLingui(); - const [signInUpStep, setSignInUpStep] = useRecoilStateV2(signInUpStepState); - const [signInUpMode, setSignInUpMode] = useRecoilStateV2(signInUpModeState); + const [signInUpStep, setSignInUpStep] = useAtomState(signInUpStepState); + const [signInUpMode, setSignInUpMode] = useAtomState(signInUpModeState); const { isOnAWorkspace } = useIsCurrentLocationOnAWorkspace(); const { isCaptchaReady } = useCaptcha(); - const setLastAuthenticatedMethod = useSetRecoilStateV2( + const setLastAuthenticatedMethod = useSetAtomState( lastAuthenticatedMethodState, ); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.ts index eabc2b9474..6857d62ecb 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.ts +++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUpForm.ts @@ -12,7 +12,7 @@ import { import { PASSWORD_REGEX } from '@/auth/utils/passwordRegex'; import { isDeveloperDefaultSignInPrefilledState } from '@/client-config/states/isDeveloperDefaultSignInPrefilledState'; import { isDefined } from 'twenty-shared/utils'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const makeValidationSchema = (signInUpStep: SignInUpStep) => z @@ -34,11 +34,11 @@ const makeValidationSchema = (signInUpStep: SignInUpStep) => export type Form = z.infer>; export const useSignInUpForm = () => { - const signInUpStep = useRecoilValueV2(signInUpStepState); + const signInUpStep = useAtomStateValue(signInUpStepState); const validationSchema = makeValidationSchema(signInUpStep); // Create schema based on the current step - const isDeveloperDefaultSignInPrefilled = useRecoilValueV2( + const isDeveloperDefaultSignInPrefilled = useAtomStateValue( isDeveloperDefaultSignInPrefilledState, ); const [searchParams] = useSearchParams(); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.ts index b310de5b9e..dfd1a9d5f0 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.ts +++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInWithMicrosoft.ts @@ -3,14 +3,14 @@ import { useParams, useSearchParams } from 'react-router-dom'; import { useAuth } from '@/auth/hooks/useAuth'; import { billingCheckoutSessionState } from '@/auth/states/billingCheckoutSessionState'; import { type SocialSSOSignInUpActionType } from '@/auth/types/socialSSOSignInUp.type'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useSignInWithMicrosoft = () => { const workspaceInviteHash = useParams().workspaceInviteHash; const [searchParams] = useSearchParams(); const workspacePersonalInviteToken = searchParams.get('inviteToken') ?? undefined; - const billingCheckoutSession = useRecoilValueV2(billingCheckoutSessionState); + const billingCheckoutSession = useAtomStateValue(billingCheckoutSessionState); const { signInWithMicrosoft } = useAuth(); return { diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceBypass.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceBypass.ts index 1d569d03a8..5b05bca5f5 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceBypass.ts +++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceBypass.ts @@ -2,15 +2,15 @@ import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCu import { workspaceAuthBypassProvidersState } from '@/workspace/states/workspaceAuthBypassProvidersState'; import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState'; import { workspaceBypassModeState } from '@/workspace/states/workspaceBypassModeState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useWorkspaceBypass = () => { - const workspaceAuthProviders = useRecoilValueV2(workspaceAuthProvidersState); - const workspaceAuthBypassProviders = useRecoilValueV2( + const workspaceAuthProviders = useAtomStateValue(workspaceAuthProvidersState); + const workspaceAuthBypassProviders = useAtomStateValue( workspaceAuthBypassProvidersState, ); - const [workspaceBypassMode, setWorkspaceBypassMode] = useRecoilStateV2( + const [workspaceBypassMode, setWorkspaceBypassMode] = useAtomState( workspaceBypassModeState, ); diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.ts b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.ts index 3060aacdd4..08ff7067ce 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.ts +++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useWorkspaceFromInviteHash.ts @@ -2,7 +2,7 @@ import { useState } from 'react'; import { useParams } from 'react-router-dom'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; @@ -16,7 +16,7 @@ export const useWorkspaceFromInviteHash = () => { const { enqueueErrorSnackBar, enqueueInfoSnackBar } = useSnackBar(); const navigate = useNavigateApp(); const workspaceInviteHash = useParams().workspaceInviteHash; - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const [initiallyLoggedIn] = useState(isDefined(currentWorkspace)); const { data: workspaceFromInviteHash, loading } = diff --git a/packages/twenty-front/src/modules/auth/states/availableWorkspacesState.ts b/packages/twenty-front/src/modules/auth/states/availableWorkspacesState.ts index 7092ad0aee..2c96f10a59 100644 --- a/packages/twenty-front/src/modules/auth/states/availableWorkspacesState.ts +++ b/packages/twenty-front/src/modules/auth/states/availableWorkspacesState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type AvailableWorkspaces } from '~/generated-metadata/graphql'; -export const availableWorkspacesState = createStateV2({ +export const availableWorkspacesState = createAtomState({ key: 'availableWorkspacesState', defaultValue: { availableWorkspacesForSignIn: [], diff --git a/packages/twenty-front/src/modules/auth/states/billingCheckoutSessionState.ts b/packages/twenty-front/src/modules/auth/states/billingCheckoutSessionState.ts index 597bc166c0..1f335e5b23 100644 --- a/packages/twenty-front/src/modules/auth/states/billingCheckoutSessionState.ts +++ b/packages/twenty-front/src/modules/auth/states/billingCheckoutSessionState.ts @@ -1,9 +1,9 @@ import { type BillingCheckoutSession } from '@/auth/types/billingCheckoutSession.type'; import { BILLING_CHECKOUT_SESSION_DEFAULT_VALUE } from '@/billing/constants/BillingCheckoutSessionDefaultValue'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const billingCheckoutSessionState = - createStateV2({ + createAtomState({ key: 'billingCheckoutSessionState', defaultValue: BILLING_CHECKOUT_SESSION_DEFAULT_VALUE, }); diff --git a/packages/twenty-front/src/modules/auth/states/currentUserState.ts b/packages/twenty-front/src/modules/auth/states/currentUserState.ts index 6cae816adf..9bca9860fd 100644 --- a/packages/twenty-front/src/modules/auth/states/currentUserState.ts +++ b/packages/twenty-front/src/modules/auth/states/currentUserState.ts @@ -1,4 +1,4 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type User } from '~/generated-metadata/graphql'; export type CurrentUser = Pick< @@ -15,7 +15,7 @@ export type CurrentUser = Pick< | 'hasPassword' >; -export const currentUserState = createStateV2({ +export const currentUserState = createAtomState({ key: 'currentUserState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/auth/states/currentUserWorkspaceState.ts b/packages/twenty-front/src/modules/auth/states/currentUserWorkspaceState.ts index 386c34682c..c15d50e1ce 100644 --- a/packages/twenty-front/src/modules/auth/states/currentUserWorkspaceState.ts +++ b/packages/twenty-front/src/modules/auth/states/currentUserWorkspaceState.ts @@ -1,5 +1,5 @@ import { type ObjectPermissions } from 'twenty-shared/types'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type UserWorkspace } from '~/generated-metadata/graphql'; export type CurrentUserWorkspace = Pick< @@ -10,7 +10,7 @@ export type CurrentUserWorkspace = Pick< }; export const currentUserWorkspaceState = - createStateV2({ + createAtomState({ key: 'currentUserWorkspaceState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceDeletedMembersState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceDeletedMembersState.ts index bea088e3ec..a7d1375dd8 100644 --- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceDeletedMembersState.ts +++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceDeletedMembersState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type DeletedWorkspaceMember } from '~/generated-metadata/graphql'; -export const currentWorkspaceDeletedMembersState = createStateV2< +export const currentWorkspaceDeletedMembersState = createAtomState< DeletedWorkspaceMember[] >({ key: 'currentWorkspaceDeletedMembersState', diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.ts index 7b918ddc07..e844d1615c 100644 --- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.ts +++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMemberState.ts @@ -1,5 +1,5 @@ import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export type CurrentWorkspaceMember = Omit< WorkspaceMember, @@ -7,7 +7,7 @@ export type CurrentWorkspaceMember = Omit< >; export const currentWorkspaceMemberState = - createStateV2({ + createAtomState({ key: 'currentWorkspaceMemberState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersState.ts index ffce77caaa..a80cabaa51 100644 --- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersState.ts +++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceMembersState.ts @@ -1,7 +1,7 @@ import { type PartialWorkspaceMember } from '@/settings/roles/types/RoleWithPartialMembers'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentWorkspaceMembersState = createStateV2< +export const currentWorkspaceMembersState = createAtomState< PartialWorkspaceMember[] >({ key: 'currentWorkspaceMembersState', diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts index 001bad094f..9f3067bba8 100644 --- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts +++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts @@ -1,4 +1,4 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type Application, type Role, @@ -47,7 +47,7 @@ export type CurrentWorkspace = Pick< workspaceCustomApplication: Pick | null; }; -export const currentWorkspaceState = createStateV2({ +export const currentWorkspaceState = createAtomState({ key: 'currentWorkspaceState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadedState.ts b/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadedState.ts index fd2a6c80e9..95bc2ed06c 100644 --- a/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadedState.ts +++ b/packages/twenty-front/src/modules/auth/states/isCurrentUserLoadedState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isCurrentUserLoadedState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isCurrentUserLoadedState = createAtomState({ key: 'isCurrentUserLoadedState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/auth/states/isImpersonatingState.ts b/packages/twenty-front/src/modules/auth/states/isImpersonatingState.ts index 9ec3219bf2..920efece50 100644 --- a/packages/twenty-front/src/modules/auth/states/isImpersonatingState.ts +++ b/packages/twenty-front/src/modules/auth/states/isImpersonatingState.ts @@ -2,9 +2,9 @@ import { jwtDecode } from 'jwt-decode'; import { isDefined } from 'twenty-shared/utils'; import { tokenPairState } from '@/auth/states/tokenPairState'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; -export const isImpersonatingState = createSelectorV2({ +export const isImpersonatingState = createAtomSelector({ key: 'isImpersonatingState', get: ({ get }) => { const tokenPair = get(tokenPairState); diff --git a/packages/twenty-front/src/modules/auth/states/lastAuthenticatedMethodState.ts b/packages/twenty-front/src/modules/auth/states/lastAuthenticatedMethodState.ts index f6ec95fe15..109171a96c 100644 --- a/packages/twenty-front/src/modules/auth/states/lastAuthenticatedMethodState.ts +++ b/packages/twenty-front/src/modules/auth/states/lastAuthenticatedMethodState.ts @@ -1,8 +1,8 @@ import { type AuthenticatedMethod } from '@/auth/types/AuthenticatedMethod.enum'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const lastAuthenticatedMethodState = - createStateV2({ + createAtomState({ key: 'lastAuthenticatedMethodState', defaultValue: null, useLocalStorage: true, diff --git a/packages/twenty-front/src/modules/auth/states/loginTokenState.ts b/packages/twenty-front/src/modules/auth/states/loginTokenState.ts index 07063e81d0..4218ce632f 100644 --- a/packages/twenty-front/src/modules/auth/states/loginTokenState.ts +++ b/packages/twenty-front/src/modules/auth/states/loginTokenState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type AuthToken } from '~/generated-metadata/graphql'; -export const loginTokenState = createStateV2({ +export const loginTokenState = createAtomState({ key: 'loginTokenState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/auth/states/objectPermissionsFamilySelector.ts b/packages/twenty-front/src/modules/auth/states/objectPermissionsFamilySelector.ts index 72c794f0fe..79af920d64 100644 --- a/packages/twenty-front/src/modules/auth/states/objectPermissionsFamilySelector.ts +++ b/packages/twenty-front/src/modules/auth/states/objectPermissionsFamilySelector.ts @@ -1,8 +1,8 @@ import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; -export const objectPermissionsFamilySelector = createFamilySelectorV2< +export const objectPermissionsFamilySelector = createAtomFamilySelector< { canRead: boolean; canUpdate: boolean; diff --git a/packages/twenty-front/src/modules/auth/states/previousUrlState.ts b/packages/twenty-front/src/modules/auth/states/previousUrlState.ts index ff34900116..6b54a28cfc 100644 --- a/packages/twenty-front/src/modules/auth/states/previousUrlState.ts +++ b/packages/twenty-front/src/modules/auth/states/previousUrlState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const previousUrlState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const previousUrlState = createAtomState({ key: 'previousUrlState', defaultValue: '', }); diff --git a/packages/twenty-front/src/modules/auth/states/qrCode.ts b/packages/twenty-front/src/modules/auth/states/qrCode.ts index 34be7f7eed..ea551a4439 100644 --- a/packages/twenty-front/src/modules/auth/states/qrCode.ts +++ b/packages/twenty-front/src/modules/auth/states/qrCode.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const qrCodeState = createStateV2({ +export const qrCodeState = createAtomState({ key: 'qrCodeState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/auth/states/signInUpModeState.ts b/packages/twenty-front/src/modules/auth/states/signInUpModeState.ts index d77d4e27c8..b8eef5b13e 100644 --- a/packages/twenty-front/src/modules/auth/states/signInUpModeState.ts +++ b/packages/twenty-front/src/modules/auth/states/signInUpModeState.ts @@ -1,7 +1,7 @@ import { SignInUpMode } from '@/auth/types/signInUpMode'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const signInUpModeState = createStateV2({ +export const signInUpModeState = createAtomState({ key: 'signInUpModeState', defaultValue: SignInUpMode.SignIn, }); diff --git a/packages/twenty-front/src/modules/auth/states/signInUpStepState.ts b/packages/twenty-front/src/modules/auth/states/signInUpStepState.ts index 15f5a87185..b997d33d8b 100644 --- a/packages/twenty-front/src/modules/auth/states/signInUpStepState.ts +++ b/packages/twenty-front/src/modules/auth/states/signInUpStepState.ts @@ -1,4 +1,4 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export enum SignInUpStep { Init = 'init', Email = 'email', @@ -10,7 +10,7 @@ export enum SignInUpStep { TwoFactorAuthenticationProvision = 'TwoFactorAuthenticationProvision', } -export const signInUpStepState = createStateV2({ +export const signInUpStepState = createAtomState({ key: 'signInUpStepState', defaultValue: SignInUpStep.Init, }); diff --git a/packages/twenty-front/src/modules/auth/states/tokenPairState.ts b/packages/twenty-front/src/modules/auth/states/tokenPairState.ts index d4f52c8c92..5213f5be3a 100644 --- a/packages/twenty-front/src/modules/auth/states/tokenPairState.ts +++ b/packages/twenty-front/src/modules/auth/states/tokenPairState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type AuthTokenPair } from '~/generated-metadata/graphql'; -export const tokenPairState = createStateV2({ +export const tokenPairState = createAtomState({ key: 'tokenPairState', defaultValue: null, useCookieStorage: { diff --git a/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.ts b/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.ts index 2a33949b94..57b5db6498 100644 --- a/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.ts +++ b/packages/twenty-front/src/modules/auth/states/workspacePublicDataState.ts @@ -1,8 +1,8 @@ import { type PublicWorkspaceDataOutput } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const workspacePublicDataState = - createStateV2({ + createAtomState({ key: 'workspacePublicDataState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/billing/components/SettingsBillingContent.tsx b/packages/twenty-front/src/modules/billing/components/SettingsBillingContent.tsx index b0f76c3201..747928d80f 100644 --- a/packages/twenty-front/src/modules/billing/components/SettingsBillingContent.tsx +++ b/packages/twenty-front/src/modules/billing/components/SettingsBillingContent.tsx @@ -15,14 +15,14 @@ import { useBillingPortalSessionQuery, } from '~/generated-metadata/graphql'; import { useGetWorkflowNodeExecutionUsage } from '@/billing/hooks/useGetWorkflowNodeExecutionUsage'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const SettingsBillingContent = () => { const { t } = useLingui(); const { redirect } = useRedirect(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const subscriptions = currentWorkspace?.billingSubscriptions; diff --git a/packages/twenty-front/src/modules/billing/components/SettingsBillingSubscriptionInfo.tsx b/packages/twenty-front/src/modules/billing/components/SettingsBillingSubscriptionInfo.tsx index d98ae59cdd..396c5b8572 100644 --- a/packages/twenty-front/src/modules/billing/components/SettingsBillingSubscriptionInfo.tsx +++ b/packages/twenty-front/src/modules/billing/components/SettingsBillingSubscriptionInfo.tsx @@ -29,7 +29,7 @@ import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useMemo, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { @@ -144,7 +144,7 @@ export const SettingsBillingSubscriptionInfo = ({ const [cancelSwitchMeteredPrice] = useCancelSwitchMeteredPriceMutation(); - const setCurrentWorkspace = useSetRecoilStateV2(currentWorkspaceState); + const setCurrentWorkspace = useSetAtomState(currentWorkspaceState); const isTrialPeriod = subscriptionStatus === SubscriptionStatus.Trialing; diff --git a/packages/twenty-front/src/modules/billing/components/internal/MeteredPriceSelector.tsx b/packages/twenty-front/src/modules/billing/components/internal/MeteredPriceSelector.tsx index 3366b435c0..680c56acc0 100644 --- a/packages/twenty-front/src/modules/billing/components/internal/MeteredPriceSelector.tsx +++ b/packages/twenty-front/src/modules/billing/components/internal/MeteredPriceSelector.tsx @@ -7,7 +7,7 @@ import { type MeteredBillingPrice, } from '@/billing/types/billing-price-tiers.type'; import { useNumberFormat } from '@/localization/hooks/useNumberFormat'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { Select } from '@/ui/input/components/Select'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; @@ -48,7 +48,7 @@ export const MeteredPriceSelector = ({ const { currentMeteredBillingPrice } = useCurrentMetered(); const { formatNumber } = useNumberFormat(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/modules/billing/hooks/useBillingWording.ts b/packages/twenty-front/src/modules/billing/hooks/useBillingWording.ts index d90a37c8ae..fff5261970 100644 --- a/packages/twenty-front/src/modules/billing/hooks/useBillingWording.ts +++ b/packages/twenty-front/src/modules/billing/hooks/useBillingWording.ts @@ -12,12 +12,12 @@ import { beautifyExactDate } from '~/utils/date-utils'; import { useCurrentPlan } from '@/billing/hooks/useCurrentPlan'; import { useCurrentMetered } from '@/billing/hooks/useCurrentMetered'; import { useCurrentBillingFlags } from '@/billing/hooks/useCurrentBillingFlags'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useBillingWording = () => { const { t } = useLingui(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); assertIsDefinedOrThrow(currentWorkspace); diff --git a/packages/twenty-front/src/modules/billing/hooks/useCurrentBillingFlags.ts b/packages/twenty-front/src/modules/billing/hooks/useCurrentBillingFlags.ts index 17561b562c..8aa96755b4 100644 --- a/packages/twenty-front/src/modules/billing/hooks/useCurrentBillingFlags.ts +++ b/packages/twenty-front/src/modules/billing/hooks/useCurrentBillingFlags.ts @@ -3,11 +3,11 @@ import { BillingPlanKey, } from '~/generated-metadata/graphql'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { assertIsDefinedOrThrow } from 'twenty-shared/utils'; export const useCurrentBillingFlags = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); assertIsDefinedOrThrow(currentWorkspace); diff --git a/packages/twenty-front/src/modules/billing/hooks/useCurrentMetered.ts b/packages/twenty-front/src/modules/billing/hooks/useCurrentMetered.ts index a19eced0fb..f8cffb733b 100644 --- a/packages/twenty-front/src/modules/billing/hooks/useCurrentMetered.ts +++ b/packages/twenty-front/src/modules/billing/hooks/useCurrentMetered.ts @@ -1,7 +1,7 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useCurrentPlan } from '@/billing/hooks/useCurrentPlan'; import type { MeteredBillingPrice } from '@/billing/types/billing-price-tiers.type'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { assertIsDefinedOrThrow, findOrThrow } from 'twenty-shared/utils'; import { BillingProductKey, @@ -11,7 +11,7 @@ import { export const useCurrentMetered = () => { const { currentPlan } = useCurrentPlan(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); assertIsDefinedOrThrow(currentWorkspace); diff --git a/packages/twenty-front/src/modules/billing/hooks/useCurrentPlan.ts b/packages/twenty-front/src/modules/billing/hooks/useCurrentPlan.ts index a8f65220cb..23208427fc 100644 --- a/packages/twenty-front/src/modules/billing/hooks/useCurrentPlan.ts +++ b/packages/twenty-front/src/modules/billing/hooks/useCurrentPlan.ts @@ -2,12 +2,12 @@ import { BillingPlanKey } from '~/generated-metadata/graphql'; import { assertIsDefinedOrThrow, findOrThrow } from 'twenty-shared/utils'; import { usePlans } from './usePlans'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useCurrentPlan = () => { const { listPlans } = usePlans(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); assertIsDefinedOrThrow(currentWorkspace); diff --git a/packages/twenty-front/src/modules/billing/hooks/useEndSubscriptionTrialPeriod.ts b/packages/twenty-front/src/modules/billing/hooks/useEndSubscriptionTrialPeriod.ts index ec2c0b7dea..8ba1d28244 100644 --- a/packages/twenty-front/src/modules/billing/hooks/useEndSubscriptionTrialPeriod.ts +++ b/packages/twenty-front/src/modules/billing/hooks/useEndSubscriptionTrialPeriod.ts @@ -1,6 +1,6 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useRedirect } from '@/domain-manager/hooks/useRedirect'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { t } from '@lingui/core/macro'; import { useState } from 'react'; @@ -10,7 +10,7 @@ import { useEndSubscriptionTrialPeriodMutation } from '~/generated-metadata/grap export const useEndSubscriptionTrialPeriod = () => { const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar(); const [endSubscriptionTrialPeriod] = useEndSubscriptionTrialPeriodMutation(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); const [isLoading, setIsLoading] = useState(false); diff --git a/packages/twenty-front/src/modules/billing/hooks/useHasNextBillingPhase.ts b/packages/twenty-front/src/modules/billing/hooks/useHasNextBillingPhase.ts index 9c6f575821..1766513b67 100644 --- a/packages/twenty-front/src/modules/billing/hooks/useHasNextBillingPhase.ts +++ b/packages/twenty-front/src/modules/billing/hooks/useHasNextBillingPhase.ts @@ -1,8 +1,8 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useHasNextBillingPhase = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const hasNextBillingPhase = currentWorkspace?.currentBillingSubscription?.phases.length === 2; diff --git a/packages/twenty-front/src/modules/billing/hooks/useNextBillingPhase.ts b/packages/twenty-front/src/modules/billing/hooks/useNextBillingPhase.ts index 5035413b34..307abff6ab 100644 --- a/packages/twenty-front/src/modules/billing/hooks/useNextBillingPhase.ts +++ b/packages/twenty-front/src/modules/billing/hooks/useNextBillingPhase.ts @@ -1,8 +1,8 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useNextBillingPhase = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const nextBillingPhase = currentWorkspace?.currentBillingSubscription?.phases[1]; diff --git a/packages/twenty-front/src/modules/blocknote-editor/blocks/MentionInlineContent.tsx b/packages/twenty-front/src/modules/blocknote-editor/blocks/MentionInlineContent.tsx index d9da511c0c..8a6f120296 100644 --- a/packages/twenty-front/src/modules/blocknote-editor/blocks/MentionInlineContent.tsx +++ b/packages/twenty-front/src/modules/blocknote-editor/blocks/MentionInlineContent.tsx @@ -8,7 +8,7 @@ import { t } from '@lingui/core/macro'; import { isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { Chip, ChipVariant } from 'twenty-ui/components'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledRecordChip = styled(RecordChip)` height: auto; @@ -30,7 +30,7 @@ const LegacyMentionRenderer = ({ recordId: string; objectMetadataId: string; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (item) => item.id === objectMetadataId, diff --git a/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditorDropdownFocusEffect.tsx b/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditorDropdownFocusEffect.tsx index 9d59c91e10..b301171045 100644 --- a/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditorDropdownFocusEffect.tsx +++ b/packages/twenty-front/src/modules/blocknote-editor/components/BlockEditorDropdownFocusEffect.tsx @@ -2,7 +2,7 @@ import { type BLOCK_SCHEMA } from '@/blocknote-editor/blocks/Schema'; import { isSlashMenuOpenComponentState } from '@/blocknote-editor/states/isSlashMenuOpenComponentState'; import { useGoBackToPreviousDropdownFocusId } from '@/ui/layout/dropdown/hooks/useGoBackToPreviousDropdownFocusId'; import { useSetActiveDropdownFocusIdAndMemorizePrevious } from '@/ui/layout/dropdown/hooks/useSetFocusedDropdownIdAndMemorizePrevious'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -13,7 +13,7 @@ export type BlockEditorDropdownFocusEffectProps = { export const BlockEditorDropdownFocusEffect = ({ editor, }: BlockEditorDropdownFocusEffectProps) => { - const isSlashMenuOpenState = useRecoilComponentStateCallbackStateV2( + const isSlashMenuOpenState = useAtomComponentStateCallbackState( isSlashMenuOpenComponentState, ); diff --git a/packages/twenty-front/src/modules/blocknote-editor/components/CustomSlashMenuListItem.tsx b/packages/twenty-front/src/modules/blocknote-editor/components/CustomSlashMenuListItem.tsx index 4ef46e10ec..4851f3c31a 100644 --- a/packages/twenty-front/src/modules/blocknote-editor/components/CustomSlashMenuListItem.tsx +++ b/packages/twenty-front/src/modules/blocknote-editor/components/CustomSlashMenuListItem.tsx @@ -3,7 +3,7 @@ import { type SuggestionItem } from '@/blocknote-editor/types/types'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { MenuItemSuggestion } from 'twenty-ui/navigation'; export type CustomSlashMenuListItemProps = { @@ -15,7 +15,7 @@ export const CustomSlashMenuListItem = ({ }: CustomSlashMenuListItemProps) => { const { resetSelectedItem } = useSelectableList(SLASH_MENU_LIST_ID); - const isSelectedItem = useRecoilComponentFamilyValueV2( + const isSelectedItem = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, item.title, ); diff --git a/packages/twenty-front/src/modules/blocknote-editor/states/isSlashMenuOpenComponentState.ts b/packages/twenty-front/src/modules/blocknote-editor/states/isSlashMenuOpenComponentState.ts index 28f6d3a217..a0904ac6a4 100644 --- a/packages/twenty-front/src/modules/blocknote-editor/states/isSlashMenuOpenComponentState.ts +++ b/packages/twenty-front/src/modules/blocknote-editor/states/isSlashMenuOpenComponentState.ts @@ -1,7 +1,7 @@ import { BlockEditorComponentInstanceContext } from '@/blocknote-editor/contexts/BlockEditorCompoponeInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const isSlashMenuOpenComponentState = createComponentStateV2({ +export const isSlashMenuOpenComponentState = createAtomComponentState({ key: 'isSlashMenuOpenComponentState', defaultValue: false, componentInstanceContext: BlockEditorComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx b/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx index 0a29998d5a..ca10b3b9ef 100644 --- a/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx +++ b/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx @@ -4,18 +4,16 @@ import { getCaptchaUrlByProvider } from '@/captcha/utils/getCaptchaUrlByProvider import { isCaptchaRequiredForPath } from '@/captcha/utils/isCaptchaRequiredForPath'; import { useCaptcha } from '@/client-config/hooks/useCaptcha'; import { captchaState } from '@/client-config/states/captchaState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useEffect } from 'react'; import { useLocation } from 'react-router-dom'; import { assertIsDefinedOrThrow } from 'twenty-shared/utils'; import { CaptchaDriverType } from '~/generated-metadata/graphql'; export const CaptchaProviderScriptLoaderEffect = () => { - const captcha = useRecoilValueV2(captchaState); - const setIsCaptchaScriptLoaded = useSetRecoilStateV2( - isCaptchaScriptLoadedState, - ); + const captcha = useAtomStateValue(captchaState); + const setIsCaptchaScriptLoaded = useSetAtomState(isCaptchaScriptLoadedState); const { isCaptchaScriptLoaded, isCaptchaConfigured } = useCaptcha(); const { requestFreshCaptchaToken } = useRequestFreshCaptchaToken(); const location = useLocation(); diff --git a/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts b/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts index 1b0802f1b4..de1365bf4a 100644 --- a/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts +++ b/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts @@ -2,7 +2,7 @@ import { captchaTokenState } from '@/captcha/states/captchaTokenState'; import { isRequestingCaptchaTokenState } from '@/captcha/states/isRequestingCaptchaTokenState'; import { isCaptchaRequiredForPath } from '@/captcha/utils/isCaptchaRequiredForPath'; import { captchaState } from '@/client-config/states/captchaState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useCallback } from 'react'; import { assertIsDefinedOrThrow, isDefined } from 'twenty-shared/utils'; import { CaptchaDriverType } from '~/generated-metadata/graphql'; @@ -10,8 +10,8 @@ import { useStore } from 'jotai'; export const useRequestFreshCaptchaToken = () => { const store = useStore(); - const setCaptchaToken = useSetRecoilStateV2(captchaTokenState); - const setIsRequestingCaptchaToken = useSetRecoilStateV2( + const setCaptchaToken = useSetAtomState(captchaTokenState); + const setIsRequestingCaptchaToken = useSetAtomState( isRequestingCaptchaTokenState, ); diff --git a/packages/twenty-front/src/modules/captcha/states/captchaTokenState.ts b/packages/twenty-front/src/modules/captcha/states/captchaTokenState.ts index 132a698a16..f219a2ed7c 100644 --- a/packages/twenty-front/src/modules/captcha/states/captchaTokenState.ts +++ b/packages/twenty-front/src/modules/captcha/states/captchaTokenState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const captchaTokenState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const captchaTokenState = createAtomState({ key: 'captchaTokenState', defaultValue: undefined, }); diff --git a/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.ts b/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.ts index 399fb0d8f5..c36cd864c2 100644 --- a/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.ts +++ b/packages/twenty-front/src/modules/captcha/states/isCaptchaScriptLoadedState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isCaptchaScriptLoadedState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isCaptchaScriptLoadedState = createAtomState({ key: 'isCaptchaScriptLoadedState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.ts b/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.ts index 8e3647574c..24e3436cd7 100644 --- a/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.ts +++ b/packages/twenty-front/src/modules/captcha/states/isRequestingCaptchaTokenState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isRequestingCaptchaTokenState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isRequestingCaptchaTokenState = createAtomState({ key: 'isRequestingCaptchaTokenState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/chrome-extension-sidecar/components/ChromeExtensionSidecarEffect.tsx b/packages/twenty-front/src/modules/chrome-extension-sidecar/components/ChromeExtensionSidecarEffect.tsx index 16dd32196c..63db20737c 100644 --- a/packages/twenty-front/src/modules/chrome-extension-sidecar/components/ChromeExtensionSidecarEffect.tsx +++ b/packages/twenty-front/src/modules/chrome-extension-sidecar/components/ChromeExtensionSidecarEffect.tsx @@ -1,8 +1,8 @@ import { tokenPairState } from '@/auth/states/tokenPairState'; import { isLoadingTokensFromExtensionState } from '@/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState'; import { chromeExtensionIdState } from '@/client-config/states/chromeExtensionIdState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { isDefined } from 'twenty-shared/utils'; @@ -10,9 +10,9 @@ import { isInFrame } from '~/utils/isInIframe'; export const ChromeExtensionSidecarEffect = () => { const navigate = useNavigate(); - const setTokenPair = useSetRecoilStateV2(tokenPairState); - const chromeExtensionId = useRecoilValueV2(chromeExtensionIdState); - const setIsLoadingTokensFromExtension = useSetRecoilStateV2( + const setTokenPair = useSetAtomState(tokenPairState); + const chromeExtensionId = useAtomStateValue(chromeExtensionIdState); + const setIsLoadingTokensFromExtension = useSetAtomState( isLoadingTokensFromExtensionState, ); diff --git a/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.ts b/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.ts index 957dffb63f..fb92881de7 100644 --- a/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.ts +++ b/packages/twenty-front/src/modules/chrome-extension-sidecar/states/isLoadingTokensFromExtensionState.ts @@ -1,5 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isLoadingTokensFromExtensionState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isLoadingTokensFromExtensionState = createAtomState< + boolean | null +>({ key: 'isLoadingTokensFromExtensionState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/client-config/components/ClientConfigProvider.tsx b/packages/twenty-front/src/modules/client-config/components/ClientConfigProvider.tsx index ddb99146da..2e4922406f 100644 --- a/packages/twenty-front/src/modules/client-config/components/ClientConfigProvider.tsx +++ b/packages/twenty-front/src/modules/client-config/components/ClientConfigProvider.tsx @@ -1,12 +1,12 @@ import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { AppFullScreenErrorFallback } from '@/error-handler/components/AppFullScreenErrorFallback'; import { useLingui } from '@lingui/react/macro'; export const ClientConfigProvider: React.FC = ({ children, }) => { - const { isErrored, error } = useRecoilValueV2(clientConfigApiStatusState); + const { isErrored, error } = useAtomStateValue(clientConfigApiStatusState); const { t } = useLingui(); return isErrored && error instanceof Error ? ( diff --git a/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx b/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx index e456113784..378165296a 100644 --- a/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx +++ b/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx @@ -1,11 +1,11 @@ import { useClientConfig } from '@/client-config/hooks/useClientConfig'; import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const ClientConfigProviderEffect = () => { - const [clientConfigApiStatus, setClientConfigApiStatus] = useRecoilStateV2( + const [clientConfigApiStatus, setClientConfigApiStatus] = useAtomState( clientConfigApiStatusState, ); diff --git a/packages/twenty-front/src/modules/client-config/hooks/useCaptcha.ts b/packages/twenty-front/src/modules/client-config/hooks/useCaptcha.ts index 09b09a9d1b..f2f45529ff 100644 --- a/packages/twenty-front/src/modules/client-config/hooks/useCaptcha.ts +++ b/packages/twenty-front/src/modules/client-config/hooks/useCaptcha.ts @@ -2,15 +2,15 @@ import { captchaTokenState } from '@/captcha/states/captchaTokenState'; import { isCaptchaScriptLoadedState } from '@/captcha/states/isCaptchaScriptLoadedState'; import { captchaState } from '@/client-config/states/captchaState'; import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull'; export const useCaptcha = () => { - const captcha = useRecoilValueV2(captchaState); - const captchaToken = useRecoilValueV2(captchaTokenState); - const clientConfigApiStatus = useRecoilValueV2(clientConfigApiStatusState); - const isCaptchaScriptLoaded = useRecoilValueV2(isCaptchaScriptLoadedState); + const captcha = useAtomStateValue(captchaState); + const captchaToken = useAtomStateValue(captchaTokenState); + const clientConfigApiStatus = useAtomStateValue(clientConfigApiStatusState); + const isCaptchaScriptLoaded = useAtomStateValue(isCaptchaScriptLoadedState); const isClientConfigLoaded = clientConfigApiStatus.isLoadedOnce; const isSiteKeyDefined = isDefined(captcha?.siteKey); diff --git a/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts b/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts index 839d10f19e..bb4fe41ee6 100644 --- a/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts +++ b/packages/twenty-front/src/modules/client-config/hooks/useClientConfig.ts @@ -31,8 +31,8 @@ import { isAttachmentPreviewEnabledStateV2 } from '@/client-config/states/isAtta import { clientConfigApiStatusState } from '@/client-config/states/clientConfigApiStatusState'; import { getClientConfig } from '@/client-config/utils/getClientConfig'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useStore } from 'jotai'; type UseClientConfigResult = { @@ -45,91 +45,87 @@ type UseClientConfigResult = { export const useClientConfig = (): UseClientConfigResult => { const store = useStore(); - const setIsAnalyticsEnabled = useSetRecoilStateV2(isAnalyticsEnabledState); - const setDomainConfiguration = useSetRecoilStateV2(domainConfigurationState); - const setAuthProviders = useSetRecoilStateV2(authProvidersState); - const setAiModels = useSetRecoilStateV2(aiModelsState); + const setIsAnalyticsEnabled = useSetAtomState(isAnalyticsEnabledState); + const setDomainConfiguration = useSetAtomState(domainConfigurationState); + const setAuthProviders = useSetAtomState(authProvidersState); + const setAiModels = useSetAtomState(aiModelsState); - const setIsDeveloperDefaultSignInPrefilled = useSetRecoilStateV2( + const setIsDeveloperDefaultSignInPrefilled = useSetAtomState( isDeveloperDefaultSignInPrefilledState, ); - const setIsMultiWorkspaceEnabled = useSetRecoilStateV2( + const setIsMultiWorkspaceEnabled = useSetAtomState( isMultiWorkspaceEnabledState, ); - const setIsEmailVerificationRequired = useSetRecoilStateV2( + const setIsEmailVerificationRequired = useSetAtomState( isEmailVerificationRequiredState, ); - const setBilling = useSetRecoilStateV2(billingState); - const setSupportChat = useSetRecoilStateV2(supportChatState); + const setBilling = useSetAtomState(billingState); + const setSupportChat = useSetAtomState(supportChatState); - const setSentryConfig = useSetRecoilStateV2(sentryConfigState); - const [clientConfigApiStatus, setClientConfigApiStatus] = useRecoilStateV2( + const setSentryConfig = useSetAtomState(sentryConfigState); + const [clientConfigApiStatus, setClientConfigApiStatus] = useAtomState( clientConfigApiStatusState, ); - const setCaptcha = useSetRecoilStateV2(captchaState); + const setCaptcha = useSetAtomState(captchaState); - const setChromeExtensionId = useSetRecoilStateV2(chromeExtensionIdState); + const setChromeExtensionId = useSetAtomState(chromeExtensionIdState); - const setApiConfig = useSetRecoilStateV2(apiConfigState); + const setApiConfig = useSetAtomState(apiConfigState); - const setCanManageFeatureFlags = useSetRecoilStateV2( - canManageFeatureFlagsState, - ); + const setCanManageFeatureFlags = useSetAtomState(canManageFeatureFlagsState); - const setLabPublicFeatureFlags = useSetRecoilStateV2( + const setLabPublicFeatureFlags = useSetAtomState( labPublicFeatureFlagsStateV2, ); - const setMicrosoftMessagingEnabled = useSetRecoilStateV2( + const setMicrosoftMessagingEnabled = useSetAtomState( isMicrosoftMessagingEnabledState, ); - const setMicrosoftCalendarEnabled = useSetRecoilStateV2( + const setMicrosoftCalendarEnabled = useSetAtomState( isMicrosoftCalendarEnabledState, ); - const setGoogleMessagingEnabled = useSetRecoilStateV2( + const setGoogleMessagingEnabled = useSetAtomState( isGoogleMessagingEnabledState, ); - const setGoogleCalendarEnabled = useSetRecoilStateV2( + const setGoogleCalendarEnabled = useSetAtomState( isGoogleCalendarEnabledState, ); - const setIsAttachmentPreviewEnabled = useSetRecoilStateV2( + const setIsAttachmentPreviewEnabled = useSetAtomState( isAttachmentPreviewEnabledState, ); - const setIsConfigVariablesInDbEnabled = useSetRecoilStateV2( + const setIsConfigVariablesInDbEnabled = useSetAtomState( isConfigVariablesInDbEnabledState, ); - const setCalendarBookingPageId = useSetRecoilStateV2( - calendarBookingPageIdState, - ); + const setCalendarBookingPageId = useSetAtomState(calendarBookingPageIdState); - const setIsImapSmtpCaldavEnabled = useSetRecoilStateV2( + const setIsImapSmtpCaldavEnabled = useSetAtomState( isImapSmtpCaldavEnabledState, ); - const setIsEmailingDomainsEnabled = useSetRecoilStateV2( + const setIsEmailingDomainsEnabled = useSetAtomState( isEmailingDomainsEnabledState, ); - const setAllowRequestsToTwentyIcons = useSetRecoilStateV2( + const setAllowRequestsToTwentyIcons = useSetAtomState( allowRequestsToTwentyIconsState, ); - const setIsCloudflareIntegrationEnabled = useSetRecoilStateV2( + const setIsCloudflareIntegrationEnabled = useSetAtomState( isCloudflareIntegrationEnabledState, ); - const setIsClickHouseConfigured = useSetRecoilStateV2( + const setIsClickHouseConfigured = useSetAtomState( isClickHouseConfiguredState, ); - const setAppVersion = useSetRecoilStateV2(appVersionState); + const setAppVersion = useSetAtomState(appVersionState); const fetchClientConfig = useCallback(async () => { setClientConfigApiStatus((prev) => ({ diff --git a/packages/twenty-front/src/modules/client-config/states/aiModelsState.ts b/packages/twenty-front/src/modules/client-config/states/aiModelsState.ts index ce86935345..89055700a6 100644 --- a/packages/twenty-front/src/modules/client-config/states/aiModelsState.ts +++ b/packages/twenty-front/src/modules/client-config/states/aiModelsState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type ClientAiModelConfig } from '~/generated-metadata/graphql'; -export const aiModelsState = createStateV2({ +export const aiModelsState = createAtomState({ key: 'aiModelsState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/client-config/states/allowRequestsToTwentyIcons.ts b/packages/twenty-front/src/modules/client-config/states/allowRequestsToTwentyIcons.ts index 20f41530b3..e146c11513 100644 --- a/packages/twenty-front/src/modules/client-config/states/allowRequestsToTwentyIcons.ts +++ b/packages/twenty-front/src/modules/client-config/states/allowRequestsToTwentyIcons.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const allowRequestsToTwentyIconsState = createStateV2({ +export const allowRequestsToTwentyIconsState = createAtomState({ key: 'allowRequestsToTwentyIcons', defaultValue: true, }); diff --git a/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts b/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts index f01e72648e..e040a6965f 100644 --- a/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts +++ b/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts @@ -1,7 +1,7 @@ import { type ApiConfig } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const apiConfigState = createStateV2({ +export const apiConfigState = createAtomState({ key: 'apiConfigState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/client-config/states/appVersionState.ts b/packages/twenty-front/src/modules/client-config/states/appVersionState.ts index 96a0ac6475..ab29cdfaf1 100644 --- a/packages/twenty-front/src/modules/client-config/states/appVersionState.ts +++ b/packages/twenty-front/src/modules/client-config/states/appVersionState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const appVersionState = createStateV2({ +export const appVersionState = createAtomState({ key: 'appVersion', defaultValue: undefined, }); diff --git a/packages/twenty-front/src/modules/client-config/states/authProvidersState.ts b/packages/twenty-front/src/modules/client-config/states/authProvidersState.ts index b48c932b20..202ed7ff3f 100644 --- a/packages/twenty-front/src/modules/client-config/states/authProvidersState.ts +++ b/packages/twenty-front/src/modules/client-config/states/authProvidersState.ts @@ -1,7 +1,7 @@ import { type AuthProviders } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const authProvidersState = createStateV2({ +export const authProvidersState = createAtomState({ key: 'authProvidersState', defaultValue: { google: true, diff --git a/packages/twenty-front/src/modules/client-config/states/billingState.ts b/packages/twenty-front/src/modules/client-config/states/billingState.ts index aaffbf0ef3..3af307b3dd 100644 --- a/packages/twenty-front/src/modules/client-config/states/billingState.ts +++ b/packages/twenty-front/src/modules/client-config/states/billingState.ts @@ -1,7 +1,7 @@ import { type Billing } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const billingState = createStateV2({ +export const billingState = createAtomState({ key: 'billingState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/client-config/states/calendarBookingPageIdState.ts b/packages/twenty-front/src/modules/client-config/states/calendarBookingPageIdState.ts index 2ac982e5fd..00f68b5967 100644 --- a/packages/twenty-front/src/modules/client-config/states/calendarBookingPageIdState.ts +++ b/packages/twenty-front/src/modules/client-config/states/calendarBookingPageIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const calendarBookingPageIdState = createStateV2({ +export const calendarBookingPageIdState = createAtomState({ key: 'calendarBookingPageIdState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/client-config/states/canManageFeatureFlagsState.ts b/packages/twenty-front/src/modules/client-config/states/canManageFeatureFlagsState.ts index 7dbb351cd2..7a7db4646c 100644 --- a/packages/twenty-front/src/modules/client-config/states/canManageFeatureFlagsState.ts +++ b/packages/twenty-front/src/modules/client-config/states/canManageFeatureFlagsState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const canManageFeatureFlagsState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const canManageFeatureFlagsState = createAtomState({ key: 'canManageFeatureFlagsState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/captchaState.ts b/packages/twenty-front/src/modules/client-config/states/captchaState.ts index ccf8ac2b7f..af36d8d835 100644 --- a/packages/twenty-front/src/modules/client-config/states/captchaState.ts +++ b/packages/twenty-front/src/modules/client-config/states/captchaState.ts @@ -1,7 +1,7 @@ import { type Captcha } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const captchaState = createStateV2({ +export const captchaState = createAtomState({ key: 'captchaState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.ts b/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.ts index 6ea14aea4c..743e8fb0fa 100644 --- a/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.ts +++ b/packages/twenty-front/src/modules/client-config/states/chromeExtensionIdState.ts @@ -1,5 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const chromeExtensionIdState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const chromeExtensionIdState = createAtomState< + string | null | undefined +>({ key: 'chromeExtensionIdState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.ts b/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.ts index ffc6929d3c..819ac12290 100644 --- a/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.ts +++ b/packages/twenty-front/src/modules/client-config/states/clientConfigApiStatusState.ts @@ -1,5 +1,5 @@ import { type ClientConfig } from '@/client-config/types/ClientConfig'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; type ClientConfigApiStatus = { isLoadedOnce: boolean; @@ -10,14 +10,15 @@ type ClientConfigApiStatus = { data?: { clientConfig: ClientConfig }; }; -export const clientConfigApiStatusState = createStateV2({ - key: 'clientConfigApiStatus', - defaultValue: { - isLoadedOnce: false, - isLoading: false, - isErrored: false, - isSaved: false, - error: undefined, - data: undefined, - }, -}); +export const clientConfigApiStatusState = + createAtomState({ + key: 'clientConfigApiStatus', + defaultValue: { + isLoadedOnce: false, + isLoading: false, + isErrored: false, + isSaved: false, + error: undefined, + data: undefined, + }, + }); diff --git a/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.ts index 473abd436b..eff7cd7b53 100644 --- a/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isAnalyticsEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isAnalyticsEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isAnalyticsEnabledState = createAtomState({ key: 'isAnalyticsEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledState.ts index 9f96f9a0e9..cf3950e5e3 100644 --- a/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isAttachmentPreviewEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isAttachmentPreviewEnabledState = createAtomState({ key: 'isAttachmentPreviewEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledStateV2.ts b/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledStateV2.ts index 9432c3f41f..9d8af27499 100644 --- a/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledStateV2.ts +++ b/packages/twenty-front/src/modules/client-config/states/isAttachmentPreviewEnabledStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isAttachmentPreviewEnabledStateV2 = createStateV2({ +export const isAttachmentPreviewEnabledStateV2 = createAtomState({ key: 'isAttachmentPreviewEnabledStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isClickHouseConfiguredState.ts b/packages/twenty-front/src/modules/client-config/states/isClickHouseConfiguredState.ts index ea2dbbc34f..8ff6012a5a 100644 --- a/packages/twenty-front/src/modules/client-config/states/isClickHouseConfiguredState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isClickHouseConfiguredState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isClickHouseConfiguredState = createStateV2({ +export const isClickHouseConfiguredState = createAtomState({ key: 'isClickHouseConfigured', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isCloudflareIntegrationEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isCloudflareIntegrationEnabledState.ts index c07582f7d3..9b6ef4633e 100644 --- a/packages/twenty-front/src/modules/client-config/states/isCloudflareIntegrationEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isCloudflareIntegrationEnabledState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isCloudflareIntegrationEnabledState = createStateV2({ +export const isCloudflareIntegrationEnabledState = createAtomState({ key: 'isCloudflareIntegrationEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isConfigVariablesInDbEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isConfigVariablesInDbEnabledState.ts index dd264e3a6c..9680473435 100644 --- a/packages/twenty-front/src/modules/client-config/states/isConfigVariablesInDbEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isConfigVariablesInDbEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isConfigVariablesInDbEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isConfigVariablesInDbEnabledState = createAtomState({ key: 'isConfigVariablesInDbEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.ts b/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.ts index 8e7873c389..0c17b04938 100644 --- a/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isDeveloperDefaultSignInPrefilledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isDeveloperDefaultSignInPrefilledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isDeveloperDefaultSignInPrefilledState = createAtomState({ key: 'isDeveloperDefaultSignInPrefilledState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isEmailVerificationRequiredState.ts b/packages/twenty-front/src/modules/client-config/states/isEmailVerificationRequiredState.ts index c6d5a3a500..436c8df958 100644 --- a/packages/twenty-front/src/modules/client-config/states/isEmailVerificationRequiredState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isEmailVerificationRequiredState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isEmailVerificationRequiredState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isEmailVerificationRequiredState = createAtomState({ key: 'isEmailVerificationRequired', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isEmailingDomainsEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isEmailingDomainsEnabledState.ts index 3b551210f9..4531b00669 100644 --- a/packages/twenty-front/src/modules/client-config/states/isEmailingDomainsEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isEmailingDomainsEnabledState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isEmailingDomainsEnabledState = createStateV2({ +export const isEmailingDomainsEnabledState = createAtomState({ key: 'isEmailingDomainsEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isGoogleCalendarEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isGoogleCalendarEnabledState.ts index 9d0844d91d..a1ed1628cc 100644 --- a/packages/twenty-front/src/modules/client-config/states/isGoogleCalendarEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isGoogleCalendarEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isGoogleCalendarEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isGoogleCalendarEnabledState = createAtomState({ key: 'isGoogleCalendarEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isGoogleMessagingEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isGoogleMessagingEnabledState.ts index 0d132e064c..78d9c56181 100644 --- a/packages/twenty-front/src/modules/client-config/states/isGoogleMessagingEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isGoogleMessagingEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isGoogleMessagingEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isGoogleMessagingEnabledState = createAtomState({ key: 'isGoogleMessagingEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isImapSmtpCaldavEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isImapSmtpCaldavEnabledState.ts index 4664ff1169..76224d0fc0 100644 --- a/packages/twenty-front/src/modules/client-config/states/isImapSmtpCaldavEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isImapSmtpCaldavEnabledState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isImapSmtpCaldavEnabledState = createStateV2({ +export const isImapSmtpCaldavEnabledState = createAtomState({ key: 'isImapSmtpCaldavEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isMicrosoftCalendarEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isMicrosoftCalendarEnabledState.ts index 7718ace109..1bee452510 100644 --- a/packages/twenty-front/src/modules/client-config/states/isMicrosoftCalendarEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isMicrosoftCalendarEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isMicrosoftCalendarEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isMicrosoftCalendarEnabledState = createAtomState({ key: 'isMicrosoftCalendarEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isMicrosoftMessagingEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isMicrosoftMessagingEnabledState.ts index dd666aaadd..2a4c2d865b 100644 --- a/packages/twenty-front/src/modules/client-config/states/isMicrosoftMessagingEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isMicrosoftMessagingEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isMicrosoftMessagingEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isMicrosoftMessagingEnabledState = createAtomState({ key: 'isMicrosoftMessagingEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.ts b/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.ts index 6a671ba123..2d5e52cff6 100644 --- a/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.ts +++ b/packages/twenty-front/src/modules/client-config/states/isMultiWorkspaceEnabledState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isMultiWorkspaceEnabledState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isMultiWorkspaceEnabledState = createAtomState({ key: 'isMultiWorkspaceEnabled', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/client-config/states/labPublicFeatureFlagsStateV2.ts b/packages/twenty-front/src/modules/client-config/states/labPublicFeatureFlagsStateV2.ts index 94d8c3acd4..d68ad025b6 100644 --- a/packages/twenty-front/src/modules/client-config/states/labPublicFeatureFlagsStateV2.ts +++ b/packages/twenty-front/src/modules/client-config/states/labPublicFeatureFlagsStateV2.ts @@ -1,8 +1,10 @@ import { type PublicFeatureFlag } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const labPublicFeatureFlagsStateV2 = createStateV2({ +export const labPublicFeatureFlagsStateV2 = createAtomState< + PublicFeatureFlag[] +>({ key: 'labPublicFeatureFlagsStateV2', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/client-config/states/sentryConfigState.ts b/packages/twenty-front/src/modules/client-config/states/sentryConfigState.ts index 1577edffc7..e5d38a8f0c 100644 --- a/packages/twenty-front/src/modules/client-config/states/sentryConfigState.ts +++ b/packages/twenty-front/src/modules/client-config/states/sentryConfigState.ts @@ -1,7 +1,7 @@ import { type Sentry } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const sentryConfigState = createStateV2({ +export const sentryConfigState = createAtomState({ key: 'sentryConfigState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/client-config/states/supportChatState.ts b/packages/twenty-front/src/modules/client-config/states/supportChatState.ts index 880bc8293d..900a522795 100644 --- a/packages/twenty-front/src/modules/client-config/states/supportChatState.ts +++ b/packages/twenty-front/src/modules/client-config/states/supportChatState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type Support, SupportDriver } from '~/generated-metadata/graphql'; -export const supportChatState = createStateV2({ +export const supportChatState = createAtomState({ key: 'supportChatState', defaultValue: { supportDriver: SupportDriver.NONE, diff --git a/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx b/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx index 4e5f529b63..0143308a1a 100644 --- a/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx +++ b/packages/twenty-front/src/modules/command-menu-item/hooks/useCommandMenuItemFrontComponentActions.tsx @@ -8,7 +8,7 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { useMountHeadlessFrontComponent } from '@/front-components/hooks/useMountHeadlessFrontComponent'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -94,17 +94,17 @@ export const useCommandMenuItemFrontComponentActions = () => { useOpenFrontComponentInCommandMenu(); const mountHeadlessFrontComponent = useMountHeadlessFrontComponent(); - const isPageInEditMode = useRecoilComponentValueV2( + const isPageInEditMode = useAtomComponentStateValue( contextStoreIsPageInEditModeComponentState, ); const { actionMenuType } = useContext(ActionMenuContext); - const currentObjectMetadataItemId = useRecoilComponentValueV2( + const currentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, ); - const targetedRecordsRule = useRecoilComponentValueV2( + const targetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx index 65be0254b8..e6931f1712 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenu.tsx @@ -7,8 +7,8 @@ import { useMatchingCommandMenuActions } from '@/command-menu/hooks/useMatchingC import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchState'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; @@ -20,7 +20,7 @@ export type ActionGroupConfig = { export const CommandMenu = () => { const { t } = useLingui(); - const commandMenuSearch = useRecoilValueV2(commandMenuSearchState); + const commandMenuSearch = useAtomStateValue(commandMenuSearchState); const { objectMetadataItems } = useObjectMetadataItems(); const { @@ -40,12 +40,12 @@ export const CommandMenu = () => { }); const previousContextStoreCurrentObjectMetadataItemId = - useRecoilComponentValueV2( + useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, 'command-menu-previous', ); - const objectMetadataItemId = useRecoilComponentValueV2( + const objectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, ); const currentObjectMetadataItem = objectMetadataItems.find( diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuAskAIInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuAskAIInfo.tsx index 5894f39305..ffe86edaf4 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuAskAIInfo.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuAskAIInfo.tsx @@ -1,5 +1,5 @@ import { currentAIChatThreadTitleState } from '@/ai/states/currentAIChatThreadTitleState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { OverflowingTextWithTooltip } from 'twenty-ui/display'; @@ -11,7 +11,7 @@ const StyledPageTitle = styled.div` `; export const CommandMenuAskAIInfo = () => { - const currentAIChatThreadTitle = useRecoilValueV2( + const currentAIChatThreadTitle = useAtomStateValue( currentAIChatThreadTitleState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx index 084b1e4cd6..e54b2fbd46 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContainer.tsx @@ -8,8 +8,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledCommandMenuContainer = styled.div<{ isMobile: boolean }>` max-height: ${({ theme, isMobile }) => { @@ -29,19 +29,19 @@ type CommandMenuContainerProps = { export const CommandMenuContainer = ({ children, }: CommandMenuContainerProps) => { - const objectMetadataItemId = useRecoilComponentValueV2( + const objectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); const isMobile = useIsMobile(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => objectMetadataItem.id === objectMetadataItemId, ); - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordsChip.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordsChip.tsx index 97d5114372..6fffcf5eeb 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordsChip.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuContextRecordsChip.tsx @@ -4,7 +4,7 @@ import { getSelectedRecordsContextText } from '@/command-menu/utils/getRecordCon import { useFindManyRecordsSelectedInContextStore } from '@/context-store/hooks/useFindManyRecordsSelectedInContextStore'; import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const CommandMenuContextRecordsChip = ({ objectMetadataItemId, @@ -16,7 +16,7 @@ export const CommandMenuContextRecordsChip = ({ const { objectMetadataItem } = useObjectMetadataItemById({ objectId: objectMetadataItemId, }); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuDefaultSelectionEffect.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuDefaultSelectionEffect.tsx index 39f4b48186..713c02da51 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuDefaultSelectionEffect.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuDefaultSelectionEffect.tsx @@ -2,8 +2,8 @@ import { COMMAND_MENU_LIST_SELECTABLE_LIST_ID } from '@/command-menu/constants/C import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -16,12 +16,12 @@ export const CommandMenuDefaultSelectionEffect = ({ COMMAND_MENU_LIST_SELECTABLE_LIST_ID, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, COMMAND_MENU_LIST_SELECTABLE_LIST_ID, ); - const hasUserSelectedCommand = useRecoilValueV2(hasUserSelectedCommandState); + const hasUserSelectedCommand = useAtomStateValue(hasUserSelectedCommandState); useEffect(() => { if ( diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuFolderInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuFolderInfo.tsx index 323760b4fc..6f82adeaa6 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuFolderInfo.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuFolderInfo.tsx @@ -12,11 +12,11 @@ import { NavigationMenuItemType } from '@/navigation-menu-item/constants/Navigat import { useUpdateFolderInDraft } from '@/navigation-menu-item/hooks/useUpdateFolderInDraft'; import { useWorkspaceSectionItems } from '@/navigation-menu-item/hooks/useWorkspaceSectionItems'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getNavigationMenuItemIconColors } from '@/navigation-menu-item/utils/getNavigationMenuItemIconColors'; import { IconPicker } from '@/ui/input/components/IconPicker'; import { TitleInput } from '@/ui/input/components/TitleInput'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; const StyledClickableIconWrapper = styled.div` cursor: pointer; @@ -26,13 +26,13 @@ export const CommandMenuFolderInfo = () => { const theme = useTheme(); const { t } = useLingui(); const { getIcon } = useIcons(); - const commandMenuPageInfo = useRecoilValueV2(commandMenuPageInfoState); + const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); const [shouldFocusTitleInput, setShouldFocusTitleInput] = - useRecoilComponentStateV2( + useAtomComponentState( commandMenuShouldFocusTitleInputComponentState, commandMenuPageInfo.instanceId, ); - const selectedNavigationMenuItemInEditMode = useRecoilValueV2( + const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeStateV2, ); const items = useWorkspaceSectionItems(); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx index d3aa02806a..fba4eaaac5 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuForMobile.tsx @@ -1,7 +1,7 @@ import { CommandMenuOpenContainer } from '@/command-menu/components/CommandMenuOpenContainer'; import { CommandMenuRouter } from '@/command-menu/components/CommandMenuRouter'; import { isCommandMenuOpenedStateV2 } from '@/command-menu/states/isCommandMenuOpenedStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { AnimatePresence } from 'framer-motion'; @@ -13,7 +13,7 @@ const StyledCommandMenuMobileFullScreenContainer = styled.div` `; export const CommandMenuForMobile = () => { - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); return ( diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx index 9281fb61f3..7f985cb3f1 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx @@ -5,7 +5,7 @@ import { MenuItem } from 'twenty-ui/navigation'; import { useCommandMenuOnItemClick } from '@/command-menu/hooks/useCommandMenuOnItemClick'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; export type CommandMenuItemProps = { label: string; @@ -44,7 +44,7 @@ export const CommandMenuItem = ({ Icon = IconArrowUpRight; } - const isSelectedItemId = useRecoilComponentFamilyValueV2( + const isSelectedItemId = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, id, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx index 32737107f7..264db9a6d5 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemDropdown.tsx @@ -9,7 +9,7 @@ import { } from '@/ui/layout/dropdown/components/Dropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export type CommandMenuItemDropdownProps = CommandMenuItemProps & Pick< @@ -31,7 +31,7 @@ export const CommandMenuItemDropdown = ({ dropdownId, disabled = false, }: CommandMenuItemDropdownProps) => { - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemNumberInput.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemNumberInput.tsx index e4e2476196..43923fc130 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemNumberInput.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemNumberInput.tsx @@ -4,7 +4,7 @@ import { TextInput } from '@/ui/input/components/TextInput'; import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import styled from '@emotion/styled'; import { useRef, useState } from 'react'; @@ -45,7 +45,7 @@ export const CommandMenuItemNumberInput = ({ const [draftValue, setDraftValue] = useState(value); const [hasError, setHasError] = useState(false); - const currentFocusId = useRecoilValueV2(currentFocusIdSelector); + const currentFocusId = useAtomStateValue(currentFocusIdSelector); const isNumberInputCurrentlyFocused = currentFocusId === focusId; const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemTextInput.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemTextInput.tsx index 33338ce33e..3b7df12906 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemTextInput.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemTextInput.tsx @@ -4,7 +4,7 @@ import { TextInput } from '@/ui/input/components/TextInput'; import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import styled from '@emotion/styled'; import { useRef, useState } from 'react'; @@ -37,7 +37,7 @@ export const CommandMenuItemTextInput = ({ const focusId = `${id}-input`; const [draftValue, setDraftValue] = useState(value); - const currentFocusId = useRecoilValueV2(currentFocusIdSelector); + const currentFocusId = useAtomStateValue(currentFocusIdSelector); const isTextInputCurrentlyFocused = currentFocusId === focusId; const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemToggle.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemToggle.tsx index 99821f0843..6f6f2208eb 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemToggle.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemToggle.tsx @@ -1,5 +1,5 @@ import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { MenuItemToggle, type MenuItemToggleProps } from 'twenty-ui/navigation'; export type CommandMenuItemToggleProps = MenuItemToggleProps & { @@ -7,7 +7,7 @@ export type CommandMenuItemToggleProps = MenuItemToggleProps & { }; export const CommandMenuItemToggle = (props: CommandMenuItemToggleProps) => { - const isSelectedItemId = useRecoilComponentFamilyValueV2( + const isSelectedItemId = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, props.id, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemWithAddToNavigationDrag.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemWithAddToNavigationDrag.tsx index c19c2c2ee4..4948f3e2d2 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemWithAddToNavigationDrag.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemWithAddToNavigationDrag.tsx @@ -7,7 +7,7 @@ import { type IconComponent } from 'twenty-ui/display'; import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem'; import { AddToNavigationDragHandle } from '@/navigation-menu-item/components/AddToNavigationDragHandle'; import { addToNavPayloadRegistryStateV2 } from '@/navigation-menu-item/states/addToNavPayloadRegistryStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import type { AddToNavigationDragPayload } from '@/navigation-menu-item/types/add-to-navigation-drag-payload'; type CommandMenuItemWithAddToNavigationDragProps = { @@ -41,7 +41,7 @@ export const CommandMenuItemWithAddToNavigationDrag = ({ dragIndex, }: CommandMenuItemWithAddToNavigationDragProps) => { const { t } = useLingui(); - const setRegistry = useSetRecoilStateV2(addToNavPayloadRegistryStateV2); + const setRegistry = useSetAtomState(addToNavPayloadRegistryStateV2); const [isHovered, setIsHovered] = useState(false); const contextualDescription = isHovered diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuLinkInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuLinkInfo.tsx index 4c2d6d32fc..e9a419e312 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuLinkInfo.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuLinkInfo.tsx @@ -10,21 +10,21 @@ import { StyledNavigationMenuItemIconContainer } from '@/navigation-menu-item/co import { useUpdateLinkInDraft } from '@/navigation-menu-item/hooks/useUpdateLinkInDraft'; import { useWorkspaceSectionItems } from '@/navigation-menu-item/hooks/useWorkspaceSectionItems'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getNavigationMenuItemIconColors } from '@/navigation-menu-item/utils/getNavigationMenuItemIconColors'; import { TitleInput } from '@/ui/input/components/TitleInput'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; export const CommandMenuLinkInfo = () => { const theme = useTheme(); const { t } = useLingui(); - const commandMenuPageInfo = useRecoilValueV2(commandMenuPageInfoState); + const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); const [shouldFocusTitleInput, setShouldFocusTitleInput] = - useRecoilComponentStateV2( + useAtomComponentState( commandMenuShouldFocusTitleInputComponentState, commandMenuPageInfo.instanceId, ); - const selectedNavigationMenuItemInEditMode = useRecoilValueV2( + const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeStateV2, ); const items = useWorkspaceSectionItems(); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx index b5cbfde474..a5ed78ba9e 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuList.tsx @@ -8,7 +8,7 @@ import { COMMAND_MENU_SEARCH_BAR_PADDING } from '@/command-menu/constants/Comman import { SIDE_PANEL_FOCUS_ID } from '@/command-menu/constants/SidePanelFocusId'; import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelectedCommandState'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -63,7 +63,7 @@ export const CommandMenuList = ({ noResults = false, noResultsText, }: CommandMenuListProps) => { - const setHasUserSelectedCommand = useSetRecoilStateV2( + const setHasUserSelectedCommand = useSetAtomState( hasUserSelectedCommandState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx index df9953a600..19373062f7 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx @@ -12,7 +12,7 @@ import { PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/pa import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; import { useStore } from 'jotai'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { WORKFLOW_DIAGRAM_CREATE_STEP_NODE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramCreateStepNodeClickOutsideId'; import { WORKFLOW_DIAGRAM_STEP_NODE_BASE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramStepNodeClickOutsideId'; import { WORKFLOW_DIAGRAM_EDGE_OPTIONS_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/workflow-edges/constants/WorkflowDiagramEdgeOptionsClickOutsideId'; @@ -54,9 +54,7 @@ export const CommandMenuOpenContainer = ({ const { closeCommandMenu } = useCommandMenu(); const commandMenuRef = useRef(null); - const setIsSidePanelAnimating = useSetRecoilStateV2( - isSidePanelAnimatingStateV2, - ); + const setIsSidePanelAnimating = useSetAtomState(isSidePanelAnimatingStateV2); const store = useStore(); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx index 87bb1d21c0..3a08a0b076 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageInfo.tsx @@ -13,7 +13,7 @@ import { CommandMenuWorkflowStepInfo } from '@/command-menu/components/CommandMe import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; import { useWorkspaceSectionItems } from '@/navigation-menu-item/hooks/useWorkspaceSectionItems'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CommandMenuPages } from 'twenty-shared/types'; import { type CommandMenuContextChipProps } from './CommandMenuContextChip'; @@ -29,7 +29,7 @@ type CommandMenuPageInfoProps = { }; export const CommandMenuPageInfo = ({ pageChip }: CommandMenuPageInfoProps) => { - const selectedNavigationMenuItemInEditMode = useRecoilValueV2( + const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeStateV2, ); const items = useWorkspaceSectionItems(); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfo.tsx index 5aae47e50f..50180f8e25 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfo.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfo.tsx @@ -3,11 +3,11 @@ import { CommandMenuRecordPageLayoutInfo } from '@/command-menu/components/Comma import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const CommandMenuPageLayoutInfo = () => { - const objectMetadataId = useRecoilComponentValueV2( + const objectMetadataId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx index 7ad3e73eca..bc0a7c4d82 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuPageLayoutInfoContent.tsx @@ -9,11 +9,11 @@ import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDr import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { pageLayoutTabSettingsOpenTabIdComponentState } from '@/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState'; import { TitleInput } from '@/ui/input/components/TitleInput'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import { isNonEmptyString } from '@sniptt/guards'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useState } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -27,11 +27,11 @@ export const CommandMenuPageLayoutInfoContent = ({ }) => { const theme = useTheme(); const { getIcon } = useIcons(); - const commandMenuPage = useRecoilValueV2(commandMenuPageState); - const commandMenuPageInfo = useRecoilValueV2(commandMenuPageInfoState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); + const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); const [shouldFocusTitleInput, setShouldFocusTitleInput] = - useRecoilComponentStateV2( + useAtomComponentState( commandMenuShouldFocusTitleInputComponentState, commandMenuPageInfo.instanceId, ); @@ -40,17 +40,17 @@ export const CommandMenuPageLayoutInfoContent = ({ setShouldFocusTitleInput(false); }; - const draftPageLayout = useRecoilComponentValueV2( + const draftPageLayout = useAtomComponentStateValue( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutEditingWidgetId = useRecoilComponentValueV2( + const pageLayoutEditingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); - const [openTabId] = useRecoilComponentStateV2( + const [openTabId] = useAtomComponentState( pageLayoutTabSettingsOpenTabIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordInfo.tsx index 310d8f6f3f..79f40098f2 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordInfo.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRecordInfo.tsx @@ -11,12 +11,12 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states import { recordStoreIdentifierFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreIdentifierFamilySelectorV2'; import { RecordTitleCell } from '@/object-record/record-title-cell/components/RecordTitleCell'; import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { Trans } from '@lingui/react/macro'; import { isNonEmptyString } from '@sniptt/guards'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Avatar } from 'twenty-ui/display'; import { FeatureFlagKey, @@ -31,15 +31,15 @@ export const CommandMenuRecordInfo = ({ }: { commandMenuPageInstanceId: string; }) => { - const viewableRecordNameSingular = useRecoilComponentValueV2( + const viewableRecordNameSingular = useAtomComponentStateValue( viewableRecordNameSingularComponentState, commandMenuPageInstanceId, ); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); - const viewableRecordId = useRecoilComponentValueV2( + const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, commandMenuPageInstanceId, ); @@ -49,16 +49,19 @@ export const CommandMenuRecordInfo = ({ viewableRecordId!, ); - const recordCreatedAt = useFamilySelectorValueV2( + const recordCreatedAt = useAtomFamilySelectorValue( recordStoreFamilySelectorV2, - { recordId: objectRecordId, fieldName: 'createdAt' }, + { + recordId: objectRecordId, + fieldName: 'createdAt', + }, ) as string | null; const isFilesFieldMigrated = useIsFeatureEnabled( FeatureFlagKey.IS_FILES_FIELD_MIGRATED, ); - const recordIdentifier = useFamilySelectorValueV2( + const recordIdentifier = useAtomFamilySelectorValue( recordStoreIdentifierFamilySelectorV2, { recordId: objectRecordId, @@ -67,7 +70,7 @@ export const CommandMenuRecordInfo = ({ }, ); - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const beautifiedCreatedAt = isNonEmptyString(recordCreatedAt) ? beautifyPastDateRelativeToNow(recordCreatedAt, localeCatalog) : ''; diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx index f15841353d..855cb0c00a 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuRouter.tsx @@ -5,7 +5,7 @@ import { COMMAND_MENU_PAGES_CONFIG } from '@/command-menu/constants/CommandMenuP import { commandMenuPageInfoState } from '@/command-menu/states/commandMenuPageInfoState'; import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { motion } from 'framer-motion'; @@ -17,8 +17,8 @@ const StyledCommandMenuContent = styled.div` `; export const CommandMenuRouter = () => { - const commandMenuPage = useRecoilValueV2(commandMenuPageState); - const commandMenuPageInfo = useRecoilValueV2(commandMenuPageInfoState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); + const commandMenuPageInfo = useAtomStateValue(commandMenuPageInfoState); const commandMenuPageComponent = isDefined(commandMenuPage) ? ( COMMAND_MENU_PAGES_CONFIG.get(commandMenuPage) diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuSidePanelForDesktop.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuSidePanelForDesktop.tsx index be2a127171..2416f15c28 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuSidePanelForDesktop.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuSidePanelForDesktop.tsx @@ -12,9 +12,9 @@ import { tableWidthResizeIsActiveState } from '@/object-record/record-table/stat import { ModalContainerContext } from '@/ui/layout/modal/contexts/ModalContainerContext'; import { ResizablePanelGap } from '@/ui/layout/resizable-panel/components/ResizablePanelGap'; import { COMMAND_MENU_CONSTRAINTS } from '@/ui/layout/resizable-panel/constants/CommandMenuConstraints'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import styled from '@emotion/styled'; import { useCallback, useState } from 'react'; @@ -56,9 +56,9 @@ const StyledModalContainer = styled.div` const GAP_WIDTH = 8; export const CommandMenuSidePanelForDesktop = () => { - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); - const isCommandMenuClosing = useRecoilValueV2(isCommandMenuClosingState); - const [commandMenuWidth, setCommandMenuWidth] = useRecoilStateV2( + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); + const isCommandMenuClosing = useAtomStateValue(isCommandMenuClosingState); + const [commandMenuWidth, setCommandMenuWidth] = useAtomState( commandMenuWidthState, ); const { closeCommandMenu } = useCommandMenu(); @@ -72,7 +72,7 @@ export const CommandMenuSidePanelForDesktop = () => { const [shouldRenderContent, setShouldRenderContent] = useState(isCommandMenuOpened); - const setTableWidthResizeIsActive = useSetRecoilStateV2( + const setTableWidthResizeIsActive = useSetAtomState( tableWidthResizeIsActiveState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx index c5553af263..7320c2cfdd 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBar.tsx @@ -18,8 +18,8 @@ import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { AnimatePresence, motion } from 'framer-motion'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useRef } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; import { IconX } from 'twenty-ui/display'; @@ -80,7 +80,7 @@ const StyledContentContainer = styled.div` `; export const CommandMenuTopBar = () => { - const [commandMenuSearch, setCommandMenuSearch] = useRecoilStateV2( + const [commandMenuSearch, setCommandMenuSearch] = useAtomState( commandMenuSearchState, ); const inputRef = useRef(null); @@ -95,9 +95,9 @@ export const CommandMenuTopBar = () => { const { closeCommandMenu } = useCommandMenu(); - const commandMenuPage = useRecoilValueV2(commandMenuPageState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); - const commandMenuNavigationStack = useRecoilValueV2( + const commandMenuNavigationStack = useAtomStateValue( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarInputFocusEffect.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarInputFocusEffect.tsx index 03ca4f7581..2a4189000b 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarInputFocusEffect.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarInputFocusEffect.tsx @@ -1,5 +1,5 @@ import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; @@ -10,7 +10,7 @@ type CommandMenuTopBarInputFocusEffectProps = { export const CommandMenuTopBarInputFocusEffect = ({ inputRef, }: CommandMenuTopBarInputFocusEffectProps) => { - const commandMenuPage = useRecoilValueV2(commandMenuPageState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); useEffect(() => { if ( diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarRightCornerIcon.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarRightCornerIcon.tsx index 39f636ba72..9a2efda394 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarRightCornerIcon.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuTopBarRightCornerIcon.tsx @@ -1,6 +1,6 @@ import { useOpenAskAIPageInCommandMenu } from '@/command-menu/hooks/useOpenAskAIPageInCommandMenu'; import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -19,7 +19,7 @@ const StyledIconButton = styled(IconButton)` export const CommandMenuTopBarRightCornerIcon = () => { const isMobile = useIsMobile(); const isAiEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_AI_ENABLED); - const commandMenuPage = useRecoilValueV2(commandMenuPageState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); const { openAskAIPage } = useOpenAskAIPageInCommandMenu(); const { createChatThread } = useCreateNewAIChatThread(); diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWidthEffect.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuWidthEffect.tsx index 3726df41c8..49f052d389 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWidthEffect.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuWidthEffect.tsx @@ -4,10 +4,10 @@ import { COMMAND_MENU_WIDTH_VAR, commandMenuWidthState, } from '@/command-menu/states/commandMenuWidthState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const CommandMenuWidthEffect = () => { - const commandMenuWidth = useRecoilValueV2(commandMenuWidthState); + const commandMenuWidth = useAtomStateValue(commandMenuWidthState); useEffect(() => { document.documentElement.style.setProperty( diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx index 81ec0ec34a..d6481a68d5 100644 --- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuWorkflowStepInfo.tsx @@ -5,7 +5,7 @@ import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { TitleInput } from '@/ui/input/components/TitleInput'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { getAgentIdFromStep } from '@/workflow/utils/getAgentIdFromStep'; @@ -19,7 +19,7 @@ import { getTriggerIcon } from '@/workflow/workflow-trigger/utils/getTriggerIcon import { getTriggerIconColor } from '@/workflow/workflow-trigger/utils/getTriggerIconColor'; import { useTheme } from '@emotion/react'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useState } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -35,11 +35,11 @@ export const CommandMenuWorkflowStepInfo = ({ const theme = useTheme(); const { getIcon } = useIcons(); - const commandMenuPage = useRecoilValueV2(commandMenuPageState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); const workflowId = useCommandMenuWorkflowIdOrThrow(); - const workflowStepId = useRecoilComponentValueV2( + const workflowStepId = useAtomComponentStateValue( commandMenuWorkflowStepIdComponentState, commandMenuPageInstanceId, ); diff --git a/packages/twenty-front/src/modules/command-menu/components/ResetContextToSelectionCommandButton.tsx b/packages/twenty-front/src/modules/command-menu/components/ResetContextToSelectionCommandButton.tsx index 98530afe62..9e1df473c7 100644 --- a/packages/twenty-front/src/modules/command-menu/components/ResetContextToSelectionCommandButton.tsx +++ b/packages/twenty-front/src/modules/command-menu/components/ResetContextToSelectionCommandButton.tsx @@ -7,24 +7,24 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; import { IconArrowBackUp } from 'twenty-ui/display'; export const ResetContextToSelectionCommandButton = () => { - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, 'command-menu-previous', ); - const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2( + const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, 'command-menu-previous', ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuCloseAnimationCompleteCleanup.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuCloseAnimationCompleteCleanup.test.tsx index 0bc53ffe62..eca2c41d8e 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuCloseAnimationCompleteCleanup.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useCommandMenuCloseAnimationCompleteCleanup.test.tsx @@ -16,8 +16,8 @@ import { hasUserSelectedCommandState } from '@/command-menu/states/hasUserSelect import { isCommandMenuClosingState } from '@/command-menu/states/isCommandMenuClosingState'; import { isCommandMenuOpenedStateV2 } from '@/command-menu/states/isCommandMenuOpenedStateV2'; import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { CommandMenuPages } from 'twenty-shared/types'; import { IconList } from 'twenty-ui/display'; @@ -70,9 +70,9 @@ describe('useCommandMenuCloseAnimationCompleteCleanup', () => { const { commandMenuCloseAnimationCompleteCleanup } = useCommandMenuCloseAnimationCompleteCleanup(); - const viewableRecordId = useRecoilValueV2(viewableRecordIdState); + const viewableRecordId = useAtomStateValue(viewableRecordIdState); - const setViewableRecordId = useSetRecoilStateV2(viewableRecordIdState); + const setViewableRecordId = useSetAtomState(viewableRecordIdState); return { commandMenuCloseAnimationCompleteCleanup, diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenCalendarEventInCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenCalendarEventInCommandMenu.test.tsx index 867672d52d..9cd593244e 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenCalendarEventInCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenCalendarEventInCommandMenu.test.tsx @@ -5,7 +5,7 @@ import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/Com import { useOpenCalendarEventInCommandMenu } from '@/command-menu/hooks/useOpenCalendarEventInCommandMenu'; import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { CommandMenuPages } from 'twenty-shared/types'; import { IconCalendarEvent } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; @@ -46,7 +46,7 @@ const renderHooks = () => { const { openCalendarEventInCommandMenu } = useOpenCalendarEventInCommandMenu(); - const viewableRecordId = useRecoilComponentValueV2( + const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, 'mocked-uuid', ); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenEmailThreadInCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenEmailThreadInCommandMenu.test.tsx index 6a52f69a7e..690b7fe877 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenEmailThreadInCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenEmailThreadInCommandMenu.test.tsx @@ -5,7 +5,7 @@ import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/Com import { useOpenEmailThreadInCommandMenu } from '@/command-menu/hooks/useOpenEmailThreadInCommandMenu'; import { viewableRecordIdComponentState } from '@/command-menu/pages/record-page/states/viewableRecordIdComponentState'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { CommandMenuPages } from 'twenty-shared/types'; import { IconMail } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; @@ -46,7 +46,7 @@ const renderHooks = () => { const { openEmailThreadInCommandMenu } = useOpenEmailThreadInCommandMenu(); - const viewableRecordId = useRecoilComponentValueV2( + const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, 'mocked-uuid', ); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenRecordInCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenRecordInCommandMenu.test.tsx index 444dd3348b..18941f08d8 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenRecordInCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useOpenRecordInCommandMenu.test.tsx @@ -12,7 +12,7 @@ import { contextStoreCurrentViewTypeComponentState } from '@/context-store/state import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { CommandMenuPages } from 'twenty-shared/types'; import { useIcons } from 'twenty-ui/display'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; @@ -52,27 +52,27 @@ const renderHooks = () => { () => { const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); - const viewableRecordId = useRecoilComponentValueV2( + const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, 'mocked-uuid', ); - const viewableRecordNameSingular = useRecoilComponentValueV2( + const viewableRecordNameSingular = useAtomComponentStateValue( viewableRecordNameSingularComponentState, 'mocked-uuid', ); - const currentObjectMetadataItemId = useRecoilComponentValueV2( + const currentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, 'mocked-uuid', ); - const targetedRecordsRule = useRecoilComponentValueV2( + const targetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, 'mocked-uuid', ); - const numberOfSelectedRecords = useRecoilComponentValueV2( + const numberOfSelectedRecords = useAtomComponentStateValue( contextStoreNumberOfSelectedRecordsComponentState, 'mocked-uuid', ); - const currentViewType = useRecoilComponentValueV2( + const currentViewType = useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, 'mocked-uuid', ); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx index a01758f699..2710f5750b 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useSetGlobalCommandMenuContext.test.tsx @@ -14,7 +14,7 @@ import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-sto import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper'; import { getPeopleRecordConnectionMock } from '~/testing/mock-data/people'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -71,32 +71,32 @@ describe('useSetGlobalCommandMenuContext', () => { const { setGlobalCommandMenuContext } = useSetGlobalCommandMenuContext(); - const targetedRecordsRule = useRecoilComponentValueV2( + const targetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); - const numberOfSelectedRecords = useRecoilComponentValueV2( + const numberOfSelectedRecords = useAtomComponentStateValue( contextStoreNumberOfSelectedRecordsComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); - const filters = useRecoilComponentValueV2( + const filters = useAtomComponentStateValue( contextStoreFiltersComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); - const filterGroups = useRecoilComponentValueV2( + const filterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); - const currentViewType = useRecoilComponentValueV2( + const currentViewType = useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx index aa8d7b33c5..e621ce2223 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/__tests__/useWorkflowCommandMenu.test.tsx @@ -11,7 +11,7 @@ import { contextStoreCurrentViewTypeComponentState } from '@/context-store/state import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { act } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; @@ -65,35 +65,35 @@ const renderHooks = () => { openWorkflowViewStepInCommandMenu, } = useWorkflowCommandMenu(); - const _viewableRecordId = useRecoilComponentValueV2( + const _viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, 'mocked-uuid', ); - const viewableRecordNameSingular = useRecoilComponentValueV2( + const viewableRecordNameSingular = useAtomComponentStateValue( viewableRecordNameSingularComponentState, 'mocked-uuid', ); - const currentObjectMetadataItemId = useRecoilComponentValueV2( + const currentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, 'mocked-uuid', ); - const targetedRecordsRule = useRecoilComponentValueV2( + const targetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, 'mocked-uuid', ); - const numberOfSelectedRecords = useRecoilComponentValueV2( + const numberOfSelectedRecords = useAtomComponentStateValue( contextStoreNumberOfSelectedRecordsComponentState, 'mocked-uuid', ); - const currentViewType = useRecoilComponentValueV2( + const currentViewType = useAtomComponentStateValue( contextStoreCurrentViewTypeComponentState, 'mocked-uuid', ); - const workflowId = useRecoilComponentValueV2( + const workflowId = useAtomComponentStateValue( commandMenuWorkflowIdComponentState, 'mocked-uuid', ); - const workflowVersionId = useRecoilComponentValueV2( + const workflowVersionId = useAtomComponentStateValue( commandMenuWorkflowVersionIdComponentState, 'mocked-uuid', ); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx index f24beb5d10..464e244a84 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuContextChips.tsx @@ -11,8 +11,8 @@ import styled from '@emotion/styled'; import { useMemo } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledIconWrapper = styled.div` background: ${({ theme }) => theme.background.primary}; @@ -23,21 +23,21 @@ const StyledIconWrapper = styled.div` `; export const useCommandMenuContextChips = () => { - const commandMenuNavigationStack = useRecoilValueV2( + const commandMenuNavigationStack = useAtomStateValue( commandMenuNavigationStackState, ); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { navigateCommandMenuHistory } = useCommandMenuHistory(); const theme = useTheme(); - const commandMenuNavigationMorphItemsByPage = useRecoilValueV2( + const commandMenuNavigationMorphItemsByPage = useAtomStateValue( commandMenuNavigationMorphItemsByPageState, ); @@ -47,14 +47,14 @@ export const useCommandMenuContextChips = () => { morphItems.map((morphItem) => morphItem.recordId), ); - const recordIdentifiers = useFamilySelectorValueV2( + const recordIdentifiers = useAtomFamilySelectorValue( recordStoreIdentifiersFamilySelector, { recordIds: allRecordIds, allowRequestsToTwentyIcons, }, ); - const records = useFamilySelectorValueV2(recordStoreRecordsSelectorV2, { + const records = useAtomFamilySelectorValue(recordStoreRecordsSelectorV2, { recordIds: allRecordIds, }); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts index 571c40261e..06ff285c14 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts +++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuHotKeys.ts @@ -11,10 +11,10 @@ import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/s import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu'; import { useGlobalHotkeys } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeys'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { isNonEmptyString } from '@sniptt/guards'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Key } from 'ts-key-enum'; import { CommandMenuPages } from 'twenty-shared/types'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; @@ -30,15 +30,15 @@ export const useCommandMenuHotKeys = () => { const { setGlobalCommandMenuContext } = useSetGlobalCommandMenuContext(); - const commandMenuSearch = useRecoilValueV2(commandMenuSearchState); + const commandMenuSearch = useAtomStateValue(commandMenuSearchState); const { closeKeyboardShortcutMenu } = useKeyboardShortcutMenu(); - const commandMenuPage = useRecoilValueV2(commandMenuPageState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); const isAiEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_AI_ENABLED); - const contextStoreTargetedRecordsRuleComponent = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRuleComponent = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, COMMAND_MENU_COMPONENT_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuSearchRecords.tsx b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuSearchRecords.tsx index e9c55eb086..0b45edae49 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuSearchRecords.tsx +++ b/packages/twenty-front/src/modules/command-menu/hooks/useCommandMenuSearchRecords.tsx @@ -11,7 +11,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; import { getObjectPermissionsFromMapByObjectMetadataId } from '@/settings/roles/role-permissions/objects-permissions/utils/getObjectPermissionsFromMapByObjectMetadataId'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useMemo } from 'react'; import { AppPath } from 'twenty-shared/types'; import { Avatar } from 'twenty-ui/display'; @@ -19,7 +19,7 @@ import { useDebounce } from 'use-debounce'; import { useSearchQuery } from '~/generated/graphql'; export const useCommandMenuSearchRecords = () => { - const commandMenuSearch = useRecoilValueV2(commandMenuSearchState); + const commandMenuSearch = useAtomStateValue(commandMenuSearchState); const coreClient = useApolloCoreClient(); const [deferredCommandMenuSearch] = useDebounce(commandMenuSearch, 300); diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenAskAIPageInCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/hooks/useOpenAskAIPageInCommandMenu.ts index 90b564f352..85b88675fa 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenAskAIPageInCommandMenu.ts +++ b/packages/twenty-front/src/modules/command-menu/hooks/useOpenAskAIPageInCommandMenu.ts @@ -1,6 +1,6 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { isCommandMenuOpenedStateV2 } from '@/command-menu/states/isCommandMenuOpenedStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { t } from '@lingui/core/macro'; import { useCallback } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; @@ -9,7 +9,7 @@ import { v4 } from 'uuid'; export const useOpenAskAIPageInCommandMenu = () => { const { navigateCommandMenu } = useCommandMenu(); - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); const openAskAIPage = useCallback( ({ diff --git a/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu.ts index f6d8be0f1b..8b52404b46 100644 --- a/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu.ts +++ b/packages/twenty-front/src/modules/command-menu/hooks/useOpenRecordsSearchPageInCommandMenu.ts @@ -1,6 +1,6 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { isCommandMenuOpenedStateV2 } from '@/command-menu/states/isCommandMenuOpenedStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { t } from '@lingui/core/macro'; import { CommandMenuPages } from 'twenty-shared/types'; import { IconSearch } from 'twenty-ui/display'; @@ -8,7 +8,7 @@ import { v4 } from 'uuid'; export const useOpenRecordsSearchPageInCommandMenu = () => { const { navigateCommandMenu } = useCommandMenu(); - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); const openRecordsSearchPage = () => { navigateCommandMenu({ diff --git a/packages/twenty-front/src/modules/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage.tsx index fbe503c137..1b373831d8 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/calendar-event/components/CommandMenuCalendarEventPage.tsx @@ -7,12 +7,12 @@ import { useGenerateDepthRecordGqlFieldsFromObject } from '@/object-record/graph import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { PageLayoutType } from '~/generated-metadata/graphql'; export const CommandMenuCalendarEventPage = () => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const viewableRecordId = useRecoilComponentValueV2( + const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/front-component/components/CommandMenuFrontComponentPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/front-component/components/CommandMenuFrontComponentPage.tsx index ef4dabf8b6..980c47faf4 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/front-component/components/CommandMenuFrontComponentPage.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/front-component/components/CommandMenuFrontComponentPage.tsx @@ -1,7 +1,7 @@ import { Suspense, lazy } from 'react'; import { viewableFrontComponentIdComponentState } from '@/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; const FrontComponentRenderer = lazy(() => @@ -11,7 +11,7 @@ const FrontComponentRenderer = lazy(() => ); export const CommandMenuFrontComponentPage = () => { - const viewableFrontComponentId = useRecoilComponentValueV2( + const viewableFrontComponentId = useAtomComponentStateValue( viewableFrontComponentIdComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState.ts index 5f1b59b1d8..b236a5d52f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/front-component/states/viewableFrontComponentIdComponentState.ts @@ -1,7 +1,7 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const viewableFrontComponentIdComponentState = createComponentStateV2< +export const viewableFrontComponentIdComponentState = createAtomComponentState< string | null >({ key: 'command-menu/viewable-front-component-id', diff --git a/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage.tsx index 9f8be75e90..949adad8f1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/message-thread/components/CommandMenuMessageThreadPage.tsx @@ -8,7 +8,7 @@ import { EmailThreadMessage } from '@/activities/emails/components/EmailThreadMe import { CommandMenuMessageThreadIntermediaryMessages } from '@/command-menu/pages/message-thread/components/CommandMenuMessageThreadIntermediaryMessages'; import { useEmailThreadInCommandMenu } from '@/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu'; import { messageThreadComponentState } from '@/command-menu/pages/message-thread/states/messageThreadComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { t } from '@lingui/core/macro'; import { ConnectedAccountProvider } from 'twenty-shared/types'; import { assertUnreachable, isDefined } from 'twenty-shared/utils'; @@ -47,7 +47,7 @@ const ALLOWED_REPLY_PROVIDERS = [ ]; export const CommandMenuMessageThreadPage = () => { - const setMessageThread = useSetRecoilComponentStateV2( + const setMessageThread = useSetAtomComponentState( messageThreadComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu.ts b/packages/twenty-front/src/modules/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu.ts index 95ef8e4d0a..cea10a3acf 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/message-thread/hooks/useEmailThreadInCommandMenu.ts @@ -13,13 +13,13 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { MessageParticipantRole } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; // to improve - https://github.com/twentyhq/twenty/issues/12190 export const useEmailThreadInCommandMenu = () => { - const viewableRecordId = useRecoilComponentValueV2( + const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, ); const { upsertRecordsInStore } = useUpsertRecordsInStore(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/message-thread/states/messageThreadComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/message-thread/states/messageThreadComponentState.ts index 357b9a224a..f8e4ff44ef 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/message-thread/states/messageThreadComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/message-thread/states/messageThreadComponentState.ts @@ -1,9 +1,9 @@ import { type MessageThread } from '@/activities/emails/types/MessageThread'; import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const messageThreadComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'messageThreadComponentState', defaultValue: null, componentInstanceContext: CommandMenuPageComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage.tsx index 56adb0168e..b892825655 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNavigationMenuItemEditPage.tsx @@ -16,7 +16,7 @@ import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledCommandMenuPlaceholder = styled.p` color: ${({ theme }) => theme.font.color.tertiary}; @@ -30,7 +30,7 @@ const StyledCommandMenuPageContainer = styled.div` export const CommandMenuNavigationMenuItemEditPage = () => { const { t } = useLingui(); - const selectedNavigationMenuItemInEditMode = useRecoilValueV2( + const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeStateV2, ); const { selectedItemLabel } = useSelectedNavigationMenuItemEditItemLabel(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow.tsx index c7d06e79fe..d84178a450 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemObjectFlow.tsx @@ -9,8 +9,8 @@ import { useAddObjectToNavigationMenuDraft } from '@/navigation-menu-item/hooks/ import { useDraftNavigationMenuItems } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItems'; import { useNavigationMenuObjectMetadataFromDraft } from '@/navigation-menu-item/hooks/useNavigationMenuObjectMetadataFromDraft'; import { addMenuItemInsertionContextStateV2 } from '@/navigation-menu-item/states/addMenuItemInsertionContextStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; @@ -34,10 +34,10 @@ export const CommandMenuNewSidebarItemObjectFlow = ({ const { addObjectToDraft } = useAddObjectToNavigationMenuDraft(); const { activeNonSystemObjectMetadataItems } = useFilteredObjectMetadataItems(); - const addMenuItemInsertionContext = useRecoilValueV2( + const addMenuItemInsertionContext = useAtomStateValue( addMenuItemInsertionContextStateV2, ); - const setAddMenuItemInsertionContext = useSetRecoilStateV2( + const setAddMenuItemInsertionContext = useSetAtomState( addMenuItemInsertionContextStateV2, ); const { views, objectMetadataIdsWithIndexView } = diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordItem.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordItem.tsx index a02e841fe8..fa9d802967 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordItem.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemRecordItem.tsx @@ -6,8 +6,8 @@ import { NavigationMenuItemType } from '@/navigation-menu-item/constants/Navigat import { useDraftNavigationMenuItems } from '@/navigation-menu-item/hooks/useDraftNavigationMenuItems'; import { useAddRecordToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddRecordToNavigationMenuDraft'; import { addMenuItemInsertionContextStateV2 } from '@/navigation-menu-item/states/addMenuItemInsertionContextStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import type { AddToNavigationDragPayload } from '@/navigation-menu-item/types/add-to-navigation-drag-payload'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; @@ -32,10 +32,10 @@ export const CommandMenuNewSidebarItemRecordItem = ({ const { closeCommandMenu } = useCommandMenu(); const { addRecordToDraft } = useAddRecordToNavigationMenuDraft(); const { currentDraft } = useDraftNavigationMenuItems(); - const addMenuItemInsertionContext = useRecoilValueV2( + const addMenuItemInsertionContext = useAtomStateValue( addMenuItemInsertionContextStateV2, ); - const setAddMenuItemInsertionContext = useSetRecoilStateV2( + const setAddMenuItemInsertionContext = useSetAtomState( addMenuItemInsertionContextStateV2, ); const { objectMetadataItems } = useObjectMetadataItems(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView.tsx index 0551fdb9b7..f5bb8ffab4 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuNewSidebarItemViewPickerSubView.tsx @@ -15,8 +15,8 @@ import { NavigationMenuItemType } from '@/navigation-menu-item/constants/Navigat import { useAddViewToNavigationMenuDraft } from '@/navigation-menu-item/hooks/useAddViewToNavigationMenuDraft'; import { useNavigationMenuObjectMetadataFromDraft } from '@/navigation-menu-item/hooks/useNavigationMenuObjectMetadataFromDraft'; import { addMenuItemInsertionContextStateV2 } from '@/navigation-menu-item/states/addMenuItemInsertionContextStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { type View } from '@/views/types/View'; @@ -37,10 +37,10 @@ export const CommandMenuNewSidebarItemViewPickerSubView = ({ const { closeCommandMenu } = useCommandMenu(); const { addViewToDraft } = useAddViewToNavigationMenuDraft(); const { currentDraft } = useDraftNavigationMenuItems(); - const addMenuItemInsertionContext = useRecoilValueV2( + const addMenuItemInsertionContext = useAtomStateValue( addMenuItemInsertionContextStateV2, ); - const setAddMenuItemInsertionContext = useSetRecoilStateV2( + const setAddMenuItemInsertionContext = useSetAtomState( addMenuItemInsertionContextStateV2, ); const { objectMetadataItems } = useObjectMetadataItems(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuObjectMenuItem.tsx b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuObjectMenuItem.tsx index 9185a417cb..7a896ee039 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuObjectMenuItem.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/components/CommandMenuObjectMenuItem.tsx @@ -9,7 +9,7 @@ import { NavigationMenuItemType } from '@/navigation-menu-item/constants/Navigat import { getNavigationMenuItemIconColors } from '@/navigation-menu-item/utils/getNavigationMenuItemIconColors'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; type CommandMenuObjectMenuItemProps = { @@ -31,7 +31,7 @@ export const CommandMenuObjectMenuItem = ({ const theme = useTheme(); const { getIcon } = useIcons(); const iconColors = getNavigationMenuItemIconColors(theme); - const defaultViewId = useFamilySelectorValueV2( + const defaultViewId = useAtomFamilySelectorValue( coreIndexViewIdFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts index 6cda906c50..340aef993c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddFolderToNavigationMenu.ts @@ -8,25 +8,25 @@ import { useOpenNavigationMenuItemInCommandMenu } from '@/navigation-menu-item/h import { addMenuItemInsertionContextStateV2 } from '@/navigation-menu-item/states/addMenuItemInsertionContextStateV2'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useAddFolderToNavigationMenu = () => { const { t } = useLingui(); const { addFolderToDraft } = useAddFolderToNavigationMenuDraft(); const { workspaceNavigationMenuItems } = useNavigationMenuItemsDraftState(); - const navigationMenuItemsDraft = useRecoilValueV2( + const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftStateV2, ); - const setSelectedNavigationMenuItemInEditMode = useSetRecoilStateV2( + const setSelectedNavigationMenuItemInEditMode = useSetAtomState( selectedNavigationMenuItemInEditModeStateV2, ); const { openNavigationMenuItemInCommandMenu } = useOpenNavigationMenuItemInCommandMenu(); - const addMenuItemInsertionContext = useRecoilValueV2( + const addMenuItemInsertionContext = useAtomStateValue( addMenuItemInsertionContextStateV2, ); - const setAddMenuItemInsertionContext = useSetRecoilStateV2( + const setAddMenuItemInsertionContext = useSetAtomState( addMenuItemInsertionContextStateV2, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts index 6680fdd40d..c4678e49a3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useAddLinkToNavigationMenu.ts @@ -8,25 +8,25 @@ import { useOpenNavigationMenuItemInCommandMenu } from '@/navigation-menu-item/h import { addMenuItemInsertionContextStateV2 } from '@/navigation-menu-item/states/addMenuItemInsertionContextStateV2'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useAddLinkToNavigationMenu = () => { const { t } = useLingui(); const { addLinkToDraft } = useAddLinkToNavigationMenuDraft(); const { workspaceNavigationMenuItems } = useNavigationMenuItemsDraftState(); - const navigationMenuItemsDraft = useRecoilValueV2( + const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftStateV2, ); - const setSelectedNavigationMenuItemInEditMode = useSetRecoilStateV2( + const setSelectedNavigationMenuItemInEditMode = useSetAtomState( selectedNavigationMenuItemInEditModeStateV2, ); const { openNavigationMenuItemInCommandMenu } = useOpenNavigationMenuItemInCommandMenu(); - const addMenuItemInsertionContext = useRecoilValueV2( + const addMenuItemInsertionContext = useAtomStateValue( addMenuItemInsertionContextStateV2, ); - const setAddMenuItemInsertionContext = useSetRecoilStateV2( + const setAddMenuItemInsertionContext = useSetAtomState( addMenuItemInsertionContextStateV2, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts index 6692fa3a8d..6a4578f4f4 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useFolderPickerSelectionData.ts @@ -6,7 +6,7 @@ import { useDraftNavigationMenuItemsWorkspaceFolders } from '@/navigation-menu-i import { useSelectedNavigationMenuItemEditItem } from '@/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem'; import { useNavigationMenuItemMoveRemove } from '@/navigation-menu-item/hooks/useNavigationMenuItemMoveRemove'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { NavigationMenuItemType } from '@/navigation-menu-item/constants/NavigationMenuItemType'; type FolderOption = { @@ -47,7 +47,7 @@ export const useFolderPickerSelectionData = ({ }: UseFolderPickerSelectionDataParams) => { const { closeCommandMenu } = useCommandMenu(); const { moveToFolder } = useNavigationMenuItemMoveRemove(); - const selectedNavigationMenuItemInEditMode = useRecoilValueV2( + const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeStateV2, ); const { selectedItem } = useSelectedNavigationMenuItemEditItem(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts index d5a8405988..d05aecde11 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/navigation-menu-item/hooks/useNavigationMenuItemEditOrganizeActions.ts @@ -11,8 +11,8 @@ import { useWorkspaceSectionItems } from '@/navigation-menu-item/hooks/useWorksp import { addMenuItemInsertionContextStateV2 } from '@/navigation-menu-item/states/addMenuItemInsertionContextStateV2'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; import { type AddMenuItemInsertionContext } from '@/navigation-menu-item/types/AddMenuItemInsertionContext'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { CommandMenuPages } from 'twenty-shared/types'; const getAddMenuItemInsertionContext = ( @@ -49,13 +49,13 @@ export const useNavigationMenuItemEditOrganizeActions = const { t } = useLingui(); const { closeCommandMenu } = useCommandMenu(); const { navigateCommandMenu } = useNavigateCommandMenu(); - const selectedNavigationMenuItemInEditMode = useRecoilValueV2( + const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeStateV2, ); - const setSelectedNavigationMenuItemInEditMode = useSetRecoilStateV2( + const setSelectedNavigationMenuItemInEditMode = useSetAtomState( selectedNavigationMenuItemInEditModeStateV2, ); - const setAddMenuItemInsertionContext = useSetRecoilStateV2( + const setAddMenuItemInsertionContext = useSetAtomState( addMenuItemInsertionContextStateV2, ); const { workspaceNavigationMenuItems } = useNavigationMenuItemsDraftState(); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettings.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettings.tsx index 493225bcf0..8bb670ba1d 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettings.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettings.tsx @@ -14,7 +14,7 @@ import { currentRecordFilterGroupsComponentState } from '@/object-record/record- import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { InputLabel } from '@/ui/input/components/InputLabel'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -49,12 +49,12 @@ export const ChartFiltersSettings = ({ const { updateCurrentWidgetConfig } = useUpdateCurrentWidgetConfig(pageLayoutId); - const currentRecordFilters = useRecoilComponentStateCallbackStateV2( + const currentRecordFilters = useAtomComponentStateCallbackState( currentRecordFiltersComponentState, instanceId, ); - const currentRecordFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentRecordFilterGroups = useAtomComponentStateCallbackState( currentRecordFilterGroupsComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettingsInitializeStateEffect.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettingsInitializeStateEffect.tsx index daf313f493..52cfe763bb 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettingsInitializeStateEffect.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartFiltersSettingsInitializeStateEffect.tsx @@ -3,8 +3,8 @@ import { type ChartFilters } from '@/command-menu/pages/page-layout/types/ChartF import { useSetAdvancedFilterDropdownStates } from '@/object-record/advanced-filter/hooks/useSetAdvancedFilterDropdownAllRowsStates'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -16,13 +16,13 @@ export const ChartFiltersSettingsInitializeStateEffect = ({ initialChartFilters, }: ChartFiltersSettingsInitializeStateEffectProps) => { const [hasInitializedChartFilters, setHasInitializedChartFilters] = - useRecoilComponentStateV2(hasInitializedChartFiltersComponentState); + useAtomComponentState(hasInitializedChartFiltersComponentState); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, ); - const setCurrentRecordFilterGroups = useSetRecoilComponentStateV2( + const setCurrentRecordFilterGroups = useSetAtomComponentState( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartSettings.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartSettings.tsx index f463571987..c6f9586a0d 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartSettings.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartSettings.tsx @@ -14,7 +14,7 @@ import { CHART_CONFIGURATION_SETTING_IDS } from '@/command-menu/pages/page-layou import { shouldHideChartSetting } from '@/command-menu/pages/page-layout/utils/shouldHideChartSetting'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { hasWidgetTooManyGroupsComponentState } from '@/page-layout/widgets/graph/states/hasWidgetTooManyGroupsComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { isFieldMetadataDateKind } from 'twenty-shared/utils'; @@ -58,7 +58,7 @@ export const ChartSettings = ({ widget }: { widget: PageLayoutWidget }) => { CHART_CONFIGURATION_SETTING_IDS.GROUP_BY, ); const [hasWidgetTooManyGroups, setHasWidgetTooManyGroups] = - useRecoilComponentStateV2(hasWidgetTooManyGroupsComponentState); + useAtomComponentState(hasWidgetTooManyGroupsComponentState); const handleGraphTypeChange = (graphType: GraphType) => { const configToUpdate = getConfigToUpdateAfterGraphTypeChange(graphType); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings.tsx index 6cf4703a06..cac2c26059 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutChartSettings.tsx @@ -5,7 +5,7 @@ import { isChartWidget } from '@/command-menu/pages/page-layout/utils/isChartWid import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -18,12 +18,12 @@ const StyledContainer = styled.div` export const CommandMenuPageLayoutChartSettings = () => { const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); - const draftPageLayout = useRecoilComponentValueV2( + const draftPageLayout = useAtomComponentStateValue( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutEditingWidgetId = useRecoilComponentValueV2( + const pageLayoutEditingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter.tsx index b8125f70e0..6465507cec 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutGraphFilter.tsx @@ -4,19 +4,19 @@ import { isChartWidget } from '@/command-menu/pages/page-layout/utils/isChartWid import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; export const CommandMenuPageLayoutGraphFilter = () => { const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); - const draftPageLayout = useRecoilComponentValueV2( + const draftPageLayout = useAtomComponentStateValue( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutEditingWidgetId = useRecoilComponentValueV2( + const pageLayoutEditingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); @@ -25,7 +25,7 @@ export const CommandMenuPageLayoutGraphFilter = () => { .flatMap((tab) => tab.widgets) .find((widget) => widget.id === pageLayoutEditingWidgetId); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); if ( !isDefined(widgetInEditMode) || diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings.tsx index 4a6f0d730f..cd05609a07 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutTabSettings.tsx @@ -11,8 +11,8 @@ import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDr import { pageLayoutTabSettingsOpenTabIdComponentState } from '@/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState'; import { sortTabsByPosition } from '@/page-layout/utils/sortTabsByPosition'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; import { @@ -26,12 +26,12 @@ export const CommandMenuPageLayoutTabSettings = () => { const { closeCommandMenu } = useCommandMenu(); const { pageLayoutId } = usePageLayoutIdFromContextStoreTargetedRecord(); - const draft = useRecoilComponentValueV2( + const draft = useAtomComponentStateValue( pageLayoutDraftComponentState, pageLayoutId, ); - const [openTabId, setOpenTabId] = useRecoilComponentStateV2( + const [openTabId, setOpenTabId] = useAtomComponentState( pageLayoutTabSettingsOpenTabIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect.tsx index 7b84b11a1e..ad241d3512 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/CommandMenuPageLayoutWidgetTypeSelect.tsx @@ -16,8 +16,8 @@ import { useRemovePageLayoutWidgetAndPreservePosition } from '@/page-layout/hook import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useQuery } from '@apollo/client'; import { t } from '@lingui/core/macro'; @@ -79,12 +79,12 @@ export const CommandMenuPageLayoutWidgetTypeSelect = () => { ); const [pageLayoutEditingWidgetId, setPageLayoutEditingWidgetId] = - useRecoilComponentStateV2( + useAtomComponentState( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); - const draftPageLayout = useRecoilComponentValueV2( + const draftPageLayout = useAtomComponentStateValue( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/WidgetSettingsFooter.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/WidgetSettingsFooter.tsx index 6f6f52f935..da6903aef1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/WidgetSettingsFooter.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/WidgetSettingsFooter.tsx @@ -6,7 +6,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useLingui } from '@lingui/react/macro'; import { useId } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -23,7 +23,7 @@ export const WidgetSettingsFooter = ({ const { closeDropdown } = useCloseDropdown(); const { duplicateWidget } = useDuplicatePageLayoutWidget(pageLayoutId); const { deletePageLayoutWidget } = useDeletePageLayoutWidget(pageLayoutId); - const editingWidgetId = useRecoilComponentValueV2( + const editingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); @@ -42,7 +42,7 @@ export const WidgetSettingsFooter = ({ closeDropdown(dropdownId); }; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx index 05da08419b..ad1282b72c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAggregateOperationSelectableListItem.tsx @@ -11,7 +11,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; import { MenuItemSelect } from 'twenty-ui/navigation'; @@ -40,7 +40,7 @@ export const ChartAggregateOperationSelectableListItem = ({ DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx index db7659ccb6..aaceda0c5a 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartAxisNameSelectionDropdownContent.tsx @@ -10,7 +10,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { MenuItemSelect } from 'twenty-ui/navigation'; import { AxisNameDisplay } from '~/generated-metadata/graphql'; @@ -34,7 +34,7 @@ export const ChartAxisNameSelectionDropdownContent = () => { DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx index 6a5412b9cd..83b33c2320 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartColorSelectionDropdownContent.tsx @@ -13,7 +13,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useState } from 'react'; import { capitalize, isDefined } from 'twenty-shared/utils'; @@ -35,7 +35,7 @@ export const ChartColorSelectionDropdownContent = () => { DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx index 233f28fa2b..63f890e14c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDataSourceDropdownContent.tsx @@ -15,7 +15,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { Trans } from '@lingui/react/macro'; import { useState } from 'react'; @@ -44,7 +44,7 @@ export const ChartDataSourceDropdownContent = () => { DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx index facc74a409..bb2dfb0e2c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartDateGranularitySelectionDropdownContent.tsx @@ -12,7 +12,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ObjectRecordGroupByDateGranularity } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { MenuItemSelect } from 'twenty-ui/navigation'; @@ -109,7 +109,7 @@ export const ChartDateGranularitySelectionDropdownContent = ({ DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx index a61a26684a..78512519c4 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartFieldSelectionForAggregateOperationDropdownContent.tsx @@ -13,7 +13,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useState } from 'react'; import { useIcons } from 'twenty-ui/display'; @@ -60,7 +60,7 @@ export const ChartFieldSelectionForAggregateOperationDropdownContent = () => { DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx index f984ba3bb6..73c54f75b0 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionCompositeFieldView.tsx @@ -11,7 +11,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { IconChevronLeft, useIcons } from 'twenty-ui/display'; import { MenuItemSelect } from 'twenty-ui/navigation'; @@ -34,7 +34,7 @@ export const ChartGroupByFieldSelectionCompositeFieldView = ({ DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx index 8210443690..5ad61adbb8 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionDropdownContentBase.tsx @@ -19,7 +19,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useMemo, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -72,7 +72,7 @@ export const ChartGroupByFieldSelectionDropdownContentBase = < DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx index 5328f0396d..f487ecddff 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartGroupByFieldSelectionRelationFieldView.tsx @@ -14,7 +14,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useMemo, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -46,7 +46,7 @@ export const ChartGroupByFieldSelectionRelationFieldView = ({ DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx index a1c1964b5d..b980fbef24 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioAggregateOperationSelectableListItem.tsx @@ -6,7 +6,7 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/ import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; import { MenuItemSelect } from 'twenty-ui/navigation'; @@ -24,7 +24,7 @@ export const ChartRatioAggregateOperationSelectableListItem = ({ DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx index 64eaef1d63..6bc9b18e7f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionBooleanSelectableListItem.tsx @@ -7,7 +7,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { IconCheck, IconX } from 'twenty-ui/display'; import { MenuItemSelect } from 'twenty-ui/navigation'; import { AggregateOperations } from '~/generated-metadata/graphql'; @@ -31,7 +31,7 @@ export const ChartRatioOptionBooleanSelectableListItem = ({ DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx index 6512f1eaba..ec2df8c85e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartRatioOptionSelectSelectableListItem.tsx @@ -7,7 +7,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { MenuItemSelectTag } from 'twenty-ui/navigation'; import { type ThemeColor } from 'twenty-ui/theme'; import { AggregateOperations } from '~/generated-metadata/graphql'; @@ -33,7 +33,7 @@ export const ChartRatioOptionSelectSelectableListItem = ({ DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx index 0d865dba61..0665d50f93 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortByGroupByFieldDropdownContent.tsx @@ -18,7 +18,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; import { MenuItemSelect } from 'twenty-ui/navigation'; import { @@ -53,7 +53,7 @@ export const ChartSortByGroupByFieldDropdownContent = () => { DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx index 331f8b8299..4e87fe2491 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/components/dropdown-content/ChartSortBySelectionDropdownContent.tsx @@ -18,7 +18,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type CompositeFieldSubFieldName } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { MenuItemSelect } from 'twenty-ui/navigation'; @@ -41,7 +41,7 @@ export const ChartSortBySelectionDropdownContent = () => { DropdownComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useChartSettingsValues.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useChartSettingsValues.ts index 757b702e85..6847144531 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useChartSettingsValues.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useChartSettingsValues.ts @@ -10,7 +10,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { getAggregateOperationLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationLabel'; import { convertAggregateOperationToExtendedAggregateOperation } from '@/object-record/utils/convertAggregateOperationToExtendedAggregateOperation'; import { plural, t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type CompositeFieldSubFieldName } from 'twenty-shared/types'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { type GraphOrderBy } from '~/generated-metadata/graphql'; @@ -22,7 +22,7 @@ export const useChartSettingsValues = ({ objectMetadataId: string; configuration?: ChartConfiguration; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => objectMetadataItem.id === objectMetadataId, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts index 48719aec90..32ee3a713e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphGroupBySortOptionLabels.ts @@ -2,7 +2,7 @@ import { getFieldLabelWithSubField } from '@/command-menu/pages/page-layout/util import { getSortLabelSuffixForFieldType } from '@/command-menu/pages/page-layout/utils/getSortLabelSuffixForFieldType'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type CompositeFieldSubFieldName } from 'twenty-shared/types'; import { assertUnreachable } from 'twenty-shared/utils'; import { GraphOrderBy } from '~/generated-metadata/graphql'; @@ -12,7 +12,7 @@ export const useGraphGroupBySortOptionLabels = ({ }: { objectMetadataId: string; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => objectMetadataItem.id === objectMetadataId, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels.ts index d716295f7e..53a3d8e0f9 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useGraphXSortOptionLabels.ts @@ -4,7 +4,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { getAggregateOperationLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationLabel'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type CompositeFieldSubFieldName } from 'twenty-shared/types'; import { assertUnreachable, isDefined } from 'twenty-shared/utils'; import { GraphOrderBy } from '~/generated-metadata/graphql'; @@ -14,7 +14,7 @@ export const useGraphXSortOptionLabels = ({ }: { objectMetadataId: string; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => objectMetadataItem.id === objectMetadataId, diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts index 557a933d7a..1c75867a35 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutFromContextStoreTargetedRecord.ts @@ -1,10 +1,10 @@ import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const usePageLayoutIdFromContextStoreTargetedRecord = () => { - const targetedRecordsRule = useRecoilComponentValueV2( + const targetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, ); @@ -19,7 +19,7 @@ export const usePageLayoutIdFromContextStoreTargetedRecord = () => { const recordId: string = targetedRecordsRule.selectedRecordIds[0]; - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const record = useAtomFamilyStateValue(recordStoreFamilyState, recordId); return { pageLayoutId: record?.pageLayoutId }; }; diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts index 1624ad0103..99da7e7d93 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord.ts @@ -2,16 +2,16 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; import { useRecordPageLayoutIdFromRecordStoreOrThrow } from '@/page-layout/hooks/useRecordPageLayoutIdFromRecordStoreOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const usePageLayoutIdForRecordPageLayoutFromContextStoreTargetedRecord = () => { - const targetedRecordsRule = useRecoilComponentValueV2( + const targetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, ); - const objectMetadataId = useRecoilComponentValueV2( + const objectMetadataId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts index 133d52d7c1..fbfcdc00e0 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateCurrentWidgetConfig.ts @@ -1,18 +1,18 @@ import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import type { PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useStore } from 'jotai'; import { useCallback } from 'react'; export const useUpdateCurrentWidgetConfig = (pageLayoutIdFromProps: string) => { - const pageLayoutDraft = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraft = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutIdFromProps, ); - const currentlyEditingWidgetId = useRecoilComponentValueV2( + const currentlyEditingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, pageLayoutIdFromProps, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts index 4ab1c91f6a..fdbdbc0a94 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useUpdateGraphTypeConfig.ts @@ -15,7 +15,7 @@ import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId'; import { updateWidgetMinimumSizeForGraphType } from '@/page-layout/utils/updateWidgetMinimumSizeForGraphType'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -32,17 +32,17 @@ export const useGetConfigToUpdateAfterGraphTypeChange = ({ const tabListInstanceId = getTabListInstanceIdFromPageLayoutId(pageLayoutId); - const currentlyEditingWidgetIdState = useRecoilComponentStateCallbackStateV2( + const currentlyEditingWidgetIdState = useAtomComponentStateCallbackState( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useWidgetInEditMode.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useWidgetInEditMode.ts index 19640398d9..a0b837e470 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useWidgetInEditMode.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/hooks/useWidgetInEditMode.ts @@ -1,14 +1,14 @@ import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useWidgetInEditMode = (pageLayoutId: string) => { - const draftPageLayout = useRecoilComponentValueV2( + const draftPageLayout = useAtomComponentStateValue( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutEditingWidgetId = useRecoilComponentValueV2( + const pageLayoutEditingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts index 85705dc8e4..d2823f7b19 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/page-layout/states/hasInitializedChartFiltersComponentState.ts @@ -1,8 +1,8 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const hasInitializedChartFiltersComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'hasInitializedCurrentRecordFiltersComponentFamilyState', defaultValue: false, componentInstanceContext: RecordFiltersComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuRecordPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuRecordPage.tsx index 05ea50758c..4bf584b24e 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuRecordPage.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/record-page/components/CommandMenuRecordPage.tsx @@ -10,9 +10,9 @@ import { PageLayoutRecordPageRenderer } from '@/object-record/record-show/compon import { useRecordShowPage } from '@/object-record/record-show/hooks/useRecordShowPage'; import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; const StyledRightDrawerRecord = styled.div<{ hasDeletedRecordBanner: boolean; @@ -26,11 +26,11 @@ const StyledRightDrawerRecord = styled.div<{ `; export const CommandMenuRecordPage = () => { - const viewableRecordNameSingular = useRecoilComponentValueV2( + const viewableRecordNameSingular = useAtomComponentStateValue( viewableRecordNameSingularComponentState, ); - const viewableRecordId = useRecoilComponentValueV2( + const viewableRecordId = useAtomComponentStateValue( viewableRecordIdComponentState, ); @@ -47,9 +47,12 @@ export const CommandMenuRecordPage = () => { viewableRecordId, ); - const recordDeletedAt = useFamilySelectorValueV2( + const recordDeletedAt = useAtomFamilySelectorValue( recordStoreFamilySelectorV2, - { recordId: objectRecordId, fieldName: 'deletedAt' }, + { + recordId: objectRecordId, + fieldName: 'deletedAt', + }, ); const commandMenuPageInstanceId = useComponentInstanceStateContext( diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordIdComponentState.ts index 2e1fafb98b..65bd6aa539 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordIdComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordIdComponentState.ts @@ -1,7 +1,7 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const viewableRecordIdComponentState = createComponentStateV2< +export const viewableRecordIdComponentState = createAtomComponentState< string | null >({ key: 'command-menu/viewable-record-id', diff --git a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState.ts index 151091594d..142dfd69f8 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/record-page/states/viewableRecordNameSingularComponentState.ts @@ -1,10 +1,9 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const viewableRecordNameSingularComponentState = createComponentStateV2< - string | null ->({ - key: 'command-menu/viewable-record-name-singular', - defaultValue: null, - componentInstanceContext: CommandMenuPageComponentInstanceContext, -}); +export const viewableRecordNameSingularComponentState = + createAtomComponentState({ + key: 'command-menu/viewable-record-name-singular', + defaultValue: null, + componentInstanceContext: CommandMenuPageComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx b/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx index 78b584082a..94bf17db51 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/components/CommandMenuEditRichTextPage.tsx @@ -5,7 +5,7 @@ import styled from '@emotion/styled'; import { lazy, Suspense } from 'react'; import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; import { viewableRichTextComponentStateV2 } from '@/command-menu/pages/rich-text-page/states/viewableRichTextComponentStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const ActivityRichTextEditor = lazy(() => import('@/activities/components/ActivityRichTextEditor').then((module) => ({ @@ -35,7 +35,7 @@ const LoadingSkeleton = () => { }; export const CommandMenuEditRichTextPage = () => { - const { activityId, activityObjectNameSingular } = useRecoilValueV2( + const { activityId, activityObjectNameSingular } = useAtomStateValue( viewableRichTextComponentStateV2, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/states/viewableRichTextComponentStateV2.ts b/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/states/viewableRichTextComponentStateV2.ts index 34334d0cea..366461c2ad 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/states/viewableRichTextComponentStateV2.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/rich-text-page/states/viewableRichTextComponentStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const viewableRichTextComponentStateV2 = createStateV2<{ +export const viewableRichTextComponentStateV2 = createAtomState<{ activityId: string; activityObjectNameSingular: string; }>({ diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction.tsx index 94a78ca891..9a2e9d6bf4 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction.tsx @@ -11,7 +11,7 @@ import { RECORD_ACTIONS } from '@/workflow/workflow-steps/workflow-actions/const import { getActionIconColorOrThrow } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIconColorOrThrow'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useTheme } from '@emotion/react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { IconFunction } from 'twenty-ui/display'; import { MenuItem } from 'twenty-ui/navigation'; @@ -35,7 +35,7 @@ export const CommandMenuWorkflowSelectAction = ({ const { t } = useLingui(); - const logicFunctions = useRecoilValueV2(logicFunctionsState); + const logicFunctions = useAtomStateValue(logicFunctionsState); const toolFunctions = logicFunctions.filter((fn) => fn.isTool === true); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow.ts index 2db0dc02b3..19ac2d58b3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow.ts @@ -1,9 +1,9 @@ import { commandMenuWorkflowIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useCommandMenuWorkflowIdOrThrow = () => { - const workflowId = useRecoilComponentValueV2( + const workflowId = useAtomComponentStateValue( commandMenuWorkflowIdComponentState, ); if (!isDefined(workflowId)) { diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState.ts index 4cc0b79bf6..5682baa76c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowIdComponentState.ts @@ -1,7 +1,7 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const commandMenuWorkflowIdComponentState = createComponentStateV2< +export const commandMenuWorkflowIdComponentState = createAtomComponentState< string | undefined >({ key: 'command-menu/workflow-id', diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState.ts index 5355920fc1..426396300f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState.ts @@ -1,7 +1,7 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const commandMenuWorkflowRunIdComponentState = createComponentStateV2< +export const commandMenuWorkflowRunIdComponentState = createAtomComponentState< string | undefined >({ key: 'command-menu/workflow-run-id', diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState.ts index 356813c82c..d3f3b3092f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowStepIdComponentState.ts @@ -1,7 +1,7 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const commandMenuWorkflowStepIdComponentState = createComponentStateV2< +export const commandMenuWorkflowStepIdComponentState = createAtomComponentState< string | undefined >({ key: 'command-menu/workflow-step-id', diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState.ts index 398e8bb585..44914182b3 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState.ts @@ -1,8 +1,8 @@ import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const commandMenuWorkflowVersionIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'command-menu/workflow-version-id', defaultValue: undefined, componentInstanceContext: CommandMenuPageComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent.tsx index 7cd2e543ce..6100622daa 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/create/components/CommandMenuWorkflowCreateStepContent.tsx @@ -4,8 +4,8 @@ import { type WorkflowActionSelection, } from '@/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { @@ -18,13 +18,13 @@ import { useUpdateStep } from '@/workflow/workflow-steps/hooks/useUpdateStep'; import { workflowInsertStepIdsComponentState } from '@/workflow/workflow-steps/states/workflowInsertStepIdsComponentState'; import { prepareIfElseStepWithNewBranch } from '@/workflow/workflow-steps/workflow-actions/if-else-action/utils/prepareIfElseStepWithNewBranch'; import { getActionIcon } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIcon'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; export const CommandMenuWorkflowCreateStepContent = () => { const { getIcon } = useIcons(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); @@ -36,12 +36,12 @@ export const CommandMenuWorkflowCreateStepContent = () => { const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); const { closeRightClickMenu } = useCloseRightClickMenu(); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); const [workflowInsertStepIds, setWorkflowInsertStepIds] = - useRecoilComponentStateV2(workflowInsertStepIdsComponentState); + useAtomComponentState(workflowInsertStepIdsComponentState); const handleIfElseParentStep = async ({ parentStep, diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent.tsx index eb8fc8c59b..6ff3dd13e7 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepContent.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; import { WorkflowStepDetail } from '@/workflow/workflow-steps/components/WorkflowStepDetail'; @@ -15,7 +15,7 @@ const StyledContainer = styled.div` export const CommandMenuWorkflowEditStepContent = () => { const flow = useFlowOrThrow(); - const workflowSelectedNode = useRecoilComponentValueV2( + const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent.tsx index 7c3b89c62c..c780cd83d1 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/edit/components/CommandMenuWorkflowEditStepTypeContent.tsx @@ -4,7 +4,7 @@ import { type WorkflowActionSelection, } from '@/command-menu/pages/workflow/action/components/CommandMenuWorkflowSelectAction'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { @@ -15,16 +15,16 @@ import { useCloseRightClickMenu } from '@/workflow/workflow-diagram/hooks/useClo import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; import { useUpdateStep } from '@/workflow/workflow-steps/hooks/useUpdateStep'; import { getActionIcon } from '@/workflow/workflow-steps/workflow-actions/utils/getActionIcon'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; export const CommandMenuWorkflowEditStepTypeContent = () => { const { getIcon } = useIcons(); - const workflowSelectedNode = useRecoilComponentValueV2( + const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, ); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); const flow = useFlowOrThrow(); @@ -33,7 +33,7 @@ export const CommandMenuWorkflowEditStepTypeContent = () => { const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); const { closeRightClickMenu } = useCloseRightClickMenu(); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent.tsx index 181384fe2d..c43318a5b2 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/components/CommandMenuWorkflowRunViewStepContent.tsx @@ -7,7 +7,7 @@ import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps'; import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow'; @@ -43,7 +43,7 @@ type TabId = WorkflowRunTabIdType; export const CommandMenuWorkflowRunViewStepContent = () => { const flow = useFlowOrThrow(); - const workflowSelectedNode = useRecoilComponentValueV2( + const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, ); const workflowRunId = useWorkflowRunIdOrThrow(); @@ -59,7 +59,7 @@ export const CommandMenuWorkflowRunViewStepContent = () => { ); } - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, commandMenuPageComponentInstance.instanceId, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow.ts index ec64640c89..43ce756f17 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/hooks/useCommandMenuWorkflowRunIdOrThrow.ts @@ -1,9 +1,9 @@ import { commandMenuWorkflowRunIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowRunIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useCommandMenuWorkflowRunIdOrThrow = () => { - const workflowRunId = useRecoilComponentValueV2( + const workflowRunId = useAtomComponentStateValue( commandMenuWorkflowRunIdComponentState, ); if (!isDefined(workflowRunId)) { diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts index 0f7211715e..4b81ea626c 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState.ts @@ -1,8 +1,8 @@ import { CommandMenuWorkflowRunStepContentComponentInstanceContext } from '@/command-menu/pages/workflow/step/view-run/states/contexts/CommandMenuWorkflowRunStepContentComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const workflowRunIteratorSubStepIterationIndexComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowRunIteratorSubStepIterationIndexComponentState', defaultValue: 0, componentInstanceContext: diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent.tsx index 987e678692..1e19454c82 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/components/CommandMenuWorkflowViewStepContent.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; import { WorkflowStepDetail } from '@/workflow/workflow-steps/components/WorkflowStepDetail'; @@ -13,7 +13,7 @@ const StyledContainer = styled.div` export const CommandMenuWorkflowViewStepContent = () => { const flow = useFlowOrThrow(); - const workflowSelectedNode = useRecoilComponentValueV2( + const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, ); diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow.ts b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow.ts index aef20b6c59..561c637c13 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow.ts +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/step/view/hooks/useCommandMenuWorkflowVersionIdOrThrow.ts @@ -1,9 +1,9 @@ import { commandMenuWorkflowVersionIdComponentState } from '@/command-menu/pages/workflow/states/commandMenuWorkflowVersionIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useCommandMenuWorkflowVersionIdOrThrow = () => { - const workflowVersionId = useRecoilComponentValueV2( + const workflowVersionId = useAtomComponentStateValue( commandMenuWorkflowVersionIdComponentState, ); if (!isDefined(workflowVersionId)) { diff --git a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx b/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx index da4b8c1de7..e73bf7c43f 100644 --- a/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx +++ b/packages/twenty-front/src/modules/command-menu/pages/workflow/trigger-type/components/CommandMenuWorkflowSelectTriggerTypeContent.tsx @@ -1,7 +1,7 @@ import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { useCommandMenuWorkflowIdOrThrow } from '@/command-menu/pages/workflow/hooks/useCommandMenuWorkflowIdOrThrow'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { type WorkflowTrigger, @@ -29,7 +29,7 @@ export const CommandMenuWorkflowSelectTriggerTypeContent = () => { const { activeNonSystemObjectMetadataItems } = useFilteredObjectMetadataItems(); - const setWorkflowSelectedNode = useSetRecoilComponentStateV2( + const setWorkflowSelectedNode = useSetAtomComponentState( workflowSelectedNodeComponentState, ); const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationMorphItemsByPageState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationMorphItemsByPageState.ts index 099ac2c2ae..0d41a2e568 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationMorphItemsByPageState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationMorphItemsByPageState.ts @@ -1,7 +1,7 @@ import { type MorphItem } from '@/object-record/multiple-objects/types/MorphItem'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const commandMenuNavigationMorphItemsByPageState = createStateV2< +export const commandMenuNavigationMorphItemsByPageState = createAtomState< Map >({ key: 'command-menu/commandMenuNavigationMorphItemsByPageState', diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationStackState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationStackState.ts index f55b5a6c1f..e27fafe9e7 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationStackState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuNavigationStackState.ts @@ -1,4 +1,4 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type CommandMenuPages } from 'twenty-shared/types'; import { type IconComponent } from 'twenty-ui/display'; @@ -10,7 +10,7 @@ export type CommandMenuNavigationStackItem = { pageId: string; }; -export const commandMenuNavigationStackState = createStateV2< +export const commandMenuNavigationStackState = createAtomState< CommandMenuNavigationStackItem[] >({ key: 'command-menu/commandMenuNavigationStackState', diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageInfoState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuPageInfoState.ts index 58fd8558bf..dbaebb8710 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageInfoState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuPageInfoState.ts @@ -1,7 +1,7 @@ import { type IconComponent } from 'twenty-ui/display'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const commandMenuPageInfoState = createStateV2<{ +export const commandMenuPageInfoState = createAtomState<{ title?: string; Icon?: IconComponent; instanceId: string; diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuPageState.ts index 7a50b29e11..3916210c17 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuPageState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuPageState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { CommandMenuPages } from 'twenty-shared/types'; -export const commandMenuPageState = createStateV2({ +export const commandMenuPageState = createAtomState({ key: 'command-menu/commandMenuPageState', defaultValue: CommandMenuPages.Root, }); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts index 8b615199f8..efc7c4e001 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuSearchState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const commandMenuSearchState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const commandMenuSearchState = createAtomState({ key: 'command-menu/commandMenuSearchState', defaultValue: '', }); diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuShouldFocusTitleInputComponentState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuShouldFocusTitleInputComponentState.ts index 8a2718d5c0..1e581ea1dc 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuShouldFocusTitleInputComponentState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuShouldFocusTitleInputComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { CommandMenuPageComponentInstanceContext } from './contexts/CommandMenuPageComponentInstanceContext'; export const commandMenuShouldFocusTitleInputComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'commandMenuShouldFocusTitleInputComponentState', defaultValue: false, componentInstanceContext: CommandMenuPageComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/command-menu/states/commandMenuWidthState.ts b/packages/twenty-front/src/modules/command-menu/states/commandMenuWidthState.ts index 7566b9618b..ac05455a8c 100644 --- a/packages/twenty-front/src/modules/command-menu/states/commandMenuWidthState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/commandMenuWidthState.ts @@ -1,9 +1,9 @@ import { COMMAND_MENU_CONSTRAINTS } from '@/ui/layout/resizable-panel/constants/CommandMenuConstraints'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const COMMAND_MENU_WIDTH_VAR = '--command-menu-width'; -export const commandMenuWidthState = createStateV2({ +export const commandMenuWidthState = createAtomState({ key: 'commandMenuWidth', defaultValue: COMMAND_MENU_CONSTRAINTS.default, useLocalStorage: true, diff --git a/packages/twenty-front/src/modules/command-menu/states/hasUserSelectedCommandState.ts b/packages/twenty-front/src/modules/command-menu/states/hasUserSelectedCommandState.ts index 63e080fd26..7352a0f278 100644 --- a/packages/twenty-front/src/modules/command-menu/states/hasUserSelectedCommandState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/hasUserSelectedCommandState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const hasUserSelectedCommandState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const hasUserSelectedCommandState = createAtomState({ key: 'hasUserSelectedCommandState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuClosingState.ts b/packages/twenty-front/src/modules/command-menu/states/isCommandMenuClosingState.ts index 2cf41e8b88..0f0f4dd42d 100644 --- a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuClosingState.ts +++ b/packages/twenty-front/src/modules/command-menu/states/isCommandMenuClosingState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const isCommandMenuClosingState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const isCommandMenuClosingState = createAtomState({ key: 'command-menu/isCommandMenuClosingState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuOpenedStateV2.ts b/packages/twenty-front/src/modules/command-menu/states/isCommandMenuOpenedStateV2.ts index 75bd4a5338..f57fdf9567 100644 --- a/packages/twenty-front/src/modules/command-menu/states/isCommandMenuOpenedStateV2.ts +++ b/packages/twenty-front/src/modules/command-menu/states/isCommandMenuOpenedStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isCommandMenuOpenedStateV2 = createStateV2({ +export const isCommandMenuOpenedStateV2 = createAtomState({ key: 'command-menu/isCommandMenuOpenedStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/command-menu/states/isSidePanelAnimatingStateV2.ts b/packages/twenty-front/src/modules/command-menu/states/isSidePanelAnimatingStateV2.ts index 9d568e5a22..95c0d1a626 100644 --- a/packages/twenty-front/src/modules/command-menu/states/isSidePanelAnimatingStateV2.ts +++ b/packages/twenty-front/src/modules/command-menu/states/isSidePanelAnimatingStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isSidePanelAnimatingStateV2 = createStateV2({ +export const isSidePanelAnimatingStateV2 = createAtomState({ key: 'command-menu/isSidePanelAnimatingStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/context-store/components/MainContextStoreProvider.tsx b/packages/twenty-front/src/modules/context-store/components/MainContextStoreProvider.tsx index 0800601af5..519a2dda7b 100644 --- a/packages/twenty-front/src/modules/context-store/components/MainContextStoreProvider.tsx +++ b/packages/twenty-front/src/modules/context-store/components/MainContextStoreProvider.tsx @@ -4,8 +4,8 @@ import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage'; import { useLastVisitedView } from '@/navigation/hooks/useLastVisitedView'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { useShowAuthModal } from '@/ui/layout/hooks/useShowAuthModal'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { useLocation, useParams, useSearchParams } from 'react-router-dom'; import { AppPath } from 'twenty-shared/types'; @@ -48,9 +48,9 @@ export const MainContextStoreProvider = () => { const [searchParams] = useSearchParams(); const viewIdQueryParam = searchParams.get('viewId'); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const viewsEntry = useFamilyRecoilValueV2(metadataStoreState, 'views'); - const coreViews = useRecoilValueV2(coreViewsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const viewsEntry = useAtomFamilyStateValue(metadataStoreState, 'views'); + const coreViews = useAtomStateValue(coreViewsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => diff --git a/packages/twenty-front/src/modules/context-store/components/MainContextStoreProviderEffect.tsx b/packages/twenty-front/src/modules/context-store/components/MainContextStoreProviderEffect.tsx index 18c9057824..7c971f6359 100644 --- a/packages/twenty-front/src/modules/context-store/components/MainContextStoreProviderEffect.tsx +++ b/packages/twenty-front/src/modules/context-store/components/MainContextStoreProviderEffect.tsx @@ -6,8 +6,8 @@ import { getViewType } from '@/context-store/utils/getViewType'; import { useSetLastVisitedObjectMetadataId } from '@/navigation/hooks/useSetLastVisitedObjectMetadataId'; import { useSetLastVisitedViewForObjectMetadataNamePlural } from '@/navigation/hooks/useSetLastVisitedViewForObjectMetadataNamePlural'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { useEffect } from 'react'; @@ -33,13 +33,13 @@ export const MainContextStoreProviderEffect = ({ useSetLastVisitedObjectMetadataId(); const [contextStoreCurrentViewId, setContextStoreCurrentViewId] = - useRecoilComponentStateV2( + useAtomComponentState( contextStoreCurrentViewIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); const [contextStoreCurrentViewType, setContextStoreCurrentViewType] = - useRecoilComponentStateV2( + useAtomComponentState( contextStoreCurrentViewTypeComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); @@ -47,12 +47,12 @@ export const MainContextStoreProviderEffect = ({ const [ contextStoreCurrentObjectMetadataItemId, setContextStoreCurrentObjectMetadataItemId, - ] = useRecoilComponentStateV2( + ] = useAtomComponentState( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const view = useFamilySelectorValueV2(coreViewFromViewIdFamilySelector, { + const view = useAtomFamilySelectorValue(coreViewFromViewIdFamilySelector, { viewId: viewId ?? '', }); diff --git a/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItem.ts b/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItem.ts index 0316779c7d..17cde7b30b 100644 --- a/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItem.ts +++ b/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItem.ts @@ -1,17 +1,17 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useContextStoreObjectMetadataItem = ( contextStoreInstanceId?: string, ) => { - const objectMetadataItemId = useRecoilComponentValueV2( + const objectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, contextStoreInstanceId, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItemToFind) => diff --git a/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItemOrThrow.ts b/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItemOrThrow.ts index feeddff4cc..cd897a82e5 100644 --- a/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItemOrThrow.ts +++ b/packages/twenty-front/src/modules/context-store/hooks/useContextStoreObjectMetadataItemOrThrow.ts @@ -1,11 +1,11 @@ import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useContextStoreObjectMetadataItemOrThrow = ( contextStoreInstanceId?: string, ) => { - const objectMetadataItemId = useRecoilComponentValueV2( + const objectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, contextStoreInstanceId, ); diff --git a/packages/twenty-front/src/modules/context-store/hooks/useFindManyRecordsSelectedInContextStore.ts b/packages/twenty-front/src/modules/context-store/hooks/useFindManyRecordsSelectedInContextStore.ts index c5e6b4cbd9..d099b1260f 100644 --- a/packages/twenty-front/src/modules/context-store/hooks/useFindManyRecordsSelectedInContextStore.ts +++ b/packages/twenty-front/src/modules/context-store/hooks/useFindManyRecordsSelectedInContextStore.ts @@ -9,8 +9,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; import { RecordFilterOperand } from '@/object-record/record-filter/types/RecordFilterOperand'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useFindManyRecordsSelectedInContextStore = ({ instanceId, @@ -19,7 +19,7 @@ export const useFindManyRecordsSelectedInContextStore = ({ instanceId?: string; limit?: number; }) => { - const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2( + const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, instanceId, ); @@ -28,29 +28,29 @@ export const useFindManyRecordsSelectedInContextStore = ({ objectId: contextStoreCurrentObjectMetadataItemId ?? '', }); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, instanceId, ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, instanceId, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, instanceId, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, instanceId, ); const { filterValueDependencies } = useFilterValueDependencies(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const allFieldMetadataItems = objectMetadataItems.flatMap( (objectMetadataItem) => objectMetadataItem.fields, diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreAnyFieldFilterValueComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreAnyFieldFilterValueComponentState.ts index 711998f67b..36237a5d31 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreAnyFieldFilterValueComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreAnyFieldFilterValueComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const contextStoreAnyFieldFilterValueComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'contextStoreAnyFieldFilterValueComponentState', defaultValue: '', componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState.ts index e614b5592e..713942a8a6 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const contextStoreCurrentObjectMetadataItemIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'contextStoreCurrentObjectMetadataItemIdComponentState', defaultValue: undefined, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewIdComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewIdComponentState.ts index 8466e91f5d..1962b6f482 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewIdComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewIdComponentState.ts @@ -1,7 +1,7 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const contextStoreCurrentViewIdComponentState = createComponentStateV2< +export const contextStoreCurrentViewIdComponentState = createAtomComponentState< string | undefined >({ key: 'contextStoreCurrentViewIdComponentState', diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewTypeComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewTypeComponentState.ts index c06c256303..20f359ae6a 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewTypeComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreCurrentViewTypeComponentState.ts @@ -1,9 +1,9 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { type ContextStoreViewType } from '@/context-store/types/ContextStoreViewType'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const contextStoreCurrentViewTypeComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'contextStoreCurrentViewTypeComponentState', defaultValue: null, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreFilterGroupsComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreFilterGroupsComponentState.ts index e60830a3ed..70e81ee618 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreFilterGroupsComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreFilterGroupsComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const contextStoreFilterGroupsComponentState = createComponentStateV2< +export const contextStoreFilterGroupsComponentState = createAtomComponentState< RecordFilterGroup[] >({ key: 'contextStoreFilterGroupsComponentState', diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreFiltersComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreFiltersComponentState.ts index 08872c066d..2566ae4d06 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreFiltersComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreFiltersComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const contextStoreFiltersComponentState = createComponentStateV2< +export const contextStoreFiltersComponentState = createAtomComponentState< RecordFilter[] >({ key: 'contextStoreFiltersComponentState', diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreIsPageInEditModeComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreIsPageInEditModeComponentState.ts index a778b074ce..d6aba1f576 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreIsPageInEditModeComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreIsPageInEditModeComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const contextStoreIsPageInEditModeComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'contextStoreIsPageInEditModeComponentState', defaultValue: false, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreNumberOfSelectedRecordsComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreNumberOfSelectedRecordsComponentState.ts index fdb0607ddb..9cd65ef9bc 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreNumberOfSelectedRecordsComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreNumberOfSelectedRecordsComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const contextStoreNumberOfSelectedRecordsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'contextStoreNumberOfSelectedRecordsComponentState', defaultValue: 0, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreRecordShowParentViewComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreRecordShowParentViewComponentState.ts index 1678372551..6f602f8315 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreRecordShowParentViewComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreRecordShowParentViewComponentState.ts @@ -2,7 +2,7 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/con import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { type RecordSort } from '@/object-record/record-sort/types/RecordSort'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; type RecordShowParentViewComponentState = { parentViewComponentId: string; @@ -13,10 +13,10 @@ type RecordShowParentViewComponentState = { }; export const contextStoreRecordShowParentViewComponentState = - createComponentStateV2( - { - key: 'contextStoreRecordShowParentViewComponentState', - defaultValue: undefined, - componentInstanceContext: ContextStoreComponentInstanceContext, - }, - ); + createAtomComponentState< + RecordShowParentViewComponentState | undefined | null + >({ + key: 'contextStoreRecordShowParentViewComponentState', + defaultValue: undefined, + componentInstanceContext: ContextStoreComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/context-store/states/contextStoreTargetedRecordsRuleComponentState.ts b/packages/twenty-front/src/modules/context-store/states/contextStoreTargetedRecordsRuleComponentState.ts index c893b240ba..b0e5d23608 100644 --- a/packages/twenty-front/src/modules/context-store/states/contextStoreTargetedRecordsRuleComponentState.ts +++ b/packages/twenty-front/src/modules/context-store/states/contextStoreTargetedRecordsRuleComponentState.ts @@ -1,5 +1,5 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; type ContextStoreTargetedRecordsRuleSelectionMode = { mode: 'selection'; @@ -16,7 +16,7 @@ export type ContextStoreTargetedRecordsRule = | ContextStoreTargetedRecordsRuleExclusionMode; export const contextStoreTargetedRecordsRuleComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'contextStoreTargetedRecordsRuleComponentState', defaultValue: { mode: 'selection', diff --git a/packages/twenty-front/src/modules/domain-manager/hooks/useGetPublicWorkspaceDataByDomain.ts b/packages/twenty-front/src/modules/domain-manager/hooks/useGetPublicWorkspaceDataByDomain.ts index 89cf908b68..2d7f5a3fb6 100644 --- a/packages/twenty-front/src/modules/domain-manager/hooks/useGetPublicWorkspaceDataByDomain.ts +++ b/packages/twenty-front/src/modules/domain-manager/hooks/useGetPublicWorkspaceDataByDomain.ts @@ -4,8 +4,8 @@ import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWork import { useIsCurrentLocationOnDefaultDomain } from '@/domain-manager/hooks/useIsCurrentLocationOnDefaultDomain'; import { useOrigin } from '@/domain-manager/hooks/useOrigin'; import { useRedirectToDefaultDomain } from '@/domain-manager/hooks/useRedirectToDefaultDomain'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { workspaceAuthBypassProvidersState } from '@/workspace/states/workspaceAuthBypassProvidersState'; import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState'; import { isDefined } from 'twenty-shared/utils'; @@ -13,22 +13,20 @@ import { useGetPublicWorkspaceDataByDomainQuery } from '~/generated-metadata/gra export const useGetPublicWorkspaceDataByDomain = () => { const { isDefaultDomain } = useIsCurrentLocationOnDefaultDomain(); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); const { origin } = useOrigin(); - const setWorkspaceAuthProviders = useSetRecoilStateV2( + const setWorkspaceAuthProviders = useSetAtomState( workspaceAuthProvidersState, ); - const setWorkspaceAuthBypassProviders = useSetRecoilStateV2( + const setWorkspaceAuthBypassProviders = useSetAtomState( workspaceAuthBypassProvidersState, ); - const workspacePublicData = useRecoilValueV2(workspacePublicDataState); + const workspacePublicData = useAtomStateValue(workspacePublicDataState); const { redirectToDefaultDomain } = useRedirectToDefaultDomain(); - const setWorkspacePublicDataState = useSetRecoilStateV2( - workspacePublicDataState, - ); - const clientConfigApiStatus = useRecoilValueV2(clientConfigApiStatusState); + const setWorkspacePublicDataState = useSetAtomState(workspacePublicDataState); + const clientConfigApiStatus = useAtomStateValue(clientConfigApiStatusState); const { loading, data, error } = useGetPublicWorkspaceDataByDomainQuery({ variables: { diff --git a/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnAWorkspace.ts b/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnAWorkspace.ts index 1e707f2f7b..11a53bb9cb 100644 --- a/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnAWorkspace.ts +++ b/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnAWorkspace.ts @@ -1,16 +1,16 @@ import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState'; import { useReadDefaultDomainFromConfiguration } from '@/domain-manager/hooks/useReadDefaultDomainFromConfiguration'; import { domainConfigurationState } from '@/domain-manager/states/domainConfigurationState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useIsCurrentLocationOnAWorkspace = () => { const { defaultDomain } = useReadDefaultDomainFromConfiguration(); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); - const domainConfiguration = useRecoilValueV2(domainConfigurationState); + const domainConfiguration = useAtomStateValue(domainConfigurationState); if ( isMultiWorkspaceEnabled && diff --git a/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnDefaultDomain.ts b/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnDefaultDomain.ts index 1cad029fac..e25cf51d30 100644 --- a/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnDefaultDomain.ts +++ b/packages/twenty-front/src/modules/domain-manager/hooks/useIsCurrentLocationOnDefaultDomain.ts @@ -1,9 +1,9 @@ import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useReadDefaultDomainFromConfiguration } from '@/domain-manager/hooks/useReadDefaultDomainFromConfiguration'; export const useIsCurrentLocationOnDefaultDomain = () => { - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); const { defaultDomain } = useReadDefaultDomainFromConfiguration(); diff --git a/packages/twenty-front/src/modules/domain-manager/hooks/useLastAuthenticatedWorkspaceDomain.ts b/packages/twenty-front/src/modules/domain-manager/hooks/useLastAuthenticatedWorkspaceDomain.ts index 2f7fa20a63..ee3cb73a22 100644 --- a/packages/twenty-front/src/modules/domain-manager/hooks/useLastAuthenticatedWorkspaceDomain.ts +++ b/packages/twenty-front/src/modules/domain-manager/hooks/useLastAuthenticatedWorkspaceDomain.ts @@ -1,11 +1,11 @@ import { domainConfigurationState } from '@/domain-manager/states/domainConfigurationState'; import { lastAuthenticatedWorkspaceDomainState } from '@/domain-manager/states/lastAuthenticatedWorkspaceDomainState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useLastAuthenticatedWorkspaceDomain = () => { - const domainConfiguration = useRecoilValueV2(domainConfigurationState); - const setLastAuthenticatedWorkspaceDomain = useSetRecoilStateV2( + const domainConfiguration = useAtomStateValue(domainConfigurationState); + const setLastAuthenticatedWorkspaceDomain = useSetAtomState( lastAuthenticatedWorkspaceDomainState, ); const setLastAuthenticateWorkspaceDomainWithCookieAttributes = ( diff --git a/packages/twenty-front/src/modules/domain-manager/hooks/useReadDefaultDomainFromConfiguration.ts b/packages/twenty-front/src/modules/domain-manager/hooks/useReadDefaultDomainFromConfiguration.ts index 33e5f3be1d..5147c31423 100644 --- a/packages/twenty-front/src/modules/domain-manager/hooks/useReadDefaultDomainFromConfiguration.ts +++ b/packages/twenty-front/src/modules/domain-manager/hooks/useReadDefaultDomainFromConfiguration.ts @@ -1,10 +1,10 @@ import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState'; import { domainConfigurationState } from '@/domain-manager/states/domainConfigurationState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useReadDefaultDomainFromConfiguration = () => { - const domainConfiguration = useRecoilValueV2(domainConfigurationState); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const domainConfiguration = useAtomStateValue(domainConfigurationState); + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); diff --git a/packages/twenty-front/src/modules/domain-manager/hooks/useRedirectToWorkspaceDomain.ts b/packages/twenty-front/src/modules/domain-manager/hooks/useRedirectToWorkspaceDomain.ts index 9c87cb9818..1ded7f7200 100644 --- a/packages/twenty-front/src/modules/domain-manager/hooks/useRedirectToWorkspaceDomain.ts +++ b/packages/twenty-front/src/modules/domain-manager/hooks/useRedirectToWorkspaceDomain.ts @@ -2,10 +2,10 @@ import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWork import { useBuildSearchParamsFromUrlSyncedStates } from '@/domain-manager/hooks/useBuildSearchParamsFromUrlSyncedStates'; import { useBuildWorkspaceUrl } from '@/domain-manager/hooks/useBuildWorkspaceUrl'; import { useRedirect } from '@/domain-manager/hooks/useRedirect'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useRedirectToWorkspaceDomain = () => { - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); const { buildWorkspaceUrl } = useBuildWorkspaceUrl(); diff --git a/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.ts b/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.ts index 8ec2bc4712..67937c5a42 100644 --- a/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.ts +++ b/packages/twenty-front/src/modules/domain-manager/states/domainConfigurationState.ts @@ -1,7 +1,7 @@ import { type ClientConfig } from '@/client-config/types/ClientConfig'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const domainConfigurationState = createStateV2< +export const domainConfigurationState = createAtomState< Pick >({ key: 'domainConfiguration', diff --git a/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.ts b/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.ts index c41bef3ea1..30503e2446 100644 --- a/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.ts +++ b/packages/twenty-front/src/modules/domain-manager/states/lastAuthenticatedWorkspaceDomainState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const lastAuthenticatedWorkspaceDomainState = createStateV2< +export const lastAuthenticatedWorkspaceDomainState = createAtomState< | { workspaceUrl: string; workspaceId: string; diff --git a/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx b/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx index 2191d991a8..ab17af1e82 100644 --- a/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx +++ b/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx @@ -2,18 +2,18 @@ import { currentUserState } from '@/auth/states/currentUserState'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { sentryConfigState } from '@/client-config/states/sentryConfigState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect, useState } from 'react'; import { isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { REACT_APP_SERVER_BASE_URL } from '~/config'; export const SentryInitEffect = () => { - const sentryConfig = useRecoilValueV2(sentryConfigState); + const sentryConfig = useAtomStateValue(sentryConfigState); - const currentUser = useRecoilValueV2(currentUserState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentUser = useAtomStateValue(currentUserState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const [isSentryInitialized, setIsSentryInitialized] = useState(false); const [isSentryInitializing, setIsSentryInitializing] = useState(false); diff --git a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx index 4aa478c541..d32af42fde 100644 --- a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx +++ b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx @@ -7,12 +7,12 @@ import { useDeleteFavorite } from '@/favorites/hooks/useDeleteFavorite'; import { useDeleteFavoriteFolder } from '@/favorites/hooks/useDeleteFavoriteFolder'; import { useRenameFavoriteFolder } from '@/favorites/hooks/useRenameFavoriteFolder'; import { openFavoriteFolderIdsStateV2 } from '@/favorites/states/openFavoriteFolderIdsStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { getFavoriteSecondaryLabel } from '@/favorites/utils/getFavoriteSecondaryLabel'; import { isLocationMatchingFavorite } from '@/favorites/utils/isLocationMatchingFavorite'; import { type ProcessedFavorite } from '@/favorites/utils/sortFavorites'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; @@ -24,9 +24,9 @@ import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/componen import { NavigationDrawerItemsCollapsableContainer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer'; import { NavigationDrawerSubItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem'; import { currentFavoriteFolderIdStateV2 } from '@/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { Droppable } from '@hello-pangea/dnd'; import { useLingui } from '@lingui/react/macro'; import { useContext, useState } from 'react'; @@ -51,7 +51,7 @@ export const CurrentWorkspaceMemberFavorites = ({ isGroup, }: CurrentWorkspaceMemberFavoritesProps) => { const { t } = useLingui(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const currentPath = useLocation().pathname; const currentViewPath = useLocation().pathname + useLocation().search; const { isDragging } = useContext(FavoritesDragContext); @@ -64,13 +64,11 @@ export const CurrentWorkspaceMemberFavorites = ({ const isMobile = useIsMobile(); - const [openFavoriteFolderIds, setOpenFavoriteFolderIds] = useRecoilStateV2( + const [openFavoriteFolderIds, setOpenFavoriteFolderIds] = useAtomState( openFavoriteFolderIdsStateV2, ); - const setCurrentFolderId = useSetRecoilStateV2( - currentFavoriteFolderIdStateV2, - ); + const setCurrentFolderId = useSetAtomState(currentFavoriteFolderIdStateV2); const isOpen = openFavoriteFolderIds.includes(folder.folderId); @@ -95,7 +93,7 @@ export const CurrentWorkspaceMemberFavorites = ({ const dropdownId = `favorite-folder-edit-${folder.folderId}`; - const isDropdownOpenComponent = useRecoilComponentValueV2( + const isDropdownOpenComponent = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); @@ -162,7 +160,7 @@ export const CurrentWorkspaceMemberFavorites = ({ /> ); - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); diff --git a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx index 1f269add32..021d926fe6 100644 --- a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx +++ b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx @@ -5,27 +5,28 @@ import { FavoritesSkeletonLoader } from '@/favorites/components/FavoritesSkeleto import { useFavorites } from '@/favorites/hooks/useFavorites'; import { useFavoritesByFolder } from '@/favorites/hooks/useFavoritesByFolder'; import { isFavoriteFolderCreatingStateV2 } from '@/favorites/states/isFavoriteFolderCreatingStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading'; import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper'; import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection'; import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle'; import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection'; import { isNavigationSectionOpenFamilyState } from '@/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; import { IconFolderPlus } from 'twenty-ui/display'; import { LightIconButton } from 'twenty-ui/input'; export const CurrentWorkspaceMemberFavoritesFolders = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { sortedFavorites: favorites } = useFavorites(); const { favoritesByFolder } = useFavoritesByFolder(); - const [isFavoriteFolderCreating, setIsFavoriteFolderCreating] = - useRecoilStateV2(isFavoriteFolderCreatingStateV2); + const [isFavoriteFolderCreating, setIsFavoriteFolderCreating] = useAtomState( + isFavoriteFolderCreatingStateV2, + ); const loading = useIsPrefetchLoading(); @@ -33,7 +34,7 @@ export const CurrentWorkspaceMemberFavoritesFolders = () => { const { toggleNavigationSection, openNavigationSection } = useNavigationSection('Favorites'); - const isNavigationSectionOpen = useFamilyRecoilValueV2( + const isNavigationSectionOpen = useAtomFamilyStateValue( isNavigationSectionOpenFamilyState, 'Favorites', ); diff --git a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberOrphanFavorites.tsx b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberOrphanFavorites.tsx index 930b20043d..736eb35e6d 100644 --- a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberOrphanFavorites.tsx +++ b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberOrphanFavorites.tsx @@ -8,7 +8,7 @@ import { isLocationMatchingFavorite } from '@/favorites/utils/isLocationMatching import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { useContext } from 'react'; import { useLocation } from 'react-router-dom'; @@ -24,7 +24,7 @@ const StyledOrphanFavoritesContainer = styled.div` `; export const CurrentWorkspaceMemberOrphanFavorites = () => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { sortedFavorites: favorites } = useFavorites(); const { deleteFavorite } = useDeleteFavorite(); const currentPath = useLocation().pathname; diff --git a/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx b/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx index 346c0af8ef..1ed723eded 100644 --- a/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx +++ b/packages/twenty-front/src/modules/favorites/components/FavoritesBackButton.tsx @@ -1,5 +1,5 @@ import { currentFavoriteFolderIdStateV2 } from '@/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { IconX } from 'twenty-ui/display'; @@ -35,9 +35,7 @@ export const FavoritesBackButton = ({ folderName, }: FavoritesBackButtonProps) => { const theme = useTheme(); - const setCurrentFolderId = useSetRecoilStateV2( - currentFavoriteFolderIdStateV2, - ); + const setCurrentFolderId = useSetAtomState(currentFavoriteFolderIdStateV2); const handleClick = (e: React.MouseEvent) => { e.preventDefault(); diff --git a/packages/twenty-front/src/modules/favorites/components/FavoritesFolderContent.tsx b/packages/twenty-front/src/modules/favorites/components/FavoritesFolderContent.tsx index 0533000023..cb9f502b86 100644 --- a/packages/twenty-front/src/modules/favorites/components/FavoritesFolderContent.tsx +++ b/packages/twenty-front/src/modules/favorites/components/FavoritesFolderContent.tsx @@ -7,7 +7,7 @@ import { type ProcessedFavorite } from '@/favorites/utils/sortFavorites'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Droppable } from '@hello-pangea/dnd'; import { IconHeartOff } from 'twenty-ui/display'; import { LightIconButton } from 'twenty-ui/input'; @@ -23,7 +23,7 @@ export const FavoritesFolderContent = ({ folderId, favorites, }: FavoritesFolderContentProps) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { deleteFavorite } = useDeleteFavorite(); return ( diff --git a/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx b/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx index 4ab1a9554c..ee666b33b2 100644 --- a/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx +++ b/packages/twenty-front/src/modules/favorites/components/FavoritesFolders.tsx @@ -2,7 +2,7 @@ import { CurrentWorkspaceMemberFavorites } from '@/favorites/components/CurrentW import { useCreateFavoriteFolder } from '@/favorites/hooks/useCreateFavoriteFolder'; import { useFavoritesByFolder } from '@/favorites/hooks/useFavoritesByFolder'; import { isFavoriteFolderCreatingStateV2 } from '@/favorites/states/isFavoriteFolderCreatingStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper'; import { NavigationDrawerInput } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerInput'; import { useState } from 'react'; @@ -20,8 +20,9 @@ export const FavoriteFolders = ({ const { favoritesByFolder } = useFavoritesByFolder(); const { createNewFavoriteFolder } = useCreateFavoriteFolder(); - const [isFavoriteFolderCreating, setIsFavoriteFolderCreating] = - useRecoilStateV2(isFavoriteFolderCreatingStateV2); + const [isFavoriteFolderCreating, setIsFavoriteFolderCreating] = useAtomState( + isFavoriteFolderCreatingStateV2, + ); const handleFavoriteFolderNameChange = (value: string) => { setNewFolderName(value); diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx index 950f86e1ee..864abdb504 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPicker.tsx @@ -5,14 +5,14 @@ import { useFavoriteFolderPicker } from '@/favorites/favorite-folder-picker/hook import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder-picker/states/context/FavoriteFolderPickerInstanceContext'; import { favoriteFolderSearchFilterComponentState } from '@/favorites/favorite-folder-picker/states/favoriteFoldersSearchFilterComponentState'; import { isFavoriteFolderCreatingStateV2 } from '@/favorites/states/isFavoriteFolderCreatingStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { Key } from 'ts-key-enum'; type FavoriteFolderPickerProps = { @@ -30,8 +30,9 @@ export const FavoriteFolderPicker = ({ objectNameSingular, dropdownId, }: FavoriteFolderPickerProps) => { - const [isFavoriteFolderCreating, setIsFavoriteFolderCreating] = - useRecoilStateV2(isFavoriteFolderCreatingStateV2); + const [isFavoriteFolderCreating, setIsFavoriteFolderCreating] = useAtomState( + isFavoriteFolderCreatingStateV2, + ); const instanceId = useAvailableComponentInstanceIdOrThrow( FavoriteFolderPickerInstanceContext, @@ -42,7 +43,7 @@ export const FavoriteFolderPicker = ({ objectNameSingular, }); - const [favoriteFoldersSearchFilter] = useRecoilComponentStateV2( + const [favoriteFoldersSearchFilter] = useAtomComponentState( favoriteFolderSearchFilterComponentState, ); diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerEffect.tsx b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerEffect.tsx index ea51b54b40..40617bb4d2 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerEffect.tsx +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerEffect.tsx @@ -8,9 +8,9 @@ import { useFavorites } from '@/favorites/hooks/useFavorites'; import { usePrefetchedFavoritesFoldersData } from '@/favorites/hooks/usePrefetchedFavoritesFoldersData'; import { type FavoriteFolder } from '@/favorites/types/FavoriteFolder'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isDefined } from 'twenty-shared/utils'; import { useStore } from 'jotai'; @@ -23,17 +23,16 @@ export const FavoriteFolderPickerEffect = ({ }: FavoriteFolderPickerEffectProps) => { const store = useStore(); const [favoriteFolderIdsPicker, setFavoriteFolderIdsPicker] = - useRecoilComponentStateV2(favoriteFolderIdsPickerComponentState); + useAtomComponentState(favoriteFolderIdsPickerComponentState); - const favoriteFolderPickerFamily = - useRecoilComponentFamilyStateCallbackStateV2( - favoriteFolderPickerComponentFamilyState, - ); + const favoriteFolderPickerFamily = useAtomComponentFamilyStateCallbackState( + favoriteFolderPickerComponentFamilyState, + ); const { favoriteFolders } = usePrefetchedFavoritesFoldersData(); const { sortedFavorites: favorites } = useFavorites(); - const setCheckedState = useSetRecoilComponentStateV2( + const setCheckedState = useSetAtomComponentState( favoriteFolderPickerCheckedComponentState, ); diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx index d47124118d..d39d23c2b4 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerFooter.tsx @@ -1,10 +1,10 @@ import { isFavoriteFolderCreatingStateV2 } from '@/favorites/states/isFavoriteFolderCreatingStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useTheme } from '@emotion/react'; import { useLingui } from '@lingui/react/macro'; import { IconPlus } from 'twenty-ui/display'; @@ -16,10 +16,10 @@ export const FavoriteFolderPickerFooter = ({ dropdownId: string; }) => { const { t } = useLingui(); - const [, setIsFavoriteFolderCreating] = useRecoilStateV2( + const [, setIsFavoriteFolderCreating] = useAtomState( isFavoriteFolderCreatingStateV2, ); - const setIsNavigationDrawerExpanded = useSetRecoilStateV2( + const setIsNavigationDrawerExpanded = useSetAtomState( isNavigationDrawerExpandedState, ); const { openNavigationSection } = useNavigationSection('Favorites'); diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerList.tsx b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerList.tsx index 9aa2318aa7..a1ada657b0 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerList.tsx +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerList.tsx @@ -2,7 +2,7 @@ import { favoriteFolderPickerCheckedComponentState } from '@/favorites/favorite- import { favoriteFolderSearchFilterComponentState } from '@/favorites/favorite-folder-picker/states/favoriteFoldersSearchFilterComponentState'; import { type FavoriteFolder } from '@/favorites/types/FavoriteFolder'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { MenuItem, MenuItemMultiSelect } from 'twenty-ui/navigation'; @@ -28,11 +28,11 @@ export const FavoriteFolderPickerList = ({ toggleFolderSelection, }: FavoriteFolderPickerListProps) => { const { t } = useLingui(); - const [favoriteFoldersSearchFilter] = useRecoilComponentStateV2( + const [favoriteFoldersSearchFilter] = useAtomComponentState( favoriteFolderSearchFilterComponentState, ); - const [favoriteFolderPickerChecked] = useRecoilComponentStateV2( + const [favoriteFolderPickerChecked] = useAtomComponentState( favoriteFolderPickerCheckedComponentState, ); diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerSearchInput.tsx b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerSearchInput.tsx index 7bc850bb89..83a87c8661 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerSearchInput.tsx +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/components/FavoriteFolderPickerSearchInput.tsx @@ -1,12 +1,12 @@ import { favoriteFolderSearchFilterComponentState } from '@/favorites/favorite-folder-picker/states/favoriteFoldersSearchFilterComponentState'; import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useCallback } from 'react'; import { useDebouncedCallback } from 'use-debounce'; export const FavoriteFolderPickerSearchInput = () => { const [favoriteFoldersSearchFilter, setFavoriteFoldersSearchFilter] = - useRecoilComponentStateV2(favoriteFolderSearchFilterComponentState); + useAtomComponentState(favoriteFolderSearchFilterComponentState); const debouncedSetSearchFilter = useDebouncedCallback( setFavoriteFoldersSearchFilter, diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/hooks/useFavoriteFolderPicker.ts b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/hooks/useFavoriteFolderPicker.ts index 852aa484e1..330328f4c8 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/hooks/useFavoriteFolderPicker.ts +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/hooks/useFavoriteFolderPicker.ts @@ -6,8 +6,8 @@ import { useFavorites } from '@/favorites/hooks/useFavorites'; import { type FavoriteFolder } from '@/favorites/types/FavoriteFolder'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -26,16 +26,15 @@ export const useFavoriteFolderPicker = ({ record, objectNameSingular, }: useFavoriteFolderPickerProps): useFavoriteFolderPickerReturnType => { - const favoriteFoldersMultiSelectChecked = - useRecoilComponentStateCallbackStateV2( - favoriteFolderPickerCheckedComponentState, - ); + const favoriteFoldersMultiSelectChecked = useAtomComponentStateCallbackState( + favoriteFolderPickerCheckedComponentState, + ); const { sortedFavorites: favorites } = useFavorites(); const { createFavorite } = useCreateFavorite(); const { deleteFavorite } = useDeleteFavorite(); - const favoriteFolders = useRecoilComponentSelectorValueV2( + const favoriteFolders = useAtomComponentSelectorValue( favoriteFoldersComponentSelector, ); diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderIdPickerComponentState.ts b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderIdPickerComponentState.ts index c4fc1fd6c8..b1b1867bcc 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderIdPickerComponentState.ts +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderIdPickerComponentState.ts @@ -1,7 +1,7 @@ import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder-picker/states/context/FavoriteFolderPickerInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const favoriteFolderIdsPickerComponentState = createComponentStateV2< +export const favoriteFolderIdsPickerComponentState = createAtomComponentState< string[] >({ key: 'favoriteFolderIdsPickerComponentState', diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerCheckedComponentState.ts b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerCheckedComponentState.ts index 551cc776f5..2f05985a84 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerCheckedComponentState.ts +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerCheckedComponentState.ts @@ -1,10 +1,9 @@ import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder-picker/states/context/FavoriteFolderPickerInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const favoriteFolderPickerCheckedComponentState = createComponentStateV2< - string[] ->({ - key: 'favoriteFolderPickerCheckedComponentState', - defaultValue: [], - componentInstanceContext: FavoriteFolderPickerInstanceContext, -}); +export const favoriteFolderPickerCheckedComponentState = + createAtomComponentState({ + key: 'favoriteFolderPickerCheckedComponentState', + defaultValue: [], + componentInstanceContext: FavoriteFolderPickerInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerComponentFamilyState.ts b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerComponentFamilyState.ts index c4c49ac641..b4bcc634a3 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFolderPickerComponentFamilyState.ts @@ -1,9 +1,9 @@ import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder-picker/states/context/FavoriteFolderPickerInstanceContext'; import { type FavoriteFolder } from '@/favorites/types/FavoriteFolder'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const favoriteFolderPickerComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'favoriteFolderPickerComponentFamilyState', defaultValue: undefined, componentInstanceContext: FavoriteFolderPickerInstanceContext, diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFoldersSearchFilterComponentState.ts b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFoldersSearchFilterComponentState.ts index c3e9417d0e..c441324264 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFoldersSearchFilterComponentState.ts +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/favoriteFoldersSearchFilterComponentState.ts @@ -1,8 +1,8 @@ import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder-picker/states/context/FavoriteFolderPickerInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const favoriteFolderSearchFilterComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'favoriteFolderSearchFilterComponentState', defaultValue: '', componentInstanceContext: FavoriteFolderPickerInstanceContext, diff --git a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/selectors/favoriteFoldersComponentSelector.ts b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/selectors/favoriteFoldersComponentSelector.ts index b3b1e008f3..b7d3cca69e 100644 --- a/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/selectors/favoriteFoldersComponentSelector.ts +++ b/packages/twenty-front/src/modules/favorites/favorite-folder-picker/states/selectors/favoriteFoldersComponentSelector.ts @@ -2,10 +2,10 @@ import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder import { favoriteFolderIdsPickerComponentState } from '@/favorites/favorite-folder-picker/states/favoriteFolderIdPickerComponentState'; import { favoriteFolderPickerComponentFamilyState } from '@/favorites/favorite-folder-picker/states/favoriteFolderPickerComponentFamilyState'; import { type FavoriteFolder } from '@/favorites/types/FavoriteFolder'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { isDefined } from 'twenty-shared/utils'; -export const favoriteFoldersComponentSelector = createComponentSelectorV2< +export const favoriteFoldersComponentSelector = createAtomComponentSelector< FavoriteFolder[] >({ key: 'favoriteFoldersComponentSelector', diff --git a/packages/twenty-front/src/modules/favorites/hooks/useCreateFavorite.ts b/packages/twenty-front/src/modules/favorites/hooks/useCreateFavorite.ts index 7493296def..bf07c258f3 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useCreateFavorite.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useCreateFavorite.ts @@ -6,7 +6,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { isDefined } from 'twenty-shared/utils'; import { useCreateNavigationMenuItemMutation } from '~/generated-metadata/graphql'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { usePrefetchedFavoritesData } from './usePrefetchedFavoritesData'; import { usePrefetchedFavoritesFoldersData } from './usePrefetchedFavoritesFoldersData'; @@ -14,7 +14,7 @@ export const useCreateFavorite = () => { const { favorites, currentWorkspaceMemberId } = usePrefetchedFavoritesData(); const { favoriteFolders } = usePrefetchedFavoritesFoldersData(); const { navigationMenuItems } = usePrefetchedNavigationMenuItemsData(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { createOneRecord: createOneFavorite } = useCreateOneRecord({ objectNameSingular: CoreObjectNameSingular.Favorite, diff --git a/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts b/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts index c077f11d22..ebd4cb24c0 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useFavorites.ts @@ -8,19 +8,19 @@ import { useMemo } from 'react'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { usePrefetchedFavoritesData } from './usePrefetchedFavoritesData'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useFavorites = () => { const { favorites } = usePrefetchedFavoritesData(); - const favoriteViewsWithMinimalData = useRecoilValueV2( + const favoriteViewsWithMinimalData = useAtomStateValue( favoriteViewsWithMinimalDataSelector, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectMetadataItem: favoriteObjectMetadataItem } = useObjectMetadataItem({ objectNameSingular: CoreObjectNameSingular.Favorite, }); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); const getObjectRecordIdentifierByNameSingular = diff --git a/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts b/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts index e352cce640..8a361655b4 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts @@ -1,5 +1,5 @@ import { sortFavorites } from '@/favorites/utils/sortFavorites'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; import { useFavoritesMetadata } from './useFavoritesMetadata'; @@ -15,7 +15,7 @@ export const useFavoritesByFolder = () => { favoriteRelationFields, } = useFavoritesMetadata(); - const coreViews = useRecoilValueV2(coreViewsState); + const coreViews = useAtomStateValue(coreViewsState); const views = coreViews.map(convertCoreViewToView); diff --git a/packages/twenty-front/src/modules/favorites/hooks/useFavoritesMetadata.ts b/packages/twenty-front/src/modules/favorites/hooks/useFavoritesMetadata.ts index 67bdaced51..caa2f1fa32 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useFavoritesMetadata.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useFavoritesMetadata.ts @@ -4,11 +4,11 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useFavoritesMetadata = () => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); const getObjectRecordIdentifierByNameSingular = diff --git a/packages/twenty-front/src/modules/favorites/hooks/useHandleFavoriteDragAndDrop.ts b/packages/twenty-front/src/modules/favorites/hooks/useHandleFavoriteDragAndDrop.ts index 9578e7fee7..81854216e6 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useHandleFavoriteDragAndDrop.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useHandleFavoriteDragAndDrop.ts @@ -1,7 +1,7 @@ import { FAVORITE_DROPPABLE_IDS } from '@/favorites/constants/FavoriteDroppableIds'; import { useSortedFavorites } from '@/favorites/hooks/useSortedFavorites'; import { openFavoriteFolderIdsStateV2 } from '@/favorites/states/openFavoriteFolderIdsStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { calculateNewPosition } from '@/ui/layout/draggable-list/utils/calculateNewPosition'; @@ -13,7 +13,7 @@ export const useHandleFavoriteDragAndDrop = () => { const { favorites } = usePrefetchedFavoritesData(); const { favoritesSorted } = useSortedFavorites(); const { updateOneRecord } = useUpdateOneRecord(); - const setOpenFavoriteFolderIds = useSetRecoilStateV2( + const setOpenFavoriteFolderIds = useSetAtomState( openFavoriteFolderIdsStateV2, ); diff --git a/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesData.ts b/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesData.ts index 8a751721a4..f59fade7a9 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesData.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesData.ts @@ -1,7 +1,7 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { type Favorite } from '@/favorites/types/Favorite'; import { prefetchFavoritesState } from '@/prefetch/states/prefetchFavoritesState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; type PrefetchedFavoritesData = { favorites: Favorite[]; @@ -10,9 +10,9 @@ type PrefetchedFavoritesData = { }; export const usePrefetchedFavoritesData = (): PrefetchedFavoritesData => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const currentWorkspaceMemberId = currentWorkspaceMember?.id; - const prefetchFavorites = useRecoilValueV2(prefetchFavoritesState); + const prefetchFavorites = useAtomStateValue(prefetchFavoritesState); const favorites = prefetchFavorites.filter( (favorite) => favorite.forWorkspaceMemberId === currentWorkspaceMemberId, diff --git a/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesFoldersData.ts b/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesFoldersData.ts index 22c44d7a53..b40ab3a982 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesFoldersData.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/usePrefetchedFavoritesFoldersData.ts @@ -1,7 +1,7 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { type FavoriteFolder } from '@/favorites/types/FavoriteFolder'; import { prefetchFavoriteFoldersState } from '@/prefetch/states/prefetchFavoriteFoldersState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; type PrefetchedFavoritesFoldersData = { favoriteFolders: FavoriteFolder[]; @@ -10,12 +10,12 @@ type PrefetchedFavoritesFoldersData = { export const usePrefetchedFavoritesFoldersData = (): PrefetchedFavoritesFoldersData => { - const currentWorkspaceMember = useRecoilValueV2( + const currentWorkspaceMember = useAtomStateValue( currentWorkspaceMemberState, ); const currentWorkspaceMemberId = currentWorkspaceMember?.id; - const prefetchFavoriteFolders = useRecoilValueV2( + const prefetchFavoriteFolders = useAtomStateValue( prefetchFavoriteFoldersState, ); diff --git a/packages/twenty-front/src/modules/favorites/hooks/useSortedFavorites.ts b/packages/twenty-front/src/modules/favorites/hooks/useSortedFavorites.ts index 6da17b3c75..9b920c81b9 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useSortedFavorites.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useSortedFavorites.ts @@ -1,5 +1,5 @@ import { sortFavorites } from '@/favorites/utils/sortFavorites'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; import { useMemo } from 'react'; @@ -14,7 +14,9 @@ export const useSortedFavorites = () => { favoriteRelationFields, } = useFavoritesMetadata(); - const coreViews = useRecoilValueV2(coreViewsState).map(convertCoreViewToView); + const coreViews = useAtomStateValue(coreViewsState).map( + convertCoreViewToView, + ); const favoritesSorted = useMemo(() => { return sortFavorites( diff --git a/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts b/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts index c4d22b2015..4a1b3b17f5 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts @@ -5,7 +5,7 @@ import { useGetObjectRecordIdentifierByNameSingular } from '@/object-metadata/ho import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; import { useMemo } from 'react'; @@ -14,13 +14,13 @@ import { usePrefetchedFavoritesData } from './usePrefetchedFavoritesData'; export const useWorkspaceFavorites = () => { const { workspaceFavorites } = usePrefetchedFavoritesData(); - const coreViews = useRecoilValueV2(coreViewsState); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const coreViews = useAtomStateValue(coreViewsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectMetadataItem: favoriteObjectMetadataItem } = useObjectMetadataItem({ objectNameSingular: CoreObjectNameSingular.Favorite, }); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); const getObjectRecordIdentifierByNameSingular = diff --git a/packages/twenty-front/src/modules/favorites/states/isFavoriteFolderCreatingStateV2.ts b/packages/twenty-front/src/modules/favorites/states/isFavoriteFolderCreatingStateV2.ts index d1d742c197..87256b4fc9 100644 --- a/packages/twenty-front/src/modules/favorites/states/isFavoriteFolderCreatingStateV2.ts +++ b/packages/twenty-front/src/modules/favorites/states/isFavoriteFolderCreatingStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isFavoriteFolderCreatingStateV2 = createStateV2({ +export const isFavoriteFolderCreatingStateV2 = createAtomState({ key: 'isFavoriteFolderCreatingStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/favorites/states/openFavoriteFolderIdsStateV2.ts b/packages/twenty-front/src/modules/favorites/states/openFavoriteFolderIdsStateV2.ts index 0658793a2d..282aeeaf78 100644 --- a/packages/twenty-front/src/modules/favorites/states/openFavoriteFolderIdsStateV2.ts +++ b/packages/twenty-front/src/modules/favorites/states/openFavoriteFolderIdsStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const openFavoriteFolderIdsStateV2 = createStateV2({ +export const openFavoriteFolderIdsStateV2 = createAtomState({ key: 'openFavoriteFolderIdsStateV2', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts b/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts index 19f7f17f63..e2e6aded3d 100644 --- a/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts +++ b/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts @@ -1,9 +1,9 @@ import { coreViewsState } from '@/views/states/coreViewState'; import { type View } from '@/views/types/View'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; -export const favoriteViewsWithMinimalDataSelector = createSelectorV2< +export const favoriteViewsWithMinimalDataSelector = createAtomSelector< Pick[] >({ key: 'favoriteViewsWithMinimalDataSelector', diff --git a/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx b/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx index 3324015238..330a4076ae 100644 --- a/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx +++ b/packages/twenty-front/src/modules/front-components/components/HeadlessFrontComponentMountRoot.tsx @@ -1,7 +1,7 @@ import { Suspense, lazy } from 'react'; import { mountedHeadlessFrontComponentIdsState } from '@/front-components/states/mountedHeadlessFrontComponentIdsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const FrontComponentRenderer = lazy(() => import('@/front-components/components/FrontComponentRenderer').then( @@ -10,7 +10,7 @@ const FrontComponentRenderer = lazy(() => ); export const HeadlessFrontComponentMountRoot = () => { - const mountedHeadlessFrontComponentIds = useRecoilValueV2( + const mountedHeadlessFrontComponentIds = useAtomStateValue( mountedHeadlessFrontComponentIdsState, ); diff --git a/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts b/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts index 3a23d1fdb9..7d822a2147 100644 --- a/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts +++ b/packages/twenty-front/src/modules/front-components/hooks/useFrontComponentExecutionContext.ts @@ -1,4 +1,4 @@ -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type FrontComponentExecutionContext, type FrontComponentHostCommunicationApi, @@ -12,7 +12,7 @@ import { commandMenuSearchState } from '@/command-menu/states/commandMenuSearchS import { useRequestApplicationTokenRefresh } from '@/front-components/hooks/useRequestApplicationTokenRefresh'; import { useUnmountHeadlessFrontComponent } from '@/front-components/hooks/useUnmountHeadlessFrontComponent'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { assertUnreachable } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; import { useNavigateApp } from '~/hooks/useNavigateApp'; @@ -25,13 +25,13 @@ export const useFrontComponentExecutionContext = ({ executionContext: FrontComponentExecutionContext; frontComponentHostCommunicationApi: FrontComponentHostCommunicationApi; } => { - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const navigateApp = useNavigateApp(); const { requestAccessTokenRefresh } = useRequestApplicationTokenRefresh({ frontComponentId, }); const { navigateCommandMenu } = useNavigateCommandMenu(); - const setCommandMenuSearchState = useSetRecoilStateV2(commandMenuSearchState); + const setCommandMenuSearchState = useSetAtomState(commandMenuSearchState); const { getIcon } = useIcons(); const unmountHeadlessFrontComponent = useUnmountHeadlessFrontComponent(); const { diff --git a/packages/twenty-front/src/modules/front-components/selectors/isHeadlessFrontComponentMountedFamilySelector.ts b/packages/twenty-front/src/modules/front-components/selectors/isHeadlessFrontComponentMountedFamilySelector.ts index 46d45c141d..8bd0fac40b 100644 --- a/packages/twenty-front/src/modules/front-components/selectors/isHeadlessFrontComponentMountedFamilySelector.ts +++ b/packages/twenty-front/src/modules/front-components/selectors/isHeadlessFrontComponentMountedFamilySelector.ts @@ -1,8 +1,8 @@ import { mountedHeadlessFrontComponentIdsState } from '@/front-components/states/mountedHeadlessFrontComponentIdsState'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; export const isHeadlessFrontComponentMountedFamilySelector = - createFamilySelectorV2({ + createAtomFamilySelector({ key: 'isHeadlessFrontComponentMountedFamilySelector', get: (frontComponentId: string) => diff --git a/packages/twenty-front/src/modules/front-components/states/mountedHeadlessFrontComponentIdsState.ts b/packages/twenty-front/src/modules/front-components/states/mountedHeadlessFrontComponentIdsState.ts index ecf074bfac..4f6f16ff61 100644 --- a/packages/twenty-front/src/modules/front-components/states/mountedHeadlessFrontComponentIdsState.ts +++ b/packages/twenty-front/src/modules/front-components/states/mountedHeadlessFrontComponentIdsState.ts @@ -1,8 +1,8 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const mountedHeadlessFrontComponentIdsState = createStateV2>( - { - key: 'mountedHeadlessFrontComponentIdsState', - defaultValue: new Set(), - }, -); +export const mountedHeadlessFrontComponentIdsState = createAtomState< + Set +>({ + key: 'mountedHeadlessFrontComponentIdsState', + defaultValue: new Set(), +}); diff --git a/packages/twenty-front/src/modules/information-banner/components/InformationBanner.tsx b/packages/twenty-front/src/modules/information-banner/components/InformationBanner.tsx index f6105b193b..bf3d20c800 100644 --- a/packages/twenty-front/src/modules/information-banner/components/InformationBanner.tsx +++ b/packages/twenty-front/src/modules/information-banner/components/InformationBanner.tsx @@ -1,6 +1,6 @@ import { InformationBannerComponentInstanceContext } from '@/information-banner/states/contexts/InformationBannerComponentInstanceContext'; import { informationBannerIsOpenComponentState } from '@/information-banner/states/informationBannerIsOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { @@ -51,7 +51,7 @@ export const InformationBanner = ({ onClose?: () => void; componentInstanceId: string; }) => { - const informationBannerIsOpenComponent = useRecoilComponentValueV2( + const informationBannerIsOpenComponent = useAtomComponentStateValue( informationBannerIsOpenComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/information-banner/components/impersonate/InformationBannerIsImpersonating.tsx b/packages/twenty-front/src/modules/information-banner/components/impersonate/InformationBannerIsImpersonating.tsx index fa2dd208d7..0e8c6a4b9c 100644 --- a/packages/twenty-front/src/modules/information-banner/components/impersonate/InformationBannerIsImpersonating.tsx +++ b/packages/twenty-front/src/modules/information-banner/components/impersonate/InformationBannerIsImpersonating.tsx @@ -3,13 +3,13 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembe import { isImpersonatingState } from '@/auth/states/isImpersonatingState'; import { InformationBanner } from '@/information-banner/components/InformationBanner'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { IconLogout } from 'twenty-ui/display'; export const InformationBannerIsImpersonating = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); - const isImpersonating = useRecoilValueV2(isImpersonatingState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); + const isImpersonating = useAtomStateValue(isImpersonatingState); const { signOut } = useAuth(); diff --git a/packages/twenty-front/src/modules/information-banner/hooks/useAccountToReconnect.ts b/packages/twenty-front/src/modules/information-banner/hooks/useAccountToReconnect.ts index 9387c8b423..73c2e39f01 100644 --- a/packages/twenty-front/src/modules/information-banner/hooks/useAccountToReconnect.ts +++ b/packages/twenty-front/src/modules/information-banner/hooks/useAccountToReconnect.ts @@ -3,10 +3,10 @@ import { currentUserState } from '@/auth/states/currentUserState'; import { type InformationBannerKeys } from '@/information-banner/types/InformationBannerKeys'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useAccountToReconnect = (key: InformationBannerKeys) => { - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const userVars = currentUser?.userVars; diff --git a/packages/twenty-front/src/modules/information-banner/hooks/useDismissReconnectAccountBanner.ts b/packages/twenty-front/src/modules/information-banner/hooks/useDismissReconnectAccountBanner.ts index a9eeb46660..714d370836 100644 --- a/packages/twenty-front/src/modules/information-banner/hooks/useDismissReconnectAccountBanner.ts +++ b/packages/twenty-front/src/modules/information-banner/hooks/useDismissReconnectAccountBanner.ts @@ -3,7 +3,7 @@ import { useMutation } from '@apollo/client'; import { DISMISS_RECONNECT_ACCOUNT_BANNER } from '@/information-banner/graphql/mutations/dismissReconnectAccountBanner'; import { informationBannerIsOpenComponentState } from '@/information-banner/states/informationBannerIsOpenComponentState'; import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; type DismissReconnectAccountBannerMutationVariables = { connectedAccountId: string; @@ -25,7 +25,7 @@ export const useDismissReconnectAccountBanner = ( client: apolloCoreClient, }); - const setInformationBannerIsOpenComponent = useSetRecoilComponentStateV2( + const setInformationBannerIsOpenComponent = useSetAtomComponentState( informationBannerIsOpenComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/information-banner/states/informationBannerIsOpenComponentState.ts b/packages/twenty-front/src/modules/information-banner/states/informationBannerIsOpenComponentState.ts index bd7a2bd7bc..2432e1d8ab 100644 --- a/packages/twenty-front/src/modules/information-banner/states/informationBannerIsOpenComponentState.ts +++ b/packages/twenty-front/src/modules/information-banner/states/informationBannerIsOpenComponentState.ts @@ -1,8 +1,8 @@ import { InformationBannerComponentInstanceContext } from '@/information-banner/states/contexts/InformationBannerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const informationBannerIsOpenComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'informationBannerIsOpenComponentState', defaultValue: true, componentInstanceContext: InformationBannerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx index d17e8c5147..181f7286c0 100644 --- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx +++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/components/KeyboardShortcutMenu.tsx @@ -5,11 +5,11 @@ import { isKeyboardShortcutMenuOpenedStateV2 } from '@/keyboard-shortcut-menu/st import { KeyboardShortcutMenuOpenContent } from '@/keyboard-shortcut-menu/components/KeyboardShortcutMenuOpenContent'; import { useGlobalHotkeys } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeys'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const KeyboardShortcutMenu = () => { const { toggleKeyboardShortcutMenu } = useKeyboardShortcutMenu(); - const isKeyboardShortcutMenuOpened = useRecoilValueV2( + const isKeyboardShortcutMenuOpened = useAtomStateValue( isKeyboardShortcutMenuOpenedStateV2, ); const { closeCommandMenu } = useCommandMenu(); diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx b/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx index 71ad5a2323..8cd80f65d8 100644 --- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx +++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/hooks/__tests__/useKeyboardShortcutMenu.test.tsx @@ -4,7 +4,7 @@ import { type ReactNode, act } from 'react'; import { RecoilRoot } from 'recoil'; import { isKeyboardShortcutMenuOpenedStateV2 } from '@/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeyboardShortcutMenu'; @@ -36,7 +36,7 @@ const Wrapper = ({ children }: { children: ReactNode }) => ( const renderHookConfig = () => { const { result } = renderHook( () => { - const isKeyboardShortcutMenuOpened = useRecoilValueV2( + const isKeyboardShortcutMenuOpened = useAtomStateValue( isKeyboardShortcutMenuOpenedStateV2, ); return { diff --git a/packages/twenty-front/src/modules/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedStateV2.ts b/packages/twenty-front/src/modules/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedStateV2.ts index da8bb7953b..6f30c2ccfc 100644 --- a/packages/twenty-front/src/modules/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedStateV2.ts +++ b/packages/twenty-front/src/modules/keyboard-shortcut-menu/states/isKeyboardShortcutMenuOpenedStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isKeyboardShortcutMenuOpenedStateV2 = createStateV2({ +export const isKeyboardShortcutMenuOpenedStateV2 = createAtomState({ key: 'keyboard-shortcut-menu/isKeyboardShortcutMenuOpenedStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/localization/hooks/useDateTimeFormat.ts b/packages/twenty-front/src/modules/localization/hooks/useDateTimeFormat.ts index 6fd6168747..5e20b5423a 100644 --- a/packages/twenty-front/src/modules/localization/hooks/useDateTimeFormat.ts +++ b/packages/twenty-front/src/modules/localization/hooks/useDateTimeFormat.ts @@ -1,10 +1,10 @@ import { workspaceMemberFormatPreferencesState } from '@/localization/states/workspaceMemberFormatPreferencesState'; import { resolveDateFormat } from '@/localization/utils/resolveDateFormat'; import { resolveTimeFormat } from '@/localization/utils/resolveTimeFormat'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useDateTimeFormat = () => { - const workspaceMemberFormatPreferences = useRecoilValueV2( + const workspaceMemberFormatPreferences = useAtomStateValue( workspaceMemberFormatPreferencesState, ); diff --git a/packages/twenty-front/src/modules/localization/hooks/useFormatPreferences.ts b/packages/twenty-front/src/modules/localization/hooks/useFormatPreferences.ts index f6dad1f035..4990b99282 100644 --- a/packages/twenty-front/src/modules/localization/hooks/useFormatPreferences.ts +++ b/packages/twenty-front/src/modules/localization/hooks/useFormatPreferences.ts @@ -17,9 +17,9 @@ import { getFormatPreferencesFromWorkspaceMember } from '@/localization/utils/fo import { getWorkspaceMemberUpdateFromFormatPreferences } from '@/localization/utils/format-preferences/getWorkspaceMemberUpdateFromFormatPreferences'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { CalendarStartDay } from 'twenty-shared/constants'; import { logError } from '~/utils/logError'; @@ -29,9 +29,9 @@ export const useFormatPreferences = () => { const [ workspaceMemberFormatPreferences, setWorkspaceMemberFormatPreferences, - ] = useRecoilStateV2(workspaceMemberFormatPreferencesState); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); - const setCurrentWorkspaceMember = useSetRecoilStateV2( + ] = useAtomState(workspaceMemberFormatPreferencesState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); + const setCurrentWorkspaceMember = useSetAtomState( currentWorkspaceMemberState, ); diff --git a/packages/twenty-front/src/modules/localization/hooks/useInitializeFormatPreferences.ts b/packages/twenty-front/src/modules/localization/hooks/useInitializeFormatPreferences.ts index d971a0244e..3798ab4a86 100644 --- a/packages/twenty-front/src/modules/localization/hooks/useInitializeFormatPreferences.ts +++ b/packages/twenty-front/src/modules/localization/hooks/useInitializeFormatPreferences.ts @@ -3,10 +3,10 @@ import { useCallback } from 'react'; import { type CurrentWorkspaceMember } from '@/auth/states/currentWorkspaceMemberState'; import { workspaceMemberFormatPreferencesState } from '@/localization/states/workspaceMemberFormatPreferencesState'; import { getFormatPreferencesFromWorkspaceMember } from '@/localization/utils/format-preferences/getFormatPreferencesFromWorkspaceMember'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useInitializeFormatPreferences = () => { - const setWorkspaceMemberFormatPreferences = useSetRecoilStateV2( + const setWorkspaceMemberFormatPreferences = useSetAtomState( workspaceMemberFormatPreferencesState, ); diff --git a/packages/twenty-front/src/modules/localization/hooks/useNumberFormat.ts b/packages/twenty-front/src/modules/localization/hooks/useNumberFormat.ts index de18f84e97..cf4f600bf9 100644 --- a/packages/twenty-front/src/modules/localization/hooks/useNumberFormat.ts +++ b/packages/twenty-front/src/modules/localization/hooks/useNumberFormat.ts @@ -1,14 +1,14 @@ import { useMemo } from 'react'; import { workspaceMemberFormatPreferencesState } from '@/localization/states/workspaceMemberFormatPreferencesState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { formatNumber as utilFormatNumber, type FormatNumberOptions, } from '~/utils/format/formatNumber'; export const useNumberFormat = () => { - const workspaceMemberFormatPreferences = useRecoilValueV2( + const workspaceMemberFormatPreferences = useAtomStateValue( workspaceMemberFormatPreferencesState, ); diff --git a/packages/twenty-front/src/modules/localization/states/workspaceMemberFormatPreferencesState.ts b/packages/twenty-front/src/modules/localization/states/workspaceMemberFormatPreferencesState.ts index 59847ad96d..75d350264f 100644 --- a/packages/twenty-front/src/modules/localization/states/workspaceMemberFormatPreferencesState.ts +++ b/packages/twenty-front/src/modules/localization/states/workspaceMemberFormatPreferencesState.ts @@ -6,7 +6,7 @@ import { detectDateFormat } from '@/localization/utils/detection/detectDateForma import { detectNumberFormat } from '@/localization/utils/detection/detectNumberFormat'; import { detectTimeFormat } from '@/localization/utils/detection/detectTimeFormat'; import { detectTimeZone } from '@/localization/utils/detection/detectTimeZone'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { CalendarStartDay } from 'twenty-shared/constants'; export type WorkspaceMemberFormatPreferences = { @@ -18,7 +18,7 @@ export type WorkspaceMemberFormatPreferences = { }; export const workspaceMemberFormatPreferencesState = - createStateV2({ + createAtomState({ key: 'workspaceMemberFormatPreferencesState', defaultValue: { timeZone: detectTimeZone(), diff --git a/packages/twenty-front/src/modules/logic-functions/hooks/useExecuteLogicFunction.ts b/packages/twenty-front/src/modules/logic-functions/hooks/useExecuteLogicFunction.ts index bb788d4ac1..634b3711a8 100644 --- a/packages/twenty-front/src/modules/logic-functions/hooks/useExecuteLogicFunction.ts +++ b/packages/twenty-front/src/modules/logic-functions/hooks/useExecuteLogicFunction.ts @@ -1,6 +1,6 @@ import { EXECUTE_ONE_LOGIC_FUNCTION } from '@/logic-functions/graphql/mutations/executeOneLogicFunction'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { logicFunctionTestDataFamilyState } from '@/workflow/workflow-steps/workflow-actions/code-action/states/logicFunctionTestDataFamilyState'; import { useMutation } from '@apollo/client'; import { useState } from 'react'; @@ -38,11 +38,11 @@ export const useExecuteLogicFunction = ({ { input: ExecuteOneLogicFunctionInput } >(EXECUTE_ONE_LOGIC_FUNCTION); - const logicFunctionTestData = useFamilyRecoilValueV2( + const logicFunctionTestData = useAtomFamilyStateValue( logicFunctionTestDataFamilyState, logicFunctionId, ); - const setLogicFunctionTestData = useSetFamilyRecoilStateV2( + const setLogicFunctionTestData = useSetAtomFamilyState( logicFunctionTestDataFamilyState, logicFunctionId, ); diff --git a/packages/twenty-front/src/modules/metadata-store/components/MetadataGater.tsx b/packages/twenty-front/src/modules/metadata-store/components/MetadataGater.tsx index 336647d39c..fcb6767775 100644 --- a/packages/twenty-front/src/modules/metadata-store/components/MetadataGater.tsx +++ b/packages/twenty-front/src/modules/metadata-store/components/MetadataGater.tsx @@ -4,7 +4,7 @@ import { isAppMetadataReadyState } from '@/metadata-store/states/isAppMetadataRe import { useIsLogged } from '@/auth/hooks/useIsLogged'; import { useDateTimeFormat } from '@/localization/hooks/useDateTimeFormat'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { useLocation } from 'react-router-dom'; import { AppPath } from 'twenty-shared/types'; @@ -12,8 +12,8 @@ import { UserOrMetadataLoader } from '~/loading/components/UserOrMetadataLoader' import { isMatchingLocation } from '~/utils/isMatchingLocation'; export const MetadataGater = ({ children }: React.PropsWithChildren) => { - const isAppMetadataReady = useRecoilValueV2(isAppMetadataReadyState); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const isAppMetadataReady = useAtomStateValue(isAppMetadataReadyState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const isLoggedIn = useIsLogged(); const location = useLocation(); diff --git a/packages/twenty-front/src/modules/metadata-store/effect-components/IsAppMetadataReadyEffect.tsx b/packages/twenty-front/src/modules/metadata-store/effect-components/IsAppMetadataReadyEffect.tsx index c710bcb710..e1474b8330 100644 --- a/packages/twenty-front/src/modules/metadata-store/effect-components/IsAppMetadataReadyEffect.tsx +++ b/packages/twenty-front/src/modules/metadata-store/effect-components/IsAppMetadataReadyEffect.tsx @@ -3,20 +3,20 @@ import { currentUserState } from '@/auth/states/currentUserState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { isAppMetadataReadyState } from '@/metadata-store/states/isAppMetadataReadyState'; import { metadataStoreState } from '@/metadata-store/states/metadataStoreState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { isWorkspaceActiveOrSuspended } from 'twenty-shared/workspace'; export const IsAppMetadataReadyEffect = () => { const isLoggedIn = useIsLogged(); - const currentUser = useRecoilValueV2(currentUserState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const objectsEntry = useFamilyRecoilValueV2(metadataStoreState, 'objects'); - const viewsEntry = useFamilyRecoilValueV2(metadataStoreState, 'views'); - const setIsAppMetadataReady = useSetRecoilStateV2(isAppMetadataReadyState); + const currentUser = useAtomStateValue(currentUserState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const objectsEntry = useAtomFamilyStateValue(metadataStoreState, 'objects'); + const viewsEntry = useAtomFamilyStateValue(metadataStoreState, 'views'); + const setIsAppMetadataReady = useSetAtomState(isAppMetadataReadyState); useEffect(() => { const hasActiveWorkspace = isWorkspaceActiveOrSuspended(currentWorkspace); diff --git a/packages/twenty-front/src/modules/metadata-store/effect-components/ObjectMetadataProviderInitialEffect.tsx b/packages/twenty-front/src/modules/metadata-store/effect-components/ObjectMetadataProviderInitialEffect.tsx index c6d2ff7efb..37ac1367e5 100644 --- a/packages/twenty-front/src/modules/metadata-store/effect-components/ObjectMetadataProviderInitialEffect.tsx +++ b/packages/twenty-front/src/modules/metadata-store/effect-components/ObjectMetadataProviderInitialEffect.tsx @@ -4,14 +4,14 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useLoadMockedObjectMetadataItems } from '@/object-metadata/hooks/useLoadMockedObjectMetadataItems'; import { useRefreshObjectMetadataItems } from '@/object-metadata/hooks/useRefreshObjectMetadataItems'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useStore } from 'jotai'; import { useEffect, useState } from 'react'; import { isWorkspaceActiveOrSuspended } from 'twenty-shared/workspace'; export const ObjectMetadataProviderInitialEffect = () => { - const isCurrentUserLoaded = useRecoilValueV2(isCurrentUserLoadedState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const isCurrentUserLoaded = useAtomStateValue(isCurrentUserLoadedState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const store = useStore(); const [isInitialized, setIsInitialized] = useState(false); diff --git a/packages/twenty-front/src/modules/metadata-store/effect-components/UserMetadataProviderInitialEffect.tsx b/packages/twenty-front/src/modules/metadata-store/effect-components/UserMetadataProviderInitialEffect.tsx index a34d602c08..23becbc987 100644 --- a/packages/twenty-front/src/modules/metadata-store/effect-components/UserMetadataProviderInitialEffect.tsx +++ b/packages/twenty-front/src/modules/metadata-store/effect-components/UserMetadataProviderInitialEffect.tsx @@ -9,8 +9,8 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { isCurrentUserLoadedState } from '@/auth/states/isCurrentUserLoadedState'; import { useInitializeFormatPreferences } from '@/localization/hooks/useInitializeFormatPreferences'; import { getDateFnsLocale } from '@/ui/field/display/utils/getDateFnsLocale.util'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type ColorScheme } from '@/workspace-member/types/WorkspaceMember'; import { enUS } from 'date-fns/locale'; import { useStore } from 'jotai'; @@ -27,26 +27,24 @@ import { dynamicActivate } from '~/utils/i18n/dynamicActivate'; export const UserMetadataProviderInitialEffect = () => { const isLoggedIn = useIsLogged(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const store = useStore(); const [isInitialized, setIsInitialized] = useState(false); - const setCurrentUser = useSetRecoilStateV2(currentUserState); - const setCurrentWorkspace = useSetRecoilStateV2(currentWorkspaceState); - const setCurrentUserWorkspace = useSetRecoilStateV2( - currentUserWorkspaceState, - ); - const setAvailableWorkspaces = useSetRecoilStateV2(availableWorkspacesState); - const setCurrentWorkspaceMember = useSetRecoilStateV2( + const setCurrentUser = useSetAtomState(currentUserState); + const setCurrentWorkspace = useSetAtomState(currentWorkspaceState); + const setCurrentUserWorkspace = useSetAtomState(currentUserWorkspaceState); + const setAvailableWorkspaces = useSetAtomState(availableWorkspacesState); + const setCurrentWorkspaceMember = useSetAtomState( currentWorkspaceMemberState, ); - const setCurrentWorkspaceMembers = useSetRecoilStateV2( + const setCurrentWorkspaceMembers = useSetAtomState( currentWorkspaceMembersState, ); - const setCurrentWorkspaceMembersWithDeleted = useSetRecoilStateV2( + const setCurrentWorkspaceMembersWithDeleted = useSetAtomState( currentWorkspaceDeletedMembersState, ); - const setIsCurrentUserLoaded = useSetRecoilStateV2(isCurrentUserLoadedState); + const setIsCurrentUserLoaded = useSetAtomState(isCurrentUserLoadedState); const { initializeFormatPreferences } = useInitializeFormatPreferences(); diff --git a/packages/twenty-front/src/modules/metadata-store/effect-components/ViewMetadataProviderInitialEffect.tsx b/packages/twenty-front/src/modules/metadata-store/effect-components/ViewMetadataProviderInitialEffect.tsx index 6c941a6c62..83d09350b3 100644 --- a/packages/twenty-front/src/modules/metadata-store/effect-components/ViewMetadataProviderInitialEffect.tsx +++ b/packages/twenty-front/src/modules/metadata-store/effect-components/ViewMetadataProviderInitialEffect.tsx @@ -4,7 +4,7 @@ import { isCurrentUserLoadedState } from '@/auth/states/isCurrentUserLoadedState import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { coreViewsState } from '@/views/states/coreViewState'; import { type CoreViewWithRelations } from '@/views/types/CoreViewWithRelations'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useStore } from 'jotai'; import { useCallback, useEffect, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -23,8 +23,8 @@ const INDEX_VIEW_TYPES = [ export const ViewMetadataProviderInitialEffect = () => { const isLoggedIn = useIsLogged(); - const isCurrentUserLoaded = useRecoilValueV2(isCurrentUserLoadedState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const isCurrentUserLoaded = useAtomStateValue(isCurrentUserLoadedState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const store = useStore(); const [isInitialized, setIsInitialized] = useState(false); diff --git a/packages/twenty-front/src/modules/metadata-store/states/isAppMetadataReadyState.ts b/packages/twenty-front/src/modules/metadata-store/states/isAppMetadataReadyState.ts index b7d0eb598a..aec5100ae9 100644 --- a/packages/twenty-front/src/modules/metadata-store/states/isAppMetadataReadyState.ts +++ b/packages/twenty-front/src/modules/metadata-store/states/isAppMetadataReadyState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isAppMetadataReadyState = createStateV2({ +export const isAppMetadataReadyState = createAtomState({ key: 'isAppMetadataReadyState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/metadata-store/states/metadataStoreState.ts b/packages/twenty-front/src/modules/metadata-store/states/metadataStoreState.ts index bca1686377..58a34cc8e6 100644 --- a/packages/twenty-front/src/modules/metadata-store/states/metadataStoreState.ts +++ b/packages/twenty-front/src/modules/metadata-store/states/metadataStoreState.ts @@ -1,4 +1,4 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; export type MetadataLoadStatus = 'empty' | 'draft_pending' | 'loaded'; @@ -27,7 +27,7 @@ const METADATA_LOAD_ENTRY_DEFAULT: MetadataLoadEntry = { status: 'empty', }; -export const metadataStoreState = createFamilyStateV2< +export const metadataStoreState = createAtomFamilyState< MetadataLoadEntry, MetadataKey >({ diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItemFolders.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItemFolders.tsx index c0adb04aac..f71b0d5ca4 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItemFolders.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItemFolders.tsx @@ -9,25 +9,25 @@ import { NavigationMenuItemSkeletonLoader } from '@/navigation-menu-item/compone import { useNavigationMenuItemsByFolder } from '@/navigation-menu-item/hooks/useNavigationMenuItemsByFolder'; import { useSortedNavigationMenuItems } from '@/navigation-menu-item/hooks/useSortedNavigationMenuItems'; import { isNavigationMenuItemFolderCreatingStateV2 } from '@/navigation-menu-item/states/isNavigationMenuItemFolderCreatingStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading'; import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper'; import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection'; import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle'; import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection'; import { isNavigationSectionOpenFamilyState } from '@/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const CurrentWorkspaceMemberNavigationMenuItemFolders = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { navigationMenuItemsSorted } = useSortedNavigationMenuItems(); const { userNavigationMenuItemsByFolder } = useNavigationMenuItemsByFolder(); const [ isNavigationMenuItemFolderCreating, setIsNavigationMenuItemFolderCreating, - ] = useRecoilStateV2(isNavigationMenuItemFolderCreatingStateV2); + ] = useAtomState(isNavigationMenuItemFolderCreatingStateV2); const loading = useIsPrefetchLoading(); @@ -35,7 +35,7 @@ export const CurrentWorkspaceMemberNavigationMenuItemFolders = () => { const { toggleNavigationSection, openNavigationSection } = useNavigationSection('Favorites'); - const isNavigationSectionOpen = useFamilyRecoilValueV2( + const isNavigationSectionOpen = useAtomFamilyStateValue( isNavigationSectionOpenFamilyState, 'Favorites', ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItems.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItems.tsx index 75f3221b1e..30e4da46f0 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItems.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberNavigationMenuItems.tsx @@ -25,12 +25,12 @@ import { useDeleteNavigationMenuItem } from '@/navigation-menu-item/hooks/useDel import { useDeleteNavigationMenuItemFolder } from '@/navigation-menu-item/hooks/useDeleteNavigationMenuItemFolder'; import { useRenameNavigationMenuItemFolder } from '@/navigation-menu-item/hooks/useRenameNavigationMenuItemFolder'; import { openNavigationMenuItemFolderIdsStateV2 } from '@/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { getNavigationMenuItemSecondaryLabel } from '@/navigation-menu-item/utils/getNavigationMenuItemSecondaryLabel'; import { isLocationMatchingNavigationMenuItem } from '@/navigation-menu-item/utils/isLocationMatchingNavigationMenuItem'; import { type ProcessedNavigationMenuItem } from '@/navigation-menu-item/utils/sortNavigationMenuItems'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; @@ -42,9 +42,9 @@ import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/componen import { NavigationDrawerItemsCollapsableContainer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer'; import { NavigationDrawerSubItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem'; import { currentNavigationMenuItemFolderIdStateV2 } from '@/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; @@ -66,7 +66,7 @@ export const CurrentWorkspaceMemberNavigationMenuItems = ({ const { t } = useLingui(); const theme = useTheme(); const iconColors = getNavigationMenuItemIconColors(theme); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const location = useLocation(); const navigate = useNavigate(); const currentPath = location.pathname; @@ -83,9 +83,9 @@ export const CurrentWorkspaceMemberNavigationMenuItems = ({ const isMobile = useIsMobile(); const [openNavigationMenuItemFolderIds, setOpenNavigationMenuItemFolderIds] = - useRecoilStateV2(openNavigationMenuItemFolderIdsStateV2); + useAtomState(openNavigationMenuItemFolderIdsStateV2); - const setCurrentFolderId = useSetRecoilStateV2( + const setCurrentFolderId = useSetAtomState( currentNavigationMenuItemFolderIdStateV2, ); @@ -123,7 +123,7 @@ export const CurrentWorkspaceMemberNavigationMenuItems = ({ const dropdownId = `navigation-menu-item-folder-edit-${folder.id}`; - const isDropdownOpenComponent = useRecoilComponentValueV2( + const isDropdownOpenComponent = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); @@ -194,7 +194,7 @@ export const CurrentWorkspaceMemberNavigationMenuItems = ({ /> ); - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberOrphanNavigationMenuItems.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberOrphanNavigationMenuItems.tsx index efe9ac15f7..400f7d6ff2 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberOrphanNavigationMenuItems.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/CurrentWorkspaceMemberOrphanNavigationMenuItems.tsx @@ -15,7 +15,7 @@ import { useSortedNavigationMenuItems } from '@/navigation-menu-item/hooks/useSo import { getNavigationMenuItemSecondaryLabel } from '@/navigation-menu-item/utils/getNavigationMenuItemSecondaryLabel'; import { isLocationMatchingNavigationMenuItem } from '@/navigation-menu-item/utils/isLocationMatchingNavigationMenuItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem'; @@ -28,7 +28,7 @@ const StyledOrphanNavigationMenuItemsContainer = styled.div` `; export const CurrentWorkspaceMemberOrphanNavigationMenuItems = () => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { navigationMenuItemsSorted } = useSortedNavigationMenuItems(); const { deleteNavigationMenuItem } = useDeleteNavigationMenuItem(); const currentPath = useLocation().pathname; diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx index 7affa185d3..acd78a91c9 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuEditModeBar.tsx @@ -7,8 +7,8 @@ import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/n import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; @@ -41,15 +41,15 @@ export const NavigationMenuEditModeBar = () => { const { getIcon } = useIcons(); const [isSaving, setIsSaving] = useState(false); const { closeCommandMenu } = useCommandMenu(); - const commandMenuPage = useRecoilValueV2(commandMenuPageState); + const commandMenuPage = useAtomStateValue(commandMenuPageState); const { enqueueErrorSnackBar } = useSnackBar(); - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); - const setSelectedNavigationMenuItemInEditMode = useSetRecoilStateV2( + const setSelectedNavigationMenuItemInEditMode = useSetAtomState( selectedNavigationMenuItemInEditModeStateV2, ); - const setIsNavigationMenuInEditMode = useSetRecoilStateV2( + const setIsNavigationMenuInEditMode = useSetAtomState( isNavigationMenuInEditModeStateV2, ); const { saveDraft } = useSaveNavigationMenuItemsDraft(); @@ -67,7 +67,7 @@ export const NavigationMenuEditModeBar = () => { } }; - const isNavigationMenuInEditMode = useRecoilValueV2( + const isNavigationMenuInEditMode = useAtomStateValue( isNavigationMenuInEditModeStateV2, ); const isNavigationMenuItemEditingEnabled = useIsFeatureEnabled( diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx index ea5f876b93..942addb396 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemBackButton.tsx @@ -3,7 +3,7 @@ import styled from '@emotion/styled'; import { IconX } from 'twenty-ui/display'; import { currentNavigationMenuItemFolderIdStateV2 } from '@/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; const StyledBackButton = styled.button` display: flex; @@ -36,7 +36,7 @@ export const NavigationMenuItemBackButton = ({ folderName, }: NavigationMenuItemBackButtonProps) => { const theme = useTheme(); - const setCurrentFolderId = useSetRecoilStateV2( + const setCurrentFolderId = useSetAtomState( currentNavigationMenuItemFolderIdStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolderContent.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolderContent.tsx index 949cc6ab93..7bad322ced 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolderContent.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolderContent.tsx @@ -8,7 +8,7 @@ import { useDeleteNavigationMenuItem } from '@/navigation-menu-item/hooks/useDel import { getNavigationMenuItemSecondaryLabel } from '@/navigation-menu-item/utils/getNavigationMenuItemSecondaryLabel'; import { type ProcessedNavigationMenuItem } from '@/navigation-menu-item/utils/sortNavigationMenuItems'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem'; @@ -23,7 +23,7 @@ export const NavigationMenuItemFolderContent = ({ folderId, navigationMenuItems, }: NavigationMenuItemFolderContentProps) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { deleteNavigationMenuItem } = useDeleteNavigationMenuItem(); return ( diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolders.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolders.tsx index 6ba2e5c4d4..08dc97618d 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolders.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemFolders.tsx @@ -5,7 +5,7 @@ import { CurrentWorkspaceMemberNavigationMenuItems } from '@/navigation-menu-ite import { useCreateNavigationMenuItemFolder } from '@/navigation-menu-item/hooks/useCreateNavigationMenuItemFolder'; import { useNavigationMenuItemsByFolder } from '@/navigation-menu-item/hooks/useNavigationMenuItemsByFolder'; import { isNavigationMenuItemFolderCreatingStateV2 } from '@/navigation-menu-item/states/isNavigationMenuItemFolderCreatingStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper'; import { NavigationDrawerInput } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerInput'; @@ -25,7 +25,7 @@ export const NavigationMenuItemFolders = ({ const [ isNavigationMenuItemFolderCreating, setIsNavigationMenuItemFolderCreating, - ] = useRecoilStateV2(isNavigationMenuItemFolderCreatingStateV2); + ] = useAtomState(isNavigationMenuItemFolderCreatingStateV2); const handleNavigationMenuItemFolderNameChange = (value: string) => { setNewFolderName(value); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemIcon.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemIcon.tsx index e81a2a06aa..741bc86c85 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemIcon.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/NavigationMenuItemIcon.tsx @@ -12,7 +12,7 @@ import { useGetStandardObjectIcon } from '@/object-metadata/hooks/useGetStandard import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { ViewKey } from '@/views/types/ViewKey'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const NavigationMenuItemIcon = ({ navigationMenuItem, @@ -24,7 +24,7 @@ export const NavigationMenuItemIcon = ({ const isNavigationMenuItemEditingEnabled = useIsFeatureEnabled( FeatureFlagKey.IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { Icon: StandardIcon, IconColor } = useGetStandardObjectIcon( navigationMenuItem.objectNameSingular || '', ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx index 630218d417..2e9c33c804 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemFolderDragClone.tsx @@ -10,7 +10,7 @@ import { NavigationMenuItemIcon } from '@/navigation-menu-item/components/Naviga import { getNavigationMenuItemSecondaryLabel } from '@/navigation-menu-item/utils/getNavigationMenuItemSecondaryLabel'; import { type ProcessedNavigationMenuItem } from '@/navigation-menu-item/utils/sortNavigationMenuItems'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { NavigationDrawerSubItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem'; import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment'; import { ViewKey } from '@/views/types/ViewKey'; @@ -33,7 +33,7 @@ export const WorkspaceNavigationMenuItemFolderDragClone = ({ selectedNavigationMenuItemIndex, }: WorkspaceNavigationMenuItemFolderDragCloneProps) => { const theme = useTheme(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const navigationMenuItem = navigationMenuItems[rubric.source.index]; if (!isDefined(navigationMenuItem)) { diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx index 10557df85a..4b5814eb02 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItems.tsx @@ -23,9 +23,9 @@ import { NavigationDrawerSectionForWorkspaceItems } from '@/object-metadata/comp import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading'; import { prefetchNavigationMenuItemsState } from '@/prefetch/states/prefetchNavigationMenuItemsState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useStore } from 'jotai'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { isNonEmptyString } from '@sniptt/guards'; @@ -57,14 +57,14 @@ export const WorkspaceNavigationMenuItems = () => { const isNavigationMenuItemEditingEnabled = useIsFeatureEnabled( FeatureFlagKey.IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED, ); - const isNavigationMenuInEditMode = useRecoilValueV2( + const isNavigationMenuInEditMode = useAtomStateValue( isNavigationMenuInEditModeStateV2, ); const [ selectedNavigationMenuItemInEditMode, setSelectedNavigationMenuItemInEditMode, - ] = useRecoilStateV2(selectedNavigationMenuItemInEditModeStateV2); - const setOpenNavigationMenuItemFolderIds = useSetRecoilStateV2( + ] = useAtomState(selectedNavigationMenuItemInEditModeStateV2); + const setOpenNavigationMenuItemFolderIds = useSetAtomState( openNavigationMenuItemFolderIdsStateV2, ); const navigate = useNavigate(); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx index 4a3932d94b..8adcd62eae 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx +++ b/packages/twenty-front/src/modules/navigation-menu-item/components/WorkspaceNavigationMenuItemsFolder.tsx @@ -26,15 +26,15 @@ import { getObjectMetadataForNavigationMenuItem } from '@/navigation-menu-item/u import { isLocationMatchingNavigationMenuItem } from '@/navigation-menu-item/utils/isLocationMatchingNavigationMenuItem'; import { type ProcessedNavigationMenuItem } from '@/navigation-menu-item/utils/sortNavigationMenuItems'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem'; import { NavigationDrawerItemsCollapsableContainer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer'; import { NavigationDrawerSubItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem'; import { currentNavigationMenuItemFolderIdStateV2 } from '@/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2'; import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { coreViewsState } from '@/views/states/coreViewState'; import { ViewKey } from '@/views/types/ViewKey'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; @@ -98,8 +98,8 @@ export const WorkspaceNavigationMenuItemsFolder = ({ ); const iconColors = getNavigationMenuItemIconColors(theme); const FolderIcon = getIcon(folderIconKey ?? FOLDER_ICON_DEFAULT); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const coreViews = useRecoilValueV2(coreViewsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const coreViews = useAtomStateValue(coreViewsState); const views = coreViews.map(convertCoreViewToView); const location = useLocation(); const navigate = useNavigate(); @@ -108,9 +108,9 @@ export const WorkspaceNavigationMenuItemsFolder = ({ const isMobile = useIsMobile(); const [openNavigationMenuItemFolderIds, setOpenNavigationMenuItemFolderIds] = - useRecoilStateV2(openNavigationMenuItemFolderIdsStateV2); + useAtomState(openNavigationMenuItemFolderIdsStateV2); - const setCurrentFolderId = useSetRecoilStateV2( + const setCurrentFolderId = useSetAtomState( currentNavigationMenuItemFolderIdStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddFolderToNavigationMenuDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddFolderToNavigationMenuDraft.ts index e0a9107dc2..768c5c07e2 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddFolderToNavigationMenuDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddFolderToNavigationMenuDraft.ts @@ -3,11 +3,11 @@ import { isDefined } from 'twenty-shared/utils'; import type { NavigationMenuItem } from '~/generated-metadata/graphql'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { computeInsertIndexAndPosition } from '@/navigation-menu-item/utils/computeInsertIndexAndPosition'; export const useAddFolderToNavigationMenuDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddLinkToNavigationMenuDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddLinkToNavigationMenuDraft.ts index e65c814979..5cf2017b2d 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddLinkToNavigationMenuDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddLinkToNavigationMenuDraft.ts @@ -3,12 +3,12 @@ import { v4 } from 'uuid'; import type { NavigationMenuItem } from '~/generated-metadata/graphql'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { computeInsertIndexAndPosition } from '@/navigation-menu-item/utils/computeInsertIndexAndPosition'; import { normalizeUrl } from '@/navigation-menu-item/utils/normalizeUrl'; export const useAddLinkToNavigationMenuDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddObjectToNavigationMenuDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddObjectToNavigationMenuDraft.ts index b687c9ca6d..fa2c5de0c7 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddObjectToNavigationMenuDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddObjectToNavigationMenuDraft.ts @@ -3,11 +3,11 @@ import { isDefined } from 'twenty-shared/utils'; import type { NavigationMenuItem } from '~/generated-metadata/graphql'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { computeInsertIndexAndPosition } from '@/navigation-menu-item/utils/computeInsertIndexAndPosition'; export const useAddObjectToNavigationMenuDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddRecordToNavigationMenuDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddRecordToNavigationMenuDraft.ts index 7a50fe1801..be6e7f73d1 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddRecordToNavigationMenuDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddRecordToNavigationMenuDraft.ts @@ -4,8 +4,8 @@ import type { NavigationMenuItem } from '~/generated-metadata/graphql'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { computeInsertIndexAndPosition } from '@/navigation-menu-item/utils/computeInsertIndexAndPosition'; type SearchRecord = { @@ -20,10 +20,10 @@ type SearchRecordWithOptionalMetadataId = SearchRecord & { }; export const useAddRecordToNavigationMenuDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const addRecordToDraft = ( searchRecord: SearchRecordWithOptionalMetadataId, diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddViewToNavigationMenuDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddViewToNavigationMenuDraft.ts index 5397193646..fcd45c5be4 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddViewToNavigationMenuDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useAddViewToNavigationMenuDraft.ts @@ -3,11 +3,11 @@ import { isDefined } from 'twenty-shared/utils'; import type { NavigationMenuItem } from '~/generated-metadata/graphql'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { computeInsertIndexAndPosition } from '@/navigation-menu-item/utils/computeInsertIndexAndPosition'; export const useAddViewToNavigationMenuDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useCreateNavigationMenuItem.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useCreateNavigationMenuItem.ts index dafde10510..83c387200d 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useCreateNavigationMenuItem.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useCreateNavigationMenuItem.ts @@ -3,13 +3,13 @@ import { useCreateNavigationMenuItemMutation } from '~/generated-metadata/graphq import { usePrefetchedNavigationMenuItemsData } from '@/navigation-menu-item/hooks/usePrefetchedNavigationMenuItemsData'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; export const useCreateNavigationMenuItem = () => { const { navigationMenuItems, currentWorkspaceMemberId } = usePrefetchedNavigationMenuItemsData(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const [createNavigationMenuItemMutation] = useCreateNavigationMenuItemMutation({ diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useDraftNavigationMenuItems.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useDraftNavigationMenuItems.ts index f87b69b087..6e3733a4fc 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useDraftNavigationMenuItems.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useDraftNavigationMenuItems.ts @@ -1,10 +1,10 @@ import { useNavigationMenuItemsDraftState } from '@/navigation-menu-item/hooks/useNavigationMenuItemsDraftState'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useDraftNavigationMenuItems = () => { const { workspaceNavigationMenuItems } = useNavigationMenuItemsDraftState(); - const navigationMenuItemsDraft = useRecoilValueV2( + const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts index 022ac8da2d..46e30f1177 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleAddToNavigationDrop.ts @@ -18,8 +18,8 @@ import { isNavigationMenuInEditModeStateV2 } from '@/navigation-menu-item/states import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { openNavigationMenuItemFolderIdsStateV2 } from '@/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isWorkspaceDroppableId } from '@/navigation-menu-item/utils/isWorkspaceDroppableId'; import { validateAndExtractWorkspaceFolderId } from '@/navigation-menu-item/utils/validateAndExtractWorkspaceFolderId'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; @@ -35,21 +35,21 @@ export const useHandleAddToNavigationDrop = () => { const { addFolderToDraft } = useAddFolderToNavigationMenuDraft(); const { addLinkToDraft } = useAddLinkToNavigationMenuDraft(); const { workspaceNavigationMenuItems } = useNavigationMenuItemsDraftState(); - const navigationMenuItemsDraft = useRecoilValueV2( + const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftStateV2, ); const { openNavigationMenuItemInCommandMenu } = useOpenNavigationMenuItemInCommandMenu(); const { objectMetadataItems } = useObjectMetadataItems(); - const coreViews = useRecoilValueV2(coreViewsState); + const coreViews = useAtomStateValue(coreViewsState); const { getIcon } = useIcons(); - const setSelectedNavigationMenuItemInEditMode = useSetRecoilStateV2( + const setSelectedNavigationMenuItemInEditMode = useSetAtomState( selectedNavigationMenuItemInEditModeStateV2, ); - const setIsNavigationMenuInEditMode = useSetRecoilStateV2( + const setIsNavigationMenuInEditMode = useSetAtomState( isNavigationMenuInEditModeStateV2, ); - const setOpenNavigationMenuItemFolderIds = useSetRecoilStateV2( + const setOpenNavigationMenuItemFolderIds = useSetAtomState( openNavigationMenuItemFolderIdsStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleNavigationMenuItemDragAndDrop.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleNavigationMenuItemDragAndDrop.ts index ca8c07c94d..88c82b95ba 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleNavigationMenuItemDragAndDrop.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleNavigationMenuItemDragAndDrop.ts @@ -5,7 +5,7 @@ import { isWorkspaceDroppableId } from '@/navigation-menu-item/utils/isWorkspace import { useSortedNavigationMenuItems } from '@/navigation-menu-item/hooks/useSortedNavigationMenuItems'; import { useUpdateNavigationMenuItem } from '@/navigation-menu-item/hooks/useUpdateNavigationMenuItem'; import { openNavigationMenuItemFolderIdsStateV2 } from '@/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { calculateNewPosition } from '@/ui/layout/draggable-list/utils/calculateNewPosition'; import { FOLDER_DROPPABLE_IDS } from '@/ui/layout/draggable-list/utils/folderDroppableIds'; import { validateAndExtractFolderId } from '@/ui/layout/draggable-list/utils/validateAndExtractFolderId'; @@ -16,7 +16,7 @@ export const useHandleNavigationMenuItemDragAndDrop = () => { const { navigationMenuItems } = usePrefetchedNavigationMenuItemsData(); const { navigationMenuItemsSorted } = useSortedNavigationMenuItems(); const { updateNavigationMenuItem } = useUpdateNavigationMenuItem(); - const setOpenNavigationMenuItemFolderIds = useSetRecoilStateV2( + const setOpenNavigationMenuItemFolderIds = useSetAtomState( openNavigationMenuItemFolderIdsStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleWorkspaceNavigationMenuItemDragAndDrop.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleWorkspaceNavigationMenuItemDragAndDrop.ts index 1eecb2044b..984ec1eaaf 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleWorkspaceNavigationMenuItemDragAndDrop.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useHandleWorkspaceNavigationMenuItemDragAndDrop.ts @@ -5,8 +5,8 @@ import { NavigationMenuItemDroppableIds } from '@/navigation-menu-item/constants import { isNavigationMenuInEditModeStateV2 } from '@/navigation-menu-item/states/isNavigationMenuInEditModeStateV2'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { openNavigationMenuItemFolderIdsStateV2 } from '@/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { matchesWorkspaceFolderId, validateAndExtractWorkspaceFolderId, @@ -18,16 +18,16 @@ import { usePrefetchedNavigationMenuItemsData } from './usePrefetchedNavigationM export const useHandleWorkspaceNavigationMenuItemDragAndDrop = () => { const { workspaceNavigationMenuItems } = usePrefetchedNavigationMenuItemsData(); - const isNavigationMenuInEditMode = useRecoilValueV2( + const isNavigationMenuInEditMode = useAtomStateValue( isNavigationMenuInEditModeStateV2, ); - const navigationMenuItemsDraft = useRecoilValueV2( + const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftStateV2, ); - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); - const setOpenNavigationMenuItemFolderIds = useSetRecoilStateV2( + const setOpenNavigationMenuItemFolderIds = useSetAtomState( openNavigationMenuItemFolderIdsStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemMoveRemove.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemMoveRemove.ts index d69d3a04fe..ce1d23324a 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemMoveRemove.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemMoveRemove.ts @@ -2,7 +2,7 @@ import { isDefined } from 'twenty-shared/utils'; import type { NavigationMenuItem } from '~/generated-metadata/graphql'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isNavigationMenuItemFolder } from '@/navigation-menu-item/utils/isNavigationMenuItemFolder'; const swapPositionsInDraft = ( @@ -21,7 +21,7 @@ const swapPositionsInDraft = ( }); export const useNavigationMenuItemMoveRemove = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsByFolder.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsByFolder.ts index a4352211c5..51cbadb8d7 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsByFolder.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsByFolder.ts @@ -8,7 +8,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { type ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { usePrefetchedNavigationMenuItemsData } from './usePrefetchedNavigationMenuItemsData'; @@ -19,8 +19,8 @@ type NavigationMenuItemFolder = { }; export const useNavigationMenuItemsByFolder = () => { - const coreViews = useRecoilValueV2(coreViewsState); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const coreViews = useAtomStateValue(coreViewsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { navigationMenuItems, workspaceNavigationMenuItems } = usePrefetchedNavigationMenuItemsData(); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsDraftState.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsDraftState.ts index f5d2125ac2..b7a85dc31a 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsDraftState.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuItemsDraftState.ts @@ -5,16 +5,16 @@ import { isNavigationMenuInEditModeStateV2 } from '@/navigation-menu-item/states import { filterWorkspaceNavigationMenuItems } from '@/navigation-menu-item/utils/filterWorkspaceNavigationMenuItems'; import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { prefetchNavigationMenuItemsState } from '@/prefetch/states/prefetchNavigationMenuItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useNavigationMenuItemsDraftState = () => { - const isNavigationMenuInEditMode = useRecoilValueV2( + const isNavigationMenuInEditMode = useAtomStateValue( isNavigationMenuInEditModeStateV2, ); - const prefetchNavigationMenuItems = useRecoilValueV2( + const prefetchNavigationMenuItems = useAtomStateValue( prefetchNavigationMenuItemsState, ); - const navigationMenuItemsDraft = useRecoilValueV2( + const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuObjectMetadataFromDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuObjectMetadataFromDraft.ts index 5a1945ac0e..93324647b4 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuObjectMetadataFromDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useNavigationMenuObjectMetadataFromDraft.ts @@ -1,6 +1,6 @@ import { isDefined } from 'twenty-shared/utils'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { ViewKey } from '@/views/types/ViewKey'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; @@ -14,7 +14,7 @@ type NavigationMenuItemDraft = { export const useNavigationMenuObjectMetadataFromDraft = ( currentDraft: NavigationMenuItemDraft[], ) => { - const coreViews = useRecoilValueV2(coreViewsState); + const coreViews = useAtomStateValue(coreViewsState); const views = coreViews.map(convertCoreViewToView); const objectMetadataIdsInWorkspace = currentDraft.reduce>( diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/usePrefetchedNavigationMenuItemsData.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/usePrefetchedNavigationMenuItemsData.ts index 3dbfe77cc1..e5e0d397df 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/usePrefetchedNavigationMenuItemsData.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/usePrefetchedNavigationMenuItemsData.ts @@ -3,7 +3,7 @@ import { isNavigationMenuInEditModeStateV2 } from '@/navigation-menu-item/states import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { filterWorkspaceNavigationMenuItems } from '@/navigation-menu-item/utils/filterWorkspaceNavigationMenuItems'; import { prefetchNavigationMenuItemsState } from '@/prefetch/states/prefetchNavigationMenuItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { type NavigationMenuItem } from '~/generated-metadata/graphql'; @@ -16,17 +16,17 @@ type PrefetchedNavigationMenuItemsData = { export const usePrefetchedNavigationMenuItemsData = (): PrefetchedNavigationMenuItemsData => { - const currentWorkspaceMember = useRecoilValueV2( + const currentWorkspaceMember = useAtomStateValue( currentWorkspaceMemberState, ); const currentWorkspaceMemberId = currentWorkspaceMember?.id; - const prefetchNavigationMenuItems = useRecoilValueV2( + const prefetchNavigationMenuItems = useAtomStateValue( prefetchNavigationMenuItemsState, ); - const isNavigationMenuInEditMode = useRecoilValueV2( + const isNavigationMenuInEditMode = useAtomStateValue( isNavigationMenuInEditModeStateV2, ); - const navigationMenuItemsDraft = useRecoilValueV2( + const navigationMenuItemsDraft = useAtomStateValue( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useRemoveNavigationMenuItemByTargetRecordId.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useRemoveNavigationMenuItemByTargetRecordId.ts index 2e41f2cde0..81e284ca02 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useRemoveNavigationMenuItemByTargetRecordId.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useRemoveNavigationMenuItemByTargetRecordId.ts @@ -3,7 +3,7 @@ import { useCallback } from 'react'; import { FIND_MANY_NAVIGATION_MENU_ITEMS } from '@/navigation-menu-item/graphql/queries/findManyNavigationMenuItems'; import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; import { prefetchNavigationMenuItemsState } from '@/prefetch/states/prefetchNavigationMenuItemsState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; import { useStore } from 'jotai'; @@ -12,7 +12,7 @@ export const useRemoveNavigationMenuItemByTargetRecordId = () => { const apolloCoreClient = useApolloCoreClient(); const cache = apolloCoreClient.cache; - const setNavigationMenuItemsState = useSetRecoilStateV2( + const setNavigationMenuItemsState = useSetAtomState( prefetchNavigationMenuItemsState, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem.ts index c6f705b410..40af3bab1c 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem.ts @@ -1,9 +1,9 @@ import { useWorkspaceSectionItems } from '@/navigation-menu-item/hooks/useWorkspaceSectionItems'; import { selectedNavigationMenuItemInEditModeStateV2 } from '@/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useSelectedNavigationMenuItemEditItem = () => { - const selectedNavigationMenuItemInEditMode = useRecoilValueV2( + const selectedNavigationMenuItemInEditMode = useAtomStateValue( selectedNavigationMenuItemInEditModeStateV2, ); const items = useWorkspaceSectionItems(); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItemObjectMetadata.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItemObjectMetadata.ts index ae9efc73b8..2f45707e07 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItemObjectMetadata.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItemObjectMetadata.ts @@ -1,13 +1,13 @@ import { useSelectedNavigationMenuItemEditItem } from '@/navigation-menu-item/hooks/useSelectedNavigationMenuItemEditItem'; import { getObjectMetadataForNavigationMenuItem } from '@/navigation-menu-item/utils/getObjectMetadataForNavigationMenuItem'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; export const useSelectedNavigationMenuItemEditItemObjectMetadata = () => { const { selectedItem } = useSelectedNavigationMenuItemEditItem(); - const coreViews = useRecoilValueV2(coreViewsState); + const coreViews = useAtomStateValue(coreViewsState); const views = coreViews.map(convertCoreViewToView); const { objectMetadataItems } = useObjectMetadataItems(); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSortedNavigationMenuItems.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSortedNavigationMenuItems.ts index 86703cab1f..f9110579d7 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSortedNavigationMenuItems.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useSortedNavigationMenuItems.ts @@ -9,15 +9,17 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { type ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { usePrefetchedNavigationMenuItemsData } from './usePrefetchedNavigationMenuItemsData'; export const useSortedNavigationMenuItems = () => { const { navigationMenuItems, workspaceNavigationMenuItems } = usePrefetchedNavigationMenuItemsData(); - const coreViews = useRecoilValueV2(coreViewsState).map(convertCoreViewToView); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const coreViews = useAtomStateValue(coreViewsState).map( + convertCoreViewToView, + ); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const targetRecordIdentifiers = useMemo(() => { const identifiersMap = new Map(); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderInDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderInDraft.ts index d0e7e0367b..37f5cd1490 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderInDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderInDraft.ts @@ -1,6 +1,6 @@ import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; import { isNavigationMenuItemFolder } from '@/navigation-menu-item/utils/isNavigationMenuItemFolder'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export type UpdateFolderInDraftUpdates = { name?: string; @@ -8,7 +8,7 @@ export type UpdateFolderInDraftUpdates = { }; export const useUpdateFolderInDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderNameInDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderNameInDraft.ts index b43517ff71..3b878a350b 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderNameInDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateFolderNameInDraft.ts @@ -1,9 +1,9 @@ import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isNavigationMenuItemFolder } from '@/navigation-menu-item/utils/isNavigationMenuItemFolder'; export const useUpdateFolderNameInDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateLinkInDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateLinkInDraft.ts index b985a09807..d8d5ce97a4 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateLinkInDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateLinkInDraft.ts @@ -1,9 +1,9 @@ import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isNavigationMenuItemLink } from '@/navigation-menu-item/utils/isNavigationMenuItemLink'; export const useUpdateLinkInDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateNavigationMenuItemInDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateNavigationMenuItemInDraft.ts index 1b2b82f8b3..8b31a0fd3d 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateNavigationMenuItemInDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateNavigationMenuItemInDraft.ts @@ -1,5 +1,5 @@ import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export type UpdateNavigationMenuItemInDraftUpdates = { color?: string; @@ -9,7 +9,7 @@ export type UpdateNavigationMenuItemInDraftUpdates = { }; export const useUpdateNavigationMenuItemInDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateViewInDraft.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateViewInDraft.ts index c4a190d942..025fba171d 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateViewInDraft.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useUpdateViewInDraft.ts @@ -1,9 +1,9 @@ import { navigationMenuItemsDraftStateV2 } from '@/navigation-menu-item/states/navigationMenuItemsDraftStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type View } from '@/views/types/View'; export const useUpdateViewInDraft = () => { - const setNavigationMenuItemsDraft = useSetRecoilStateV2( + const setNavigationMenuItemsDraft = useSetAtomState( navigationMenuItemsDraftStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceNavigationMenuItems.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceNavigationMenuItems.ts index 9a469ade70..c4de38bdbf 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceNavigationMenuItems.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceNavigationMenuItems.ts @@ -3,7 +3,7 @@ import { useMemo } from 'react'; import { isNavigationMenuItemFolder } from '@/navigation-menu-item/utils/isNavigationMenuItemFolder'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; @@ -15,7 +15,7 @@ export const useWorkspaceNavigationMenuItems = (): { } => { const { workspaceNavigationMenuItems: rawWorkspaceNavigationMenuItems } = usePrefetchedNavigationMenuItemsData(); - const coreViews = useRecoilValueV2(coreViewsState); + const coreViews = useAtomStateValue(coreViewsState); const views = coreViews.map(convertCoreViewToView); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceSectionItems.ts b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceSectionItems.ts index cc7ee89ab6..268533df43 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceSectionItems.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/hooks/useWorkspaceSectionItems.ts @@ -10,7 +10,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; import { isDefined } from 'twenty-shared/utils'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useNavigationMenuItemsByFolder } from './useNavigationMenuItemsByFolder'; import { usePrefetchedNavigationMenuItemsData } from './usePrefetchedNavigationMenuItemsData'; @@ -34,8 +34,8 @@ export const useWorkspaceSectionItems = (): FlatWorkspaceItem[] => { const { workspaceNavigationMenuItemsSorted } = useSortedNavigationMenuItems(); const { workspaceNavigationMenuItemsByFolder } = useNavigationMenuItemsByFolder(); - const coreViews = useRecoilValueV2(coreViewsState); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const coreViews = useAtomStateValue(coreViewsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const views = coreViews.map(convertCoreViewToView); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/states/addMenuItemInsertionContextStateV2.ts b/packages/twenty-front/src/modules/navigation-menu-item/states/addMenuItemInsertionContextStateV2.ts index 60d5303674..a775ae6ce4 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/states/addMenuItemInsertionContextStateV2.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/states/addMenuItemInsertionContextStateV2.ts @@ -1,9 +1,9 @@ import type { AddMenuItemInsertionContext } from '@/navigation-menu-item/types/AddMenuItemInsertionContext'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const addMenuItemInsertionContextStateV2 = - createStateV2({ + createAtomState({ key: 'addMenuItemInsertionContextStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/states/addToNavPayloadRegistryStateV2.ts b/packages/twenty-front/src/modules/navigation-menu-item/states/addToNavPayloadRegistryStateV2.ts index 57b6585e13..8b1d7ad0dd 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/states/addToNavPayloadRegistryStateV2.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/states/addToNavPayloadRegistryStateV2.ts @@ -1,8 +1,8 @@ import type { AddToNavigationDragPayload } from '@/navigation-menu-item/types/add-to-navigation-drag-payload'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const addToNavPayloadRegistryStateV2 = createStateV2< +export const addToNavPayloadRegistryStateV2 = createAtomState< Map >({ key: 'navigation-menu-item/addToNavPayloadRegistryStateV2', diff --git a/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuInEditModeStateV2.ts b/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuInEditModeStateV2.ts index 2dff03a783..873197fd05 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuInEditModeStateV2.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuInEditModeStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isNavigationMenuInEditModeStateV2 = createStateV2({ +export const isNavigationMenuInEditModeStateV2 = createAtomState({ key: 'isNavigationMenuInEditModeStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuItemFolderCreatingStateV2.ts b/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuItemFolderCreatingStateV2.ts index 7749922767..8e14f1e803 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuItemFolderCreatingStateV2.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/states/isNavigationMenuItemFolderCreatingStateV2.ts @@ -1,8 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isNavigationMenuItemFolderCreatingStateV2 = createStateV2( - { +export const isNavigationMenuItemFolderCreatingStateV2 = + createAtomState({ key: 'isNavigationMenuItemFolderCreatingStateV2', defaultValue: false, - }, -); + }); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/states/navigationMenuItemsDraftStateV2.ts b/packages/twenty-front/src/modules/navigation-menu-item/states/navigationMenuItemsDraftStateV2.ts index de168dfdbb..9af4537660 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/states/navigationMenuItemsDraftStateV2.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/states/navigationMenuItemsDraftStateV2.ts @@ -1,8 +1,8 @@ import { type NavigationMenuItem } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const navigationMenuItemsDraftStateV2 = createStateV2< +export const navigationMenuItemsDraftStateV2 = createAtomState< NavigationMenuItem[] | null >({ key: 'navigationMenuItemsDraftStateV2', diff --git a/packages/twenty-front/src/modules/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2.ts b/packages/twenty-front/src/modules/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2.ts index 31af63fa0f..b214c937b6 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/states/openNavigationMenuItemFolderIdsStateV2.ts @@ -1,6 +1,8 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const openNavigationMenuItemFolderIdsStateV2 = createStateV2({ - key: 'openNavigationMenuItemFolderIdsStateV2', - defaultValue: [], -}); +export const openNavigationMenuItemFolderIdsStateV2 = createAtomState( + { + key: 'openNavigationMenuItemFolderIdsStateV2', + defaultValue: [], + }, +); diff --git a/packages/twenty-front/src/modules/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2.ts b/packages/twenty-front/src/modules/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2.ts index 5faac7e785..afef648540 100644 --- a/packages/twenty-front/src/modules/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2.ts +++ b/packages/twenty-front/src/modules/navigation-menu-item/states/selectedNavigationMenuItemInEditModeStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const selectedNavigationMenuItemInEditModeStateV2 = createStateV2< +export const selectedNavigationMenuItemInEditModeStateV2 = createAtomState< string | null >({ key: 'selectedNavigationMenuItemInEditModeStateV2', diff --git a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawer.tsx b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawer.tsx index 2a1779fa11..d7ad313d83 100644 --- a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawer.tsx +++ b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawer.tsx @@ -10,7 +10,7 @@ import { NavigationDrawerFixedContent } from '@/ui/navigation/navigation-drawer/ import { NavigationDrawerScrollableContent } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerScrollableContent'; import { currentFavoriteFolderIdStateV2 } from '@/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdStateV2'; import { currentNavigationMenuItemFolderIdStateV2 } from '@/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; @@ -20,11 +20,11 @@ const StyledScrollableContent = styled.div` `; export const MainNavigationDrawer = ({ className }: { className?: string }) => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const currentFavoriteFolderId = useRecoilValueV2( + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const currentFavoriteFolderId = useAtomStateValue( currentFavoriteFolderIdStateV2, ); - const currentNavigationMenuItemFolderId = useRecoilValueV2( + const currentNavigationMenuItemFolderId = useAtomStateValue( currentNavigationMenuItemFolderIdStateV2, ); const { favoritesByFolder } = useFavoritesByFolder(); diff --git a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx index 9e0fb294e8..e2b7625ebc 100644 --- a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx +++ b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerFixedItems.tsx @@ -4,8 +4,8 @@ import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/componen import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; import { navigationDrawerExpandedMemorizedStateV2 } from '@/ui/navigation/states/navigationDrawerExpandedMemorizedStateV2'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useLingui } from '@lingui/react/macro'; import { useLocation, useNavigate } from 'react-router-dom'; @@ -18,13 +18,13 @@ import { FeatureFlagKey } from '~/generated-metadata/graphql'; export const MainNavigationDrawerFixedItems = () => { const isMobile = useIsMobile(); const location = useLocation(); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] = - useRecoilStateV2(isNavigationDrawerExpandedState); - const setNavigationDrawerExpandedMemorized = useSetRecoilStateV2( + useAtomState(isNavigationDrawerExpandedState); + const setNavigationDrawerExpandedMemorized = useSetAtomState( navigationDrawerExpandedMemorizedStateV2, ); diff --git a/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx b/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx index 2629b7e50d..d03b002ee8 100644 --- a/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx +++ b/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx @@ -7,9 +7,9 @@ import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePat import { useOpenSettingsMenu } from '@/navigation/hooks/useOpenSettings'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useNavigate } from 'react-router-dom'; import { type IconComponent, @@ -26,23 +26,22 @@ type NavigationBarItemName = 'main' | 'search' | 'tasks' | 'settings'; export const MobileNavigationBar = () => { const navigate = useNavigate(); const { defaultHomePagePath } = useDefaultHomePagePath(); - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); const { closeCommandMenu } = useCommandMenu(); const { openRecordsSearchPage } = useOpenRecordsSearchPageInCommandMenu(); const isSettingsPage = useIsSettingsPage(); const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] = - useRecoilStateV2(isNavigationDrawerExpandedState); + useAtomState(isNavigationDrawerExpandedState); const [currentMobileNavigationDrawer, setCurrentMobileNavigationDrawer] = - useRecoilStateV2(currentMobileNavigationDrawerState); + useAtomState(currentMobileNavigationDrawerState); const { openSettingsMenu } = useOpenSettingsMenu(); const { alphaSortedActiveNonSystemObjectMetadataItems } = useFilteredObjectMetadataItems(); - const [, setContextStoreCurrentObjectMetadataItemId] = - useRecoilComponentStateV2( - contextStoreCurrentObjectMetadataItemIdComponentState, - MAIN_CONTEXT_STORE_INSTANCE_ID, - ); + const [, setContextStoreCurrentObjectMetadataItemId] = useAtomComponentState( + contextStoreCurrentObjectMetadataItemIdComponentState, + MAIN_CONTEXT_STORE_INSTANCE_ID, + ); const activeItemName = isNavigationDrawerExpanded ? currentMobileNavigationDrawer diff --git a/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawer.tsx b/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawer.tsx index 6998be37bd..36a149dc80 100644 --- a/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawer.tsx +++ b/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawer.tsx @@ -3,7 +3,7 @@ import { NavigationDrawer } from '@/ui/navigation/navigation-drawer/components/N import { NavigationDrawerFixedContent } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerFixedContent'; import { NavigationDrawerScrollableContent } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerScrollableContent'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useLingui } from '@lingui/react/macro'; import { AdvancedSettingsToggle } from 'twenty-ui/navigation'; @@ -13,7 +13,7 @@ export const SettingsNavigationDrawer = ({ className?: string; }) => { const { t } = useLingui(); - const [isAdvancedModeEnabled, setIsAdvancedModeEnabled] = useRecoilStateV2( + const [isAdvancedModeEnabled, setIsAdvancedModeEnabled] = useAtomState( isAdvancedModeEnabledState, ); diff --git a/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsx b/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsx index c6ae399654..d240643268 100644 --- a/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsx +++ b/packages/twenty-front/src/modules/navigation/components/__stories__/AppNavigationDrawer.stories.tsx @@ -4,7 +4,7 @@ import { MemoryRouter } from 'react-router-dom'; import { currentMobileNavigationDrawerState } from '@/navigation/states/currentMobileNavigationDrawerState'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator'; import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator'; @@ -22,10 +22,10 @@ const MobileNavigationDrawerStateSetterEffect = ({ mobileNavigationDrawer?: 'main' | 'settings'; }) => { const isMobile = useIsMobile(); - const setIsNavigationDrawerExpanded = useSetRecoilStateV2( + const setIsNavigationDrawerExpanded = useSetAtomState( isNavigationDrawerExpandedState, ); - const setCurrentMobileNavigationDrawer = useSetRecoilStateV2( + const setCurrentMobileNavigationDrawer = useSetAtomState( currentMobileNavigationDrawerState, ); diff --git a/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts b/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts index 5293538d11..6426660de3 100644 --- a/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts +++ b/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts @@ -7,7 +7,7 @@ import { currentUserState } from '@/auth/states/currentUserState'; import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePath'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations'; import { coreViewsState } from '@/views/states/coreViewState'; @@ -42,11 +42,11 @@ const renderHooks = ({ const { result } = renderHook( () => { - const setCurrentUser = useSetRecoilStateV2(currentUserState); - const setCurrentUserWorkspace = useSetRecoilStateV2( + const setCurrentUser = useSetAtomState(currentUserState); + const setCurrentUserWorkspace = useSetAtomState( currentUserWorkspaceState, ); - const setCoreViews = useSetRecoilStateV2(coreViewsState); + const setCoreViews = useSetAtomState(coreViewsState); useEffect(() => { if (withExistingView) { diff --git a/packages/twenty-front/src/modules/navigation/hooks/useDefaultHomePagePath.ts b/packages/twenty-front/src/modules/navigation/hooks/useDefaultHomePagePath.ts index b4b7c3961c..c3bbc5f191 100644 --- a/packages/twenty-front/src/modules/navigation/hooks/useDefaultHomePagePath.ts +++ b/packages/twenty-front/src/modules/navigation/hooks/useDefaultHomePagePath.ts @@ -4,7 +4,7 @@ import { type ObjectPathInfo } from '@/navigation/types/ObjectPathInfo'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; import { getObjectPermissionsFromMapByObjectMetadataId } from '@/settings/roles/role-permissions/objects-permissions/utils/getObjectPermissionsFromMapByObjectMetadataId'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; import isEmpty from 'lodash.isempty'; @@ -15,7 +15,7 @@ import { useStore } from 'jotai'; export const useDefaultHomePagePath = () => { const store = useStore(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); const { alphaSortedActiveNonSystemObjectMetadataItems } = @@ -43,7 +43,7 @@ export const useDefaultHomePagePath = () => { [readableAlphaSortedActiveNonSystemObjectMetadataItems], ); - const coreViews = useRecoilValueV2(coreViewsState); + const coreViews = useAtomStateValue(coreViewsState); const getFirstView = useCallback( (objectMetadataItemId: string | undefined | null) => { diff --git a/packages/twenty-front/src/modules/navigation/hooks/useIsSettingsDrawer.ts b/packages/twenty-front/src/modules/navigation/hooks/useIsSettingsDrawer.ts index 1a063d9f81..07adcb0f97 100644 --- a/packages/twenty-front/src/modules/navigation/hooks/useIsSettingsDrawer.ts +++ b/packages/twenty-front/src/modules/navigation/hooks/useIsSettingsDrawer.ts @@ -1,12 +1,12 @@ import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage'; import { currentMobileNavigationDrawerState } from '@/navigation/states/currentMobileNavigationDrawerState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; export const useIsSettingsDrawer = () => { const isMobile = useIsMobile(); const isSettingsPage = useIsSettingsPage(); - const currentMobileNavigationDrawer = useRecoilValueV2( + const currentMobileNavigationDrawer = useAtomStateValue( currentMobileNavigationDrawerState, ); return isMobile diff --git a/packages/twenty-front/src/modules/navigation/hooks/useLastVisitedView.ts b/packages/twenty-front/src/modules/navigation/hooks/useLastVisitedView.ts index 036f3ec69f..1b549455de 100644 --- a/packages/twenty-front/src/modules/navigation/hooks/useLastVisitedView.ts +++ b/packages/twenty-front/src/modules/navigation/hooks/useLastVisitedView.ts @@ -1,9 +1,9 @@ import { lastVisitedViewPerObjectMetadataItemState } from '@/navigation/states/lastVisitedViewPerObjectMetadataItemState'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useLastVisitedView = () => { - const lastVisitedViewPerObjectMetadataItem = useRecoilValueV2( + const lastVisitedViewPerObjectMetadataItem = useAtomStateValue( lastVisitedViewPerObjectMetadataItemState, ); diff --git a/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts b/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts index 04f6b7b934..92ee5c1de9 100644 --- a/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts +++ b/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts @@ -1,12 +1,12 @@ import { currentMobileNavigationDrawerState } from '@/navigation/states/currentMobileNavigationDrawerState'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useOpenSettingsMenu = () => { - const setIsNavigationDrawerExpanded = useSetRecoilStateV2( + const setIsNavigationDrawerExpanded = useSetAtomState( isNavigationDrawerExpandedState, ); - const setCurrentMobileNavigationDrawer = useSetRecoilStateV2( + const setCurrentMobileNavigationDrawer = useSetAtomState( currentMobileNavigationDrawerState, ); diff --git a/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.ts b/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.ts index a061df527b..4891a8f260 100644 --- a/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.ts +++ b/packages/twenty-front/src/modules/navigation/states/currentMobileNavigationDrawerState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentMobileNavigationDrawerState = createStateV2< +export const currentMobileNavigationDrawerState = createAtomState< 'main' | 'settings' >({ key: 'currentMobileNavigationDrawerState', diff --git a/packages/twenty-front/src/modules/navigation/states/lastVisitedObjectMetadataItemIdState.ts b/packages/twenty-front/src/modules/navigation/states/lastVisitedObjectMetadataItemIdState.ts index 2776ef5f17..05ee418ea9 100644 --- a/packages/twenty-front/src/modules/navigation/states/lastVisitedObjectMetadataItemIdState.ts +++ b/packages/twenty-front/src/modules/navigation/states/lastVisitedObjectMetadataItemIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const lastVisitedObjectMetadataItemIdState = createStateV2< +export const lastVisitedObjectMetadataItemIdState = createAtomState< string | null >({ key: 'lastVisitedObjectMetadataItemIdState', diff --git a/packages/twenty-front/src/modules/navigation/states/lastVisitedViewPerObjectMetadataItemState.ts b/packages/twenty-front/src/modules/navigation/states/lastVisitedViewPerObjectMetadataItemState.ts index b16b1ab915..a39fea4261 100644 --- a/packages/twenty-front/src/modules/navigation/states/lastVisitedViewPerObjectMetadataItemState.ts +++ b/packages/twenty-front/src/modules/navigation/states/lastVisitedViewPerObjectMetadataItemState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const lastVisitedViewPerObjectMetadataItemState = createStateV2 | null>({ diff --git a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerItemForObjectMetadataItem.tsx b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerItemForObjectMetadataItem.tsx index 1faed4126f..c47bbf2edc 100644 --- a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerItemForObjectMetadataItem.tsx +++ b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerItemForObjectMetadataItem.tsx @@ -11,13 +11,13 @@ import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/componen import { NavigationDrawerItemsCollapsableContainer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer'; import { NavigationDrawerSubItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem'; import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewsFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreViewsFromObjectMetadataItemFamilySelector'; import { ViewKey } from '@/views/types/ViewKey'; import { useTheme } from '@emotion/react'; import { useLocation } from 'react-router-dom'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { AppPath } from 'twenty-shared/types'; import { getAppPath, isDefined } from 'twenty-shared/utils'; import { Avatar, useIcons } from 'twenty-ui/display'; @@ -50,16 +50,16 @@ export const NavigationDrawerItemForObjectMetadataItem = ({ FeatureFlagKey.IS_NAVIGATION_MENU_ITEM_EDITING_ENABLED, ); const iconColors = getNavigationMenuItemIconColors(theme); - const lastVisitedViewPerObjectMetadataItem = useRecoilValueV2( + const lastVisitedViewPerObjectMetadataItem = useAtomStateValue( lastVisitedViewPerObjectMetadataItemState, ); - const views = useFamilySelectorValueV2( + const views = useAtomFamilySelectorValue( coreViewsFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx index c65dd7cbd8..aa308265f3 100644 --- a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx +++ b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx @@ -8,7 +8,7 @@ import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/compo import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle'; import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection'; import { isNavigationSectionOpenFamilyState } from '@/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; const ORDERED_FIRST_STANDARD_OBJECTS: string[] = [ @@ -48,7 +48,7 @@ export const NavigationDrawerSectionForObjectMetadataItems = ({ }: NavigationDrawerSectionForObjectMetadataItemsProps) => { const navigationSectionId = 'Objects' + (isRemote ? 'Remote' : 'Workspace'); const { toggleNavigationSection } = useNavigationSection(navigationSectionId); - const isNavigationSectionOpen = useFamilyRecoilValueV2( + const isNavigationSectionOpen = useAtomFamilyStateValue( isNavigationSectionOpenFamilyState, navigationSectionId, ); diff --git a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForWorkspaceItems.tsx b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForWorkspaceItems.tsx index cea8c4c35f..ae7bc999b0 100644 --- a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForWorkspaceItems.tsx +++ b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForWorkspaceItems.tsx @@ -26,7 +26,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { getObjectPermissionsForObject } from '@/object-metadata/utils/getObjectPermissionsForObject'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableItem'; import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper'; import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem'; @@ -71,11 +71,11 @@ export const NavigationDrawerSectionForWorkspaceItems = ({ const workspaceDropDisabled = useIsDropDisabledForSection(true); const { toggleNavigationSection, isNavigationSectionOpen } = useNavigationSection('Workspace'); - const coreViews = useRecoilValueV2(coreViewsState); + const coreViews = useAtomStateValue(coreViewsState); const views = coreViews.map(convertCoreViewToView); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { isDragging } = useContext(NavigationMenuItemDragContext); const { addToNavigationFallbackDestination } = useContext( NavigationDropTargetContext, diff --git a/packages/twenty-front/src/modules/object-metadata/components/PreComputedChipGeneratorsProvider.tsx b/packages/twenty-front/src/modules/object-metadata/components/PreComputedChipGeneratorsProvider.tsx index 1374b81dfa..76e83956fa 100644 --- a/packages/twenty-front/src/modules/object-metadata/components/PreComputedChipGeneratorsProvider.tsx +++ b/packages/twenty-front/src/modules/object-metadata/components/PreComputedChipGeneratorsProvider.tsx @@ -1,7 +1,7 @@ import React, { useMemo } from 'react'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { PreComputedChipGeneratorsContext } from '@/object-metadata/contexts/PreComputedChipGeneratorsContext'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { getRecordChipGenerators } from '@/object-record/utils/getRecordChipGenerators'; @@ -11,8 +11,8 @@ import { FeatureFlagKey } from '~/generated-metadata/graphql'; export const PreComputedChipGeneratorsProvider = ({ children, }: React.PropsWithChildren) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); const isFilesFieldMigrated = useIsFeatureEnabled( diff --git a/packages/twenty-front/src/modules/object-metadata/components/RemoteNavigationDrawerSection.tsx b/packages/twenty-front/src/modules/object-metadata/components/RemoteNavigationDrawerSection.tsx index 3c3a0e4d35..a1d66a0648 100644 --- a/packages/twenty-front/src/modules/object-metadata/components/RemoteNavigationDrawerSection.tsx +++ b/packages/twenty-front/src/modules/object-metadata/components/RemoteNavigationDrawerSection.tsx @@ -3,12 +3,12 @@ import { NavigationDrawerSectionForObjectMetadataItems } from '@/object-metadata import { NavigationDrawerSectionForObjectMetadataItemsSkeletonLoader } from '@/object-metadata/components/NavigationDrawerSectionForObjectMetadataItemsSkeletonLoader'; import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilteredObjectMetadataItems'; import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { isDefined } from 'twenty-shared/utils'; export const RemoteNavigationDrawerSection = () => { - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const { t } = useLingui(); const { activeNonSystemObjectMetadataItems } = diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts index eb0db541c1..c759c5d9bc 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useColumnDefinitionsFromObjectMetadata.ts @@ -7,20 +7,20 @@ import { filterAvailableTableColumns } from '@/object-record/utils/filterAvailab import { availableFieldMetadataItemsForFilterFamilySelector } from '@/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector'; import { availableFieldMetadataItemsForSortFamilySelector } from '@/object-metadata/states/availableFieldMetadataItemsForSortFamilySelector'; import { formatFieldMetadataItemAsColumnDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsColumnDefinition'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useMemo } from 'react'; export const useColumnDefinitionsFromObjectMetadata = ( objectMetadataItem: ObjectMetadataItem, ) => { - const filterableFieldMetadataItems = useFamilySelectorValueV2( + const filterableFieldMetadataItems = useAtomFamilySelectorValue( availableFieldMetadataItemsForFilterFamilySelector, { objectMetadataItemId: objectMetadataItem.id, }, ); - const sortableFieldMetadataItems = useFamilySelectorValueV2( + const sortableFieldMetadataItems = useAtomFamilySelectorValue( availableFieldMetadataItemsForSortFamilySelector, { objectMetadataItemId: objectMetadataItem.id, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts index 894c7758ce..5dd2d0cf01 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts @@ -8,8 +8,8 @@ import { recordIndexGroupAggregateFieldMetadataItemComponentState } from '@/obje import { recordIndexGroupAggregateOperationComponentState } from '@/object-record/record-index/states/recordIndexGroupAggregateOperationComponentState'; import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useRefreshCoreViewsByObjectMetadataId } from '@/views/hooks/useRefreshCoreViewsByObjectMetadataId'; import { ApolloError } from '@apollo/client'; import { t } from '@lingui/core/macro'; @@ -27,18 +27,18 @@ export const useDeleteOneFieldMetadataItem = () => { const { handleMetadataError } = useMetadataErrorHandler(); const { enqueueErrorSnackBar } = useSnackBar(); - const setRecordIndexGroupAggregateOperation = useSetRecoilComponentStateV2( + const setRecordIndexGroupAggregateOperation = useSetAtomComponentState( recordIndexGroupAggregateOperationComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const recordIndexGroupAggregateFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupAggregateFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupAggregateFieldMetadataItemComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); const setRecordIndexGroupAggregateFieldMetadataItem = - useSetRecoilComponentStateV2( + useSetAtomComponentState( recordIndexGroupAggregateFieldMetadataItemComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useDoObjectMetadataItemsExist.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useDoObjectMetadataItemsExist.ts index daca4641d9..0bca6268b5 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useDoObjectMetadataItemsExist.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useDoObjectMetadataItemsExist.ts @@ -1,11 +1,11 @@ import { objectMetadataItemsBySingularNameSelector } from '@/object-metadata/states/objectMetadataItemsBySingularNameSelector'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const useDoObjectMetadataItemsExist = ( objectNameSingulars: string[], ) => { - const objectMetadataItems = useFamilySelectorValueV2( + const objectMetadataItems = useAtomFamilySelectorValue( objectMetadataItemsBySingularNameSelector, objectNameSingulars, ); diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemById.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemById.ts index 5323a2637c..6219b873ba 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemById.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemById.ts @@ -1,9 +1,9 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { getFieldMetadataItemById } from '@/object-metadata/utils/getFieldMetadataItemById'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useFieldMetadataItemById = (fieldMetadataId: string) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); return getFieldMetadataItemById({ fieldMetadataId, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemByIdOrThrow.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemByIdOrThrow.ts index 9f100d66dd..9a67e99d43 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemByIdOrThrow.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useFieldMetadataItemByIdOrThrow.ts @@ -1,9 +1,9 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { getFieldMetadataItemByIdOrThrow } from '@/object-metadata/utils/getFieldMetadataItemByIdOrThrow'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useFieldMetadataItemByIdOrThrow = (fieldMetadataId: string) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); return getFieldMetadataItemByIdOrThrow({ fieldMetadataId, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts index a4e6d653ad..2b43e70510 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts @@ -1,9 +1,9 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { useMemo } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useFilteredObjectMetadataItems = () => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const activeNonSystemObjectMetadataItems = useMemo( () => diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectMetadataItemById.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectMetadataItemById.ts index 87e253378b..32d26dc842 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectMetadataItemById.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectMetadataItemById.ts @@ -1,9 +1,9 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CustomError, isDefined } from 'twenty-shared/utils'; export const useGetObjectMetadataItemById = () => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const getObjectMetadataItemById = (objectId: string) => { const objectMetadataItem = objectMetadataItems.find( diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectRecordIdentifierByNameSingular.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectRecordIdentifierByNameSingular.ts index e6c1a8809b..e5860929d4 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectRecordIdentifierByNameSingular.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useGetObjectRecordIdentifierByNameSingular.ts @@ -1,12 +1,12 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getObjectRecordIdentifier } from '@/object-metadata/utils/getObjectRecordIdentifier'; import { type ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier'; export const useGetObjectRecordIdentifierByNameSingular = ( allowRequestsToTwentyIcons: boolean, ) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); return (record: any, objectNameSingular: string): ObjectRecordIdentifier => { const objectMetadataItem = objectMetadataItems.find( diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts index 3d8b00a2fd..9e6b31a3ce 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts @@ -1,8 +1,8 @@ import { ObjectMetadataItemNotFoundError } from '@/object-metadata/errors/ObjectMetadataNotFoundError'; import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { type ObjectMetadataItemIdentifier } from '@/object-metadata/types/ObjectMetadataItemIdentifier'; @@ -10,7 +10,7 @@ import { type ObjectMetadataItemIdentifier } from '@/object-metadata/types/Objec export const useObjectMetadataItem = ({ objectNameSingular, }: ObjectMetadataItemIdentifier) => { - const objectMetadataItem = useFamilySelectorValueV2( + const objectMetadataItem = useAtomFamilySelectorValue( objectMetadataItemFamilySelector, { objectName: objectNameSingular, @@ -18,7 +18,7 @@ export const useObjectMetadataItem = ({ }, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); if (!isDefined(objectMetadataItem)) { throw new ObjectMetadataItemNotFoundError( diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemById.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemById.ts index e19d93dc37..11d4868015 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemById.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemById.ts @@ -1,5 +1,5 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CustomError, isDefined } from 'twenty-shared/utils'; export const useObjectMetadataItemById = ({ @@ -7,7 +7,7 @@ export const useObjectMetadataItemById = ({ }: { objectId: string; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => objectMetadataItem.id === objectId, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItems.ts index 536bd713ad..12d2cfabc0 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItems.ts @@ -1,9 +1,9 @@ -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; export const useObjectMetadataItems = () => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); return { objectMetadataItems, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts index 5b489b9ee2..6ed870763c 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts @@ -1,5 +1,5 @@ import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const useObjectNamePluralFromSingular = ({ @@ -7,7 +7,7 @@ export const useObjectNamePluralFromSingular = ({ }: { objectNameSingular: string; }) => { - const objectMetadataItem = useFamilySelectorValueV2( + const objectMetadataItem = useAtomFamilySelectorValue( objectMetadataItemFamilySelector, { objectName: objectNameSingular, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts index 2223d9231e..cd4cb8c9f1 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts @@ -1,5 +1,5 @@ import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const useObjectNameSingularFromPlural = ({ @@ -7,7 +7,7 @@ export const useObjectNameSingularFromPlural = ({ }: { objectNamePlural: string; }) => { - const objectMetadataItem = useFamilySelectorValueV2( + const objectMetadataItem = useAtomFamilySelectorValue( objectMetadataItemFamilySelector, { objectName: objectNamePlural, diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.ts index 0c27ffae2c..60e03594ff 100644 --- a/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.ts +++ b/packages/twenty-front/src/modules/object-metadata/hooks/useUpdateOneFieldMetadataItem.ts @@ -9,7 +9,7 @@ import { lastFieldMetadataItemUpdateState } from '@/object-metadata/states/lastF import { type MetadataRequestResult } from '@/object-metadata/types/MetadataRequestResult.type'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { useRefreshCoreViewsByObjectMetadataId } from '@/views/hooks/useRefreshCoreViewsByObjectMetadataId'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { ApolloError } from '@apollo/client'; import { t } from '@lingui/core/macro'; import { CrudOperationType } from 'twenty-shared/types'; @@ -29,7 +29,7 @@ export const useUpdateOneFieldMetadataItem = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const setLastFieldMetadataItemUpdate = useSetRecoilStateV2( + const setLastFieldMetadataItemUpdate = useSetAtomState( lastFieldMetadataItemUpdateState, ); diff --git a/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts b/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts index feaaf835f6..f0f64ebc37 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts @@ -2,42 +2,42 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { getFilterFilterableFieldMetadataItems } from '@/object-metadata/utils/getFilterFilterableFieldMetadataItems'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { checkIfFeatureFlagIsEnabledOnWorkspace } from '@/workspace/utils/checkIfFeatureFlagIsEnabledOnWorkspace'; import { isDefined } from 'twenty-shared/utils'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; export const availableFieldMetadataItemsForFilterFamilySelector = - createFamilySelectorV2( - { - key: 'availableFieldMetadataItemsForFilterFamilySelector', - get: - ({ objectMetadataItemId }: { objectMetadataItemId: string }) => - ({ get }) => { - const currentWorkspace = get(currentWorkspaceState); - const objectMetadataItems = get(objectMetadataItemsState); + createAtomFamilySelector< + FieldMetadataItem[], + { objectMetadataItemId: string } + >({ + key: 'availableFieldMetadataItemsForFilterFamilySelector', + get: + ({ objectMetadataItemId }: { objectMetadataItemId: string }) => + ({ get }) => { + const currentWorkspace = get(currentWorkspaceState); + const objectMetadataItems = get(objectMetadataItemsState); - const objectMetadataItem = objectMetadataItems.find( - (item) => item.id === objectMetadataItemId, - ); - if (!isDefined(objectMetadataItem)) { - return []; - } + const objectMetadataItem = objectMetadataItems.find( + (item) => item.id === objectMetadataItemId, + ); + if (!isDefined(objectMetadataItem)) { + return []; + } - const isJsonFeatureFlagEnabled = - checkIfFeatureFlagIsEnabledOnWorkspace( - FeatureFlagKey.IS_JSON_FILTER_ENABLED, - currentWorkspace, - ); + const isJsonFeatureFlagEnabled = checkIfFeatureFlagIsEnabledOnWorkspace( + FeatureFlagKey.IS_JSON_FILTER_ENABLED, + currentWorkspace, + ); - const filterFilterableFieldMetadataItems = - getFilterFilterableFieldMetadataItems({ - isJsonFilterEnabled: isJsonFeatureFlagEnabled, - }); + const filterFilterableFieldMetadataItems = + getFilterFilterableFieldMetadataItems({ + isJsonFilterEnabled: isJsonFeatureFlagEnabled, + }); - return objectMetadataItem.readableFields.filter( - filterFilterableFieldMetadataItems, - ); - }, - }, - ); + return objectMetadataItem.readableFields.filter( + filterFilterableFieldMetadataItems, + ); + }, + }); diff --git a/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForSortFamilySelector.ts b/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForSortFamilySelector.ts index db609a94b8..1c86c74552 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForSortFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForSortFamilySelector.ts @@ -1,29 +1,30 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { filterSortableFieldMetadataItems } from '@/object-metadata/utils/filterSortableFieldMetadataItems'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { isDefined } from 'twenty-shared/utils'; export const availableFieldMetadataItemsForSortFamilySelector = - createFamilySelectorV2( - { - key: 'availableFieldMetadataItemsForSortFamilySelector', - get: - ({ objectMetadataItemId }: { objectMetadataItemId: string }) => - ({ get }) => { - const objectMetadataItems = get(objectMetadataItemsState); + createAtomFamilySelector< + FieldMetadataItem[], + { objectMetadataItemId: string } + >({ + key: 'availableFieldMetadataItemsForSortFamilySelector', + get: + ({ objectMetadataItemId }: { objectMetadataItemId: string }) => + ({ get }) => { + const objectMetadataItems = get(objectMetadataItemsState); - const objectMetadataItem = objectMetadataItems.find( - (item) => item.id === objectMetadataItemId, - ); + const objectMetadataItem = objectMetadataItems.find( + (item) => item.id === objectMetadataItemId, + ); - if (!isDefined(objectMetadataItem)) { - return []; - } + if (!isDefined(objectMetadataItem)) { + return []; + } - return objectMetadataItem.readableFields.filter( - filterSortableFieldMetadataItems, - ); - }, - }, - ); + return objectMetadataItem.readableFields.filter( + filterSortableFieldMetadataItems, + ); + }, + }); diff --git a/packages/twenty-front/src/modules/object-metadata/states/fieldMetadataItemByIdSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/fieldMetadataItemByIdSelector.ts index 8be1d00a64..8fe8aee9e2 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/fieldMetadataItemByIdSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/fieldMetadataItemByIdSelector.ts @@ -1,9 +1,9 @@ import { flattenedFieldMetadataItemsSelector } from '@/object-metadata/states/flattenedFieldMetadataItemsSelector'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { findById, isDefined } from 'twenty-shared/utils'; -export const fieldMetadataItemByIdSelector = createFamilySelectorV2({ +export const fieldMetadataItemByIdSelector = createAtomFamilySelector({ key: 'fieldMetadataItemByIdSelector', get: ({ fieldMetadataItemId }: { fieldMetadataItemId: string }) => diff --git a/packages/twenty-front/src/modules/object-metadata/states/flattenedFieldMetadataItemsSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/flattenedFieldMetadataItemsSelector.ts index aa08c01a2e..a5c89ff7ef 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/flattenedFieldMetadataItemsSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/flattenedFieldMetadataItemsSelector.ts @@ -1,8 +1,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; -export const flattenedFieldMetadataItemsSelector = createSelectorV2< +export const flattenedFieldMetadataItemsSelector = createAtomSelector< FieldMetadataItem[] >({ key: 'flattenedFieldMetadataItemsSelector', diff --git a/packages/twenty-front/src/modules/object-metadata/states/flattenedReadableFieldMetadataItemIdsSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/flattenedReadableFieldMetadataItemIdsSelector.ts index e025980723..ce698344e1 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/flattenedReadableFieldMetadataItemIdsSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/flattenedReadableFieldMetadataItemIdsSelector.ts @@ -1,8 +1,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; -export const flattenedReadableFieldMetadataItemsSelector = createSelectorV2< +export const flattenedReadableFieldMetadataItemsSelector = createAtomSelector< FieldMetadataItem[] >({ key: 'flattenedReadableFieldMetadataItemsSelector', diff --git a/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemFilterableAndSortableSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemFilterableAndSortableSelector.ts index 4262d0dbd5..b0e4cba175 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemFilterableAndSortableSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemFilterableAndSortableSelector.ts @@ -2,11 +2,11 @@ import { availableFieldMetadataItemsForFilterFamilySelector } from '@/object-met import { availableFieldMetadataItemsForSortFamilySelector } from '@/object-metadata/states/availableFieldMetadataItemsForSortFamilySelector'; import { flattenedFieldMetadataItemsSelector } from '@/object-metadata/states/flattenedFieldMetadataItemsSelector'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { findById, isDefined } from 'twenty-shared/utils'; export const isFieldMetadataItemFilterableAndSortableSelector = - createFamilySelectorV2({ + createAtomFamilySelector({ key: 'isFieldMetadataItemFilterableAndSortableSelector', get: ({ fieldMetadataItemId }: { fieldMetadataItemId: string }) => diff --git a/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemLabelIdentifierSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemLabelIdentifierSelector.ts index 4ac9f68e0c..8ab417daea 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemLabelIdentifierSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/isFieldMetadataItemLabelIdentifierSelector.ts @@ -1,10 +1,10 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { isLabelIdentifierField } from '@/object-metadata/utils/isLabelIdentifierField'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { findById, isDefined } from 'twenty-shared/utils'; export const isFieldMetadataItemLabelIdentifierSelector = - createFamilySelectorV2({ + createAtomFamilySelector({ key: 'isFieldMetadataItemLabelIdentifierSelector', get: ({ fieldMetadataItemId }: { fieldMetadataItemId: string }) => diff --git a/packages/twenty-front/src/modules/object-metadata/states/labelIdentifierFieldMetadataItemSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/labelIdentifierFieldMetadataItemSelector.ts index 75f5071d25..3825573ec6 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/labelIdentifierFieldMetadataItemSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/labelIdentifierFieldMetadataItemSelector.ts @@ -1,28 +1,30 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { isLabelIdentifierField } from '@/object-metadata/utils/isLabelIdentifierField'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { isDefined } from 'twenty-shared/utils'; -export const labelIdentifierFieldMetadataItemSelector = createFamilySelectorV2({ - key: 'labelIdentifierFieldMetadataItemSelector', - get: - ({ objectMetadataItemId }: { objectMetadataItemId: string }) => - ({ get }) => { - const objectMetadataItems = get(objectMetadataItemsState); +export const labelIdentifierFieldMetadataItemSelector = + createAtomFamilySelector({ + key: 'labelIdentifierFieldMetadataItemSelector', + get: + ({ objectMetadataItemId }: { objectMetadataItemId: string }) => + ({ get }) => { + const objectMetadataItems = get(objectMetadataItemsState); - const objectMetadataItem = objectMetadataItems.find( - (objectMetadataItem) => objectMetadataItem.id === objectMetadataItemId, - ); + const objectMetadataItem = objectMetadataItems.find( + (objectMetadataItem) => + objectMetadataItem.id === objectMetadataItemId, + ); - if (!isDefined(objectMetadataItem)) { - return undefined; - } + if (!isDefined(objectMetadataItem)) { + return undefined; + } - return objectMetadataItem.fields.find((fieldMetadataItemToFind) => - isLabelIdentifierField({ - fieldMetadataItem: fieldMetadataItemToFind, - objectMetadataItem: objectMetadataItem, - }), - ); - }, -}); + return objectMetadataItem.fields.find((fieldMetadataItemToFind) => + isLabelIdentifierField({ + fieldMetadataItem: fieldMetadataItemToFind, + objectMetadataItem: objectMetadataItem, + }), + ); + }, + }); diff --git a/packages/twenty-front/src/modules/object-metadata/states/lastFieldMetadataItemUpdateState.ts b/packages/twenty-front/src/modules/object-metadata/states/lastFieldMetadataItemUpdateState.ts index f6a7c42608..8acdf70aba 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/lastFieldMetadataItemUpdateState.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/lastFieldMetadataItemUpdateState.ts @@ -1,8 +1,8 @@ import type { FieldMetadataItemUpdate } from '@/object-metadata/types/FieldMetadataItemUpdate'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const lastFieldMetadataItemUpdateState = - createStateV2({ + createAtomState({ key: 'lastFieldMetadataItemUpdateState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemFamilySelector.ts b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemFamilySelector.ts index c0e57e00c1..12c98acb40 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemFamilySelector.ts @@ -1,13 +1,13 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; type ObjectMetadataItemSelector = { objectName: string; objectNameType: 'singular' | 'plural'; }; -export const objectMetadataItemFamilySelector = createFamilySelectorV2< +export const objectMetadataItemFamilySelector = createAtomFamilySelector< ObjectMetadataItem | null, ObjectMetadataItemSelector >({ diff --git a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNamePluralMapSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNamePluralMapSelector.ts index 6365c9d689..3a68ef631d 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNamePluralMapSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNamePluralMapSelector.ts @@ -1,8 +1,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; -export const objectMetadataItemsByNamePluralMapSelector = createSelectorV2< +export const objectMetadataItemsByNamePluralMapSelector = createAtomSelector< Map >({ key: 'objectMetadataItemsByNamePluralMapSelector', diff --git a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNameSingularMapSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNameSingularMapSelector.ts index d1db30c0b7..4b9c210703 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNameSingularMapSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsByNameSingularMapSelector.ts @@ -1,8 +1,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; -export const objectMetadataItemsByNameSingularMapSelector = createSelectorV2< +export const objectMetadataItemsByNameSingularMapSelector = createAtomSelector< Map >({ key: 'objectMetadataItemsByNameSingularMapSelector', diff --git a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsBySingularNameSelector.ts b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsBySingularNameSelector.ts index 0d8ecbbd7d..fddd3e4c7f 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsBySingularNameSelector.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsBySingularNameSelector.ts @@ -1,26 +1,24 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { isDefined } from 'twenty-shared/utils'; -export const objectMetadataItemsBySingularNameSelector = createFamilySelectorV2< - ObjectMetadataItem[], - string[] ->({ - key: 'objectMetadataItemsSelector', - get: - (objectNameSingulars: string[]) => - ({ get }) => { - const objectMetadataItems = get(objectMetadataItemsState); +export const objectMetadataItemsBySingularNameSelector = + createAtomFamilySelector({ + key: 'objectMetadataItemsSelector', + get: + (objectNameSingulars: string[]) => + ({ get }) => { + const objectMetadataItems = get(objectMetadataItemsState); - return objectNameSingulars - .map( - (objectNameSingular) => - objectMetadataItems.find( - (objectMetadataItem) => - objectMetadataItem.nameSingular === objectNameSingular, - ) ?? null, - ) - .filter(isDefined); - }, -}); + return objectNameSingulars + .map( + (objectNameSingular) => + objectMetadataItems.find( + (objectMetadataItem) => + objectMetadataItem.nameSingular === objectNameSingular, + ) ?? null, + ) + .filter(isDefined); + }, + }); diff --git a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.ts b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.ts index f87ebe95fe..30e11b7fc6 100644 --- a/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.ts +++ b/packages/twenty-front/src/modules/object-metadata/states/objectMetadataItemsState.ts @@ -1,7 +1,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const objectMetadataItemsState = createStateV2({ +export const objectMetadataItemsState = createAtomState({ key: 'objectMetadataItemsState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer.tsx index 3b41c4beea..f941945553 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer.tsx @@ -8,7 +8,7 @@ import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/co import { rootLevelRecordFilterGroupComponentSelector } from '@/object-record/advanced-filter/states/rootLevelRecordFilterGroupComponentSelector'; import { isRecordFilterGroupChildARecordFilterGroup } from '@/object-record/advanced-filter/utils/isRecordFilterGroupChildARecordFilterGroup'; import { type VariablePickerComponent } from '@/object-record/record-field/ui/form-types/types/VariablePickerComponent'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -41,7 +41,7 @@ export const AdvancedFilterCommandMenuContainer = ({ VariablePicker, isWorkflowFindRecords, }: AdvancedFilterCommandMenuContainerProps) => { - const rootRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton.tsx index 97452879f9..5345462be9 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuCreateRootFilterButton.tsx @@ -5,10 +5,10 @@ import { rootLevelRecordFilterGroupComponentSelector } from '@/object-record/adv import { useUpsertRecordFilterGroup } from '@/object-record/record-filter-group/hooks/useUpsertRecordFilterGroup'; import { useCreateEmptyRecordFilterFromFieldMetadataItem } from '@/object-record/record-filter/hooks/useCreateEmptyRecordFilterFromFieldMetadataItem'; import { useUpsertRecordFilter } from '@/object-record/record-filter/hooks/useUpsertRecordFilter'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentFamilyStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState'; import { hasInitializedCurrentRecordFiltersComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; import { RecordFilterGroupLogicalOperator } from 'twenty-shared/types'; @@ -23,11 +23,11 @@ export const AdvancedFilterCommandMenuCreateRootFilterButton = ({ objectMetadataItem: ObjectMetadataItem; }) => { const { readonly } = useContext(AdvancedFilterContext); - const rootRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); - const availableFieldMetadataItemsForFilter = useFamilySelectorValueV2( + const availableFieldMetadataItemsForFilter = useAtomFamilySelectorValue( availableFieldMetadataItemsForFilterFamilySelector, { objectMetadataItemId: objectMetadataItem.id, @@ -48,11 +48,10 @@ export const AdvancedFilterCommandMenuCreateRootFilterButton = ({ const { createEmptyRecordFilterFromFieldMetadataItem } = useCreateEmptyRecordFilterFromFieldMetadataItem(); - const setHasInitializedCurrentRecordFilters = - useSetRecoilComponentFamilyStateV2( - hasInitializedCurrentRecordFiltersComponentFamilyState, - {}, - ); + const setHasInitializedCurrentRecordFilters = useSetAtomComponentFamilyState( + hasInitializedCurrentRecordFiltersComponentFamilyState, + {}, + ); const addRootRecordFilterGroup = () => { const alreadyHasAdvancedFilterGroup = isDefined(rootRecordFilterGroup); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect.tsx index 246ec36ded..49eb6b4a90 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuRecordFilterOperandSelect.tsx @@ -4,7 +4,7 @@ import { getOperandLabel } from '@/object-record/object-filter-dropdown/utils/ge import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { getRecordFilterOperands } from '@/object-record/record-filter/utils/getRecordFilterOperands'; import { SelectControl } from '@/ui/input/components/SelectControl'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -17,7 +17,7 @@ export const AdvancedFilterCommandMenuRecordFilterOperandSelect = ({ recordFilterId, }: AdvancedFilterCommandMenuRecordFilterOperandSelectProps) => { const { readonly, isWorkflowFindRecords } = useContext(AdvancedFilterContext); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput.tsx index 800739a94a..c669535be7 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormCompositeFieldInput.tsx @@ -9,7 +9,7 @@ import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/c import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { CURRENCIES } from '@/settings/data-model/constants/Currencies'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { FieldActorSource } from 'twenty-shared/types'; import { type SelectOption } from 'twenty-ui/input'; @@ -33,7 +33,7 @@ export const AdvancedFilterCommandMenuValueFormCompositeFieldInput = ({ }) => { const { VariablePicker } = useContext(AdvancedFilterContext); - const subFieldNameUsedInDropdown = useRecoilComponentValueV2( + const subFieldNameUsedInDropdown = useAtomComponentStateValue( subFieldNameUsedInDropdownComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput.tsx index de4d02fe54..7d54223493 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuValueFormInput.tsx @@ -19,8 +19,8 @@ import { } from '@/object-record/record-field/ui/types/FieldMetadata'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { RecordFilterOperand } from '@/object-record/record-filter/types/RecordFilterOperand'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { stringifyRelativeDateFilter } from '@/views/view-filter-value/utils/stringifyRelativeDateFilter'; import { WORKFLOW_TIMEZONE } from '@/workflow/constants/WorkflowTimeZone'; import { useFeatureFlagsMap } from '@/workspace/hooks/useFeatureFlagsMap'; @@ -43,14 +43,14 @@ export const AdvancedFilterCommandMenuValueFormInput = ({ isWorkflowFindRecords, } = useContext(AdvancedFilterContext); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); const dropdownInstanceId = getAdvancedFilterObjectFilterDropdownComponentInstanceId(recordFilterId); - const subFieldNameUsedInDropdown = useRecoilComponentValueV2( + const subFieldNameUsedInDropdown = useAtomComponentStateValue( subFieldNameUsedInDropdownComponentState, dropdownInstanceId, ); @@ -91,7 +91,7 @@ export const AdvancedFilterCommandMenuValueFormInput = ({ applyObjectFilterDropdownFilterValue(stringifyRelativeDateFilter(newValue)); }; - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, dropdownInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownFilterInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownFilterInput.tsx index 8a7fbd1831..d484a39b09 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownFilterInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownFilterInput.tsx @@ -19,7 +19,7 @@ import { isFilterOnActorWorkspaceMemberSubField } from '@/object-record/object-f import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldMetadataType } from 'twenty-shared/types'; import { isExpectedSubFieldName } from 'twenty-shared/utils'; @@ -32,7 +32,7 @@ export const AdvancedFilterDropdownFilterInput = ({ filterDropdownId, recordFilter, }: AdvancedFilterDropdownFilterInputProps) => { - const subFieldNameUsedInDropdown = useRecoilComponentValueV2( + const subFieldNameUsedInDropdown = useAtomComponentStateValue( subFieldNameUsedInDropdownComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownNumberInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownNumberInput.tsx index f5d5ed916a..cb8fd3d877 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownNumberInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownNumberInput.tsx @@ -3,16 +3,16 @@ import { useObjectFilterDropdownFilterValue } from '@/object-record/object-filte import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector'; import { selectedOperandInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState'; import { TextInput } from '@/ui/input/components/TextInput'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; export const AdvancedFilterDropdownNumberInput = () => { - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectDropdownContent.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectDropdownContent.tsx index d47e7abd46..0c37640650 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectDropdownContent.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectDropdownContent.tsx @@ -1,7 +1,7 @@ import { AdvancedFilterFieldSelectMenu } from '@/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu'; import { AdvancedFilterSubFieldSelectMenu } from '@/object-record/advanced-filter/components/AdvancedFilterSubFieldSelectMenu'; import { objectFilterDropdownIsSelectingCompositeFieldComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownIsSelectingCompositeFieldComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; type AdvancedFilterFieldSelectDropdownContentProps = { recordFilterId: string; @@ -10,10 +10,9 @@ type AdvancedFilterFieldSelectDropdownContentProps = { export const AdvancedFilterFieldSelectDropdownContent = ({ recordFilterId, }: AdvancedFilterFieldSelectDropdownContentProps) => { - const [objectFilterDropdownIsSelectingCompositeField] = - useRecoilComponentStateV2( - objectFilterDropdownIsSelectingCompositeFieldComponentState, - ); + const [objectFilterDropdownIsSelectingCompositeField] = useAtomComponentState( + objectFilterDropdownIsSelectingCompositeFieldComponentState, + ); const shouldShowCompositeSelectionSubMenu = objectFilterDropdownIsSelectingCompositeField; diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx index d03e9295ea..cc9d8431a0 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectMenu.tsx @@ -6,7 +6,7 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { AdvancedFilterFieldSelectSearchInput } from '@/object-record/advanced-filter/components/AdvancedFilterFieldSelectSearchInput'; @@ -23,8 +23,8 @@ import { useFilterableFieldMetadataItems } from '@/object-record/record-filter/h import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuSectionLabel } from '@/ui/layout/dropdown/components/DropdownMenuSectionLabel'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useLingui } from '@lingui/react/macro'; import { useContext } from 'react'; import { getFilterTypeFromFieldType } from 'twenty-shared/utils'; @@ -41,7 +41,7 @@ export const AdvancedFilterFieldSelectMenu = ({ advancedFilterFieldSelectDropdownId, } = useAdvancedFilterFieldSelectDropdown(recordFilterId); - const [objectFilterDropdownSearchInput] = useRecoilComponentStateV2( + const [objectFilterDropdownSearchInput] = useAtomComponentState( objectFilterDropdownSearchInputComponentState, advancedFilterFieldSelectDropdownId, ); @@ -51,7 +51,7 @@ export const AdvancedFilterFieldSelectMenu = ({ const { filterableFieldMetadataItems: filterableFieldMetadataItems } = useFilterableFieldMetadataItems(objectMetadataItem.id); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); @@ -91,18 +91,18 @@ export const AdvancedFilterFieldSelectMenu = ({ const { selectFieldUsedInAdvancedFilterDropdown } = useSelectFieldUsedInAdvancedFilterDropdown(); - const [, setObjectFilterDropdownSubMenuFieldType] = useRecoilComponentStateV2( + const [, setObjectFilterDropdownSubMenuFieldType] = useAtomComponentState( objectFilterDropdownSubMenuFieldTypeComponentState, advancedFilterFieldSelectDropdownId, ); const [, setObjectFilterDropdownIsSelectingCompositeField] = - useRecoilComponentStateV2( + useAtomComponentState( objectFilterDropdownIsSelectingCompositeFieldComponentState, advancedFilterFieldSelectDropdownId, ); - const setFieldMetadataItemIdUsedInDropdown = useSetRecoilComponentStateV2( + const setFieldMetadataItemIdUsedInDropdown = useSetAtomComponentState( fieldMetadataItemIdUsedInDropdownComponentState, advancedFilterFieldSelectDropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectSearchInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectSearchInput.tsx index 769701cb9f..76622cda4b 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectSearchInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterFieldSelectSearchInput.tsx @@ -1,5 +1,5 @@ import { objectFilterDropdownSearchInputComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -31,7 +31,7 @@ export const StyledInput = styled.input` export const AdvancedFilterFieldSelectSearchInput = () => { const [objectFilterDropdownSearchInput, setObjectFilterDropdownSearchInput] = - useRecoilComponentStateV2(objectFilterDropdownSearchInputComponentState); + useAtomComponentState(objectFilterDropdownSearchInputComponentState); return ( { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx index d14e53037b..b75f4dd108 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent.tsx @@ -16,7 +16,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; import { type ViewFilterOperand } from 'twenty-shared/types'; @@ -48,7 +48,7 @@ export const AdvancedFilterRecordFilterOperandSelectContent = ({ applyObjectFilterDropdownOperand(operand); }; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOptionsDropdown.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOptionsDropdown.tsx index 66dbba4a85..f32cb131fc 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOptionsDropdown.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRecordFilterOptionsDropdown.tsx @@ -10,7 +10,7 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; import { IconDotsVertical, IconTrash } from 'twenty-ui/display'; @@ -31,7 +31,7 @@ export const AdvancedFilterRecordFilterOptionsDropdown = ({ const { removeRecordFilter } = useRemoveRecordFilter(); const { removeRecordFilterGroup } = useRemoveRecordFilterGroup(); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRootRecordFilterGroup.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRootRecordFilterGroup.tsx index 2e36b02975..fb0c3d66d8 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRootRecordFilterGroup.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterRootRecordFilterGroup.tsx @@ -10,7 +10,7 @@ import { rootLevelRecordFilterGroupComponentSelector } from '@/object-record/adv import { isRecordFilterGroupChildARecordFilterGroup } from '@/object-record/advanced-filter/utils/isRecordFilterGroupChildARecordFilterGroup'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -24,7 +24,7 @@ const StyledContainer = styled.div` `; export const AdvancedFilterRootRecordFilterGroup = () => { - const rootRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterSubFieldSelectMenu.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterSubFieldSelectMenu.tsx index 3393d12fc9..ae4995cf76 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterSubFieldSelectMenu.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterSubFieldSelectMenu.tsx @@ -1,8 +1,8 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; @@ -37,21 +37,19 @@ export const AdvancedFilterSubFieldSelectMenu = ({ }: AdvancedFilterSubFieldSelectMenuProps) => { const { getIcon } = useIcons(); - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); const [, setObjectFilterDropdownIsSelectingCompositeField] = - useRecoilComponentStateV2( + useAtomComponentState( objectFilterDropdownIsSelectingCompositeFieldComponentState, ); const [ objectFilterDropdownSubMenuFieldType, setObjectFilterDropdownSubMenuFieldType, - ] = useRecoilComponentStateV2( - objectFilterDropdownSubMenuFieldTypeComponentState, - ); + ] = useAtomComponentState(objectFilterDropdownSubMenuFieldTypeComponentState); const { closeAdvancedFilterFieldSelectDropdown } = useAdvancedFilterFieldSelectDropdown(recordFilterId); @@ -84,7 +82,7 @@ export const AdvancedFilterSubFieldSelectMenu = ({ const { advancedFilterFieldSelectDropdownId } = useAdvancedFilterFieldSelectDropdown(recordFilterId); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, advancedFilterFieldSelectDropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInput.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInput.tsx index 58020ece0b..af7e63eaab 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInput.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInput.tsx @@ -11,8 +11,8 @@ import { configurableViewFilterOperands } from '@/object-record/object-filter-dr import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { type DropdownOffset } from '@/ui/layout/dropdown/types/DropdownOffset'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -30,11 +30,11 @@ export const AdvancedFilterValueInput = ({ }: AdvancedFilterValueInputProps) => { const dropdownId = `advanced-filter-view-filter-value-input-${recordFilterId}`; - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const subFieldNameUsedInDropdown = useRecoilComponentValueV2( + const subFieldNameUsedInDropdown = useAtomComponentStateValue( subFieldNameUsedInDropdownComponentState, dropdownId, ); @@ -45,21 +45,20 @@ export const AdvancedFilterValueInput = ({ const isDisabled = !recordFilter?.fieldMetadataId || !recordFilter.operand; - const setObjectFilterDropdownSearchInput = useSetRecoilComponentStateV2( + const setObjectFilterDropdownSearchInput = useSetAtomComponentState( objectFilterDropdownSearchInputComponentState, dropdownId, ); - const setFieldMetadataItemIdUsedInDropdown = useSetRecoilComponentStateV2( + const setFieldMetadataItemIdUsedInDropdown = useSetAtomComponentState( fieldMetadataItemIdUsedInDropdownComponentState, dropdownId, ); - const setObjectFilterDropdownCurrentRecordFilter = - useSetRecoilComponentStateV2( - objectFilterDropdownCurrentRecordFilterComponentState, - dropdownId, - ); + const setObjectFilterDropdownCurrentRecordFilter = useSetAtomComponentState( + objectFilterDropdownCurrentRecordFilterComponentState, + dropdownId, + ); const operandHasNoInput = recordFilter && !configurableViewFilterOperands.has(recordFilter.operand); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInputDropdownButtonClickableSelect.tsx b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInputDropdownButtonClickableSelect.tsx index c29b0179df..4ade62801c 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInputDropdownButtonClickableSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterValueInputDropdownButtonClickableSelect.tsx @@ -1,7 +1,7 @@ import { getAdvancedFilterInputPlaceholderText } from '@/object-record/advanced-filter/utils/getAdvancedFilterInputPlacedholderText'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { SelectControl } from '@/ui/input/components/SelectControl'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isNonEmptyString } from '@sniptt/guards'; @@ -36,7 +36,7 @@ type AdvancedFilterValueInputDropdownButtonClickableSelectProps = { export const AdvancedFilterValueInputDropdownButtonClickableSelect = ({ recordFilterId, }: AdvancedFilterValueInputDropdownButtonClickableSelectProps) => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useChildRecordFiltersAndRecordFilterGroups.ts b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useChildRecordFiltersAndRecordFilterGroups.ts index c7d69c6ef2..a5904ab4fc 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useChildRecordFiltersAndRecordFilterGroups.ts +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useChildRecordFiltersAndRecordFilterGroups.ts @@ -2,7 +2,7 @@ import { currentRecordFilterGroupsComponentState } from '@/object-record/record- import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useChildRecordFiltersAndRecordFilterGroups = ({ @@ -10,11 +10,11 @@ export const useChildRecordFiltersAndRecordFilterGroups = ({ }: { recordFilterGroupId?: string; }) => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useRecordFilterField.ts b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useRecordFilterField.ts index a3a5b1fc21..98096bc8ae 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useRecordFilterField.ts +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useRecordFilterField.ts @@ -3,13 +3,13 @@ import { getCompositeSubFieldLabel } from '@/object-record/object-filter-dropdow import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { isValidSubFieldName } from '@/settings/data-model/utils/isValidSubFieldName'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; export const useRecordFilterField = (recordFilterId: string) => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSelectFieldUsedInAdvancedFilterDropdown.ts b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSelectFieldUsedInAdvancedFilterDropdown.ts index 62b62e36df..c4aac599a9 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSelectFieldUsedInAdvancedFilterDropdown.ts +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSelectFieldUsedInAdvancedFilterDropdown.ts @@ -15,8 +15,8 @@ import { isCompositeTypeNonFilterableByAnySubField } from '@/object-record/recor import { type CompositeFieldSubFieldName } from '@/settings/data-model/types/CompositeFieldSubFieldName'; import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { getFilterTypeFromFieldType, isDefined } from 'twenty-shared/utils'; type SelectFilterParams = { @@ -26,19 +26,19 @@ type SelectFilterParams = { }; export const useSelectFieldUsedInAdvancedFilterDropdown = () => { - const setSelectedOperandInDropdown = useSetRecoilComponentStateV2( + const setSelectedOperandInDropdown = useSetAtomComponentState( selectedOperandInDropdownComponentState, ); - const setFieldMetadataItemIdUsedInDropdown = useSetRecoilComponentStateV2( + const setFieldMetadataItemIdUsedInDropdown = useSetAtomComponentState( fieldMetadataItemIdUsedInDropdownComponentState, ); - const setObjectFilterDropdownSearchInput = useSetRecoilComponentStateV2( + const setObjectFilterDropdownSearchInput = useSetAtomComponentState( objectFilterDropdownSearchInputComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); @@ -47,14 +47,13 @@ export const useSelectFieldUsedInAdvancedFilterDropdown = () => { const { getFieldMetadataItemByIdOrThrow } = useGetFieldMetadataItemByIdOrThrow(); - const setSubFieldNameUsedInDropdown = useSetRecoilComponentStateV2( + const setSubFieldNameUsedInDropdown = useSetAtomComponentState( subFieldNameUsedInDropdownComponentState, ); - const setObjectFilterDropdownCurrentRecordFilter = - useSetRecoilComponentStateV2( - objectFilterDropdownCurrentRecordFilterComponentState, - ); + const setObjectFilterDropdownCurrentRecordFilter = useSetAtomComponentState( + objectFilterDropdownCurrentRecordFilterComponentState, + ); const { upsertRecordFilter } = useUpsertRecordFilter(); const { getInitialFilterValue } = useGetInitialFilterValue(); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSetAdvancedFilterDropdownAllRowsStates.ts b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSetAdvancedFilterDropdownAllRowsStates.ts index 2aa2683980..71f7e61cce 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSetAdvancedFilterDropdownAllRowsStates.ts +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/hooks/useSetAdvancedFilterDropdownAllRowsStates.ts @@ -6,22 +6,22 @@ import { subFieldNameUsedInDropdownComponentState } from '@/object-record/object import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCallback } from 'react'; import { useStore } from 'jotai'; export const useSetAdvancedFilterDropdownStates = () => { const store = useStore(); - const rootLevelRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootLevelRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/advanced-filter/states/rootLevelRecordFilterGroupComponentSelector.ts b/packages/twenty-front/src/modules/object-record/advanced-filter/states/rootLevelRecordFilterGroupComponentSelector.ts index 8e6627c70e..4dc609d30a 100644 --- a/packages/twenty-front/src/modules/object-record/advanced-filter/states/rootLevelRecordFilterGroupComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/advanced-filter/states/rootLevelRecordFilterGroupComponentSelector.ts @@ -1,11 +1,11 @@ import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { isDefined } from 'twenty-shared/utils'; export const rootLevelRecordFilterGroupComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'rootLevelRecordFilterGroupComponentSelector', componentInstanceContext: RecordFilterGroupsComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/cache/hooks/useUpsertFindManyRecordsQueryInCache.ts b/packages/twenty-front/src/modules/object-record/cache/hooks/useUpsertFindManyRecordsQueryInCache.ts index 35e31c23b0..bfd6b5c61a 100644 --- a/packages/twenty-front/src/modules/object-record/cache/hooks/useUpsertFindManyRecordsQueryInCache.ts +++ b/packages/twenty-front/src/modules/object-record/cache/hooks/useUpsertFindManyRecordsQueryInCache.ts @@ -1,6 +1,6 @@ import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { getRecordConnectionFromRecords } from '@/object-record/cache/utils/getRecordConnectionFromRecords'; import { type RecordGqlOperationVariables } from 'twenty-shared/types'; @@ -15,7 +15,7 @@ export const useUpsertFindManyRecordsQueryInCache = ({ }) => { const apolloCoreClient = useApolloCoreClient(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); const upsertFindManyRecordsQueryInCache = < diff --git a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx index 9c40ba1293..98e989796b 100644 --- a/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx +++ b/packages/twenty-front/src/modules/object-record/components/RecordChip.tsx @@ -5,7 +5,7 @@ import { useRecordChipData } from '@/object-record/hooks/useRecordChipData'; import { recordIndexOpenRecordInStateV2 } from '@/object-record/record-index/states/recordIndexOpenRecordInStateV2'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { canOpenObjectInSidePanel } from '@/object-record/utils/canOpenObjectInSidePanel'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; import { t } from '@lingui/core/macro'; import { type MouseEvent } from 'react'; @@ -55,7 +55,7 @@ export const RecordChip = ({ const { openRecordInCommandMenu } = useOpenRecordInCommandMenu(); - const recordIndexOpenRecordIn = useRecoilValueV2( + const recordIndexOpenRecordIn = useAtomStateValue( recordIndexOpenRecordInStateV2, ); const canOpenInSidePanel = canOpenObjectInSidePanel(objectNameSingular); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useBuildRecordInputFromRLSPredicates.ts b/packages/twenty-front/src/modules/object-record/hooks/useBuildRecordInputFromRLSPredicates.ts index 59e1fd6eaf..eb8d406bf7 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useBuildRecordInputFromRLSPredicates.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useBuildRecordInputFromRLSPredicates.ts @@ -14,7 +14,7 @@ import { buildRecordInputFromFilter } from '@/object-record/record-table/utils/b import { buildCompositeValueFromSubField } from '@/object-record/record-table/utils/buildValueFromFilter'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { isUndefined } from '@sniptt/guards'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { RelationType } from 'twenty-shared/types'; import { isDefined, isPlainObject } from 'twenty-shared/utils'; @@ -31,7 +31,7 @@ export const useBuildRecordInputFromRLSPredicates = ({ }: { objectMetadataItem: ObjectMetadataItem; }) => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { record: currentWorkspaceMemberRecord } = useFindOneRecord({ objectNameSingular: CoreObjectNameSingular.WorkspaceMember, diff --git a/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecords.ts index aed705ce8d..06c4bfbbcb 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecords.ts @@ -22,7 +22,7 @@ import { computeOptimisticRecordFromInput } from '@/object-record/utils/computeO import { dispatchObjectRecordOperationBrowserEvent } from '@/browser-event/utils/dispatchObjectRecordOperationBrowserEvent'; import { getCreateManyRecordsMutationResponseField } from '@/object-record/utils/getCreateManyRecordsMutationResponseField'; import { sanitizeRecordInput } from '@/object-record/utils/sanitizeRecordInput'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type RecordGqlOperationGqlRecordFields } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -78,7 +78,7 @@ export const useCreateManyRecords = < objectMetadataItem, }); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { objectMetadataItems } = useObjectMetadataItems(); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecordsMutation.ts b/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecordsMutation.ts index d1929d3bca..92a5c7b2a7 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecordsMutation.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useCreateManyRecordsMutation.ts @@ -2,7 +2,7 @@ import gql from 'graphql-tag'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { mapObjectMetadataToGraphQLQuery } from '@/object-metadata/utils/mapObjectMetadataToGraphQLQuery'; import { EMPTY_MUTATION } from '@/object-record/constants/EmptyMutation'; import { type RecordGqlOperationGqlRecordFields } from 'twenty-shared/types'; @@ -24,7 +24,7 @@ export const useCreateManyRecordsMutation = ({ const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); if (isUndefinedOrNull(objectMetadataItem)) { return { createManyRecordsMutation: EMPTY_MUTATION }; diff --git a/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecord.ts b/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecord.ts index afad07eca9..4d86f48212 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecord.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecord.ts @@ -29,7 +29,7 @@ import { computeOptimisticRecordFromInput } from '@/object-record/utils/computeO import { dispatchObjectRecordOperationBrowserEvent } from '@/browser-event/utils/dispatchObjectRecordOperationBrowserEvent'; import { getCreateOneRecordMutationResponseField } from '@/object-record/utils/getCreateOneRecordMutationResponseField'; import { sanitizeRecordInput } from '@/object-record/utils/sanitizeRecordInput'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CustomError, isDefined } from 'twenty-shared/utils'; type useCreateOneRecordProps = { @@ -68,7 +68,7 @@ export const useCreateOneRecord = < recordGqlFields: computedRecordGqlFields, }); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const createOneRecordInCache = useCreateOneRecordInCache( { diff --git a/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecordMutation.ts b/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecordMutation.ts index 5075959af7..2a7d39096d 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecordMutation.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useCreateOneRecordMutation.ts @@ -1,6 +1,6 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { generateCreateOneRecordMutation } from '@/object-metadata/utils/generateCreateOneRecordMutation'; import { EMPTY_MUTATION } from '@/object-record/constants/EmptyMutation'; import { type RecordGqlOperationGqlRecordFields } from 'twenty-shared/types'; @@ -18,7 +18,7 @@ export const useCreateOneRecordMutation = ({ objectNameSingular, }); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts index c9f3e9ccd6..84fefc7a47 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useDeleteManyRecords.ts @@ -17,7 +17,7 @@ import { useRefetchAggregateQueries } from '@/object-record/hooks/useRefetchAggr import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { getDeleteManyRecordsMutationResponseField } from '@/object-record/utils/getDeleteManyRecordsMutationResponseField'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { sleep } from '~/utils/sleep'; @@ -36,7 +36,7 @@ export const useDeleteManyRecords = ({ objectNameSingular, }: useDeleteManyRecordProps) => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const apiConfig = useRecoilValueV2(apiConfigState); + const apiConfig = useAtomStateValue(apiConfigState); const mutationPageSize = apiConfig?.mutationMaximumAffectedRecords ?? DEFAULT_MUTATION_BATCH_SIZE; diff --git a/packages/twenty-front/src/modules/object-record/hooks/useDestroyManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useDestroyManyRecords.ts index 4a2837e3c0..ac692c9077 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useDestroyManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useDestroyManyRecords.ts @@ -14,7 +14,7 @@ import { useRefetchAggregateQueries } from '@/object-record/hooks/useRefetchAggr import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { getDestroyManyRecordsMutationResponseField } from '@/object-record/utils/getDestroyManyRecordsMutationResponseField'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { sleep } from '~/utils/sleep'; @@ -33,7 +33,7 @@ export const useDestroyManyRecords = ({ objectNameSingular, }: useDestroyManyRecordProps) => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const apiConfig = useRecoilValueV2(apiConfigState); + const apiConfig = useAtomStateValue(apiConfigState); const mutationPageSize = apiConfig?.mutationMaximumAffectedRecords ?? DEFAULT_MUTATION_BATCH_SIZE; diff --git a/packages/twenty-front/src/modules/object-record/hooks/useFetchMoreRecordsWithPagination.ts b/packages/twenty-front/src/modules/object-record/hooks/useFetchMoreRecordsWithPagination.ts index 286c52c8d3..42e1713ff2 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useFetchMoreRecordsWithPagination.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useFetchMoreRecordsWithPagination.ts @@ -29,8 +29,8 @@ import { import { cursorFamilyState } from '@/object-record/states/cursorFamilyState'; import { hasNextPageFamilyState } from '@/object-record/states/hasNextPageFamilyState'; import { isFetchingMoreRecordsFamilyState } from '@/object-record/states/isFetchingMoreRecordsFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { useStore } from 'jotai'; @@ -89,12 +89,12 @@ export const useFetchMoreRecordsWithPagination = < orderBy, }); - const hasNextPage = useFamilyRecoilValueV2( + const hasNextPage = useAtomFamilyStateValue( hasNextPageFamilyState, queryIdentifier, ); - const setIsFetchingMoreObjects = useSetFamilyRecoilStateV2( + const setIsFetchingMoreObjects = useSetAtomFamilyState( isFetchingMoreRecordsFamilyState, queryIdentifier, ); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicatesRecordsQuery.ts b/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicatesRecordsQuery.ts index a82d4b1719..cd4cdc657c 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicatesRecordsQuery.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useFindDuplicatesRecordsQuery.ts @@ -2,7 +2,7 @@ import gql from 'graphql-tag'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isAggregationEnabled } from '@/object-metadata/utils/isAggregationEnabled'; import { mapObjectMetadataToGraphQLQuery } from '@/object-metadata/utils/mapObjectMetadataToGraphQLQuery'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; @@ -20,7 +20,7 @@ export const useFindDuplicateRecordsQuery = ({ const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const findDuplicateRecordsQuery = gql` query FindDuplicate${capitalize( diff --git a/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecordsQuery.ts b/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecordsQuery.ts index 97aaa946d5..6c073f857a 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecordsQuery.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecordsQuery.ts @@ -1,6 +1,6 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; import { generateFindManyRecordsQuery } from '@/object-record/utils/generateFindManyRecordsQuery'; import { @@ -23,7 +23,7 @@ export const useFindManyRecordsQuery = ({ objectNameSingular, }); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useFindOneRecordQuery.ts b/packages/twenty-front/src/modules/object-record/hooks/useFindOneRecordQuery.ts index 817536c27c..6fdc657989 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useFindOneRecordQuery.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useFindOneRecordQuery.ts @@ -2,7 +2,7 @@ import gql from 'graphql-tag'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { mapObjectMetadataToGraphQLQuery } from '@/object-metadata/utils/mapObjectMetadataToGraphQLQuery'; import { type RecordGqlOperationGqlRecordFields } from 'twenty-shared/types'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; @@ -21,7 +21,7 @@ export const useFindOneRecordQuery = ({ objectNameSingular, }); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useGroupByRecordsQuery.ts b/packages/twenty-front/src/modules/object-record/hooks/useGroupByRecordsQuery.ts index b5e8536f3d..4325607371 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useGroupByRecordsQuery.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useGroupByRecordsQuery.ts @@ -1,6 +1,6 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type RecordGqlOperationGqlRecordFields } from 'twenty-shared/types'; import { useObjectPermissions } from '@/object-record/hooks/useObjectPermissions'; import { generateGroupByRecordsQuery } from '@/object-record/utils/generateGroupByRecordsQuery'; @@ -18,7 +18,7 @@ export const useGroupByRecordsQuery = ({ objectNameSingular, }); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useMergeManyRecordsMutation.ts b/packages/twenty-front/src/modules/object-record/hooks/useMergeManyRecordsMutation.ts index f736f11a03..1901d8e2e8 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useMergeManyRecordsMutation.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useMergeManyRecordsMutation.ts @@ -2,7 +2,7 @@ import gql from 'graphql-tag'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { mapObjectMetadataToGraphQLQuery } from '@/object-metadata/utils/mapObjectMetadataToGraphQLQuery'; import { EMPTY_MUTATION } from '@/object-record/constants/EmptyMutation'; import { useGenerateDepthRecordGqlFieldsFromObject } from '@/object-record/graphql/record-gql-fields/hooks/useGenerateDepthRecordGqlFieldsFromObject'; @@ -30,7 +30,7 @@ export const useMergeManyRecordsMutation = ({ const appliedRecordGqlFields = recordGqlFields ?? depthOneRecordGqlFields; - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useObjectPermissions.ts b/packages/twenty-front/src/modules/object-record/hooks/useObjectPermissions.ts index a4db6c9466..152ce79ef9 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useObjectPermissions.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useObjectPermissions.ts @@ -1,5 +1,5 @@ import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type ObjectPermissions } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -11,7 +11,7 @@ type useObjectPermissionsReturnType = { }; export const useObjectPermissions = (): useObjectPermissionsReturnType => { - const currentUserWorkspace = useRecoilValueV2(currentUserWorkspaceState); + const currentUserWorkspace = useAtomStateValue(currentUserWorkspaceState); const objectsPermissions = currentUserWorkspace?.objectsPermissions; if (!isDefined(objectsPermissions)) { diff --git a/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.ts index 565c7b2b11..159d81e46b 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useObjectRecordSearchRecords.ts @@ -5,7 +5,7 @@ import { useDoObjectMetadataItemsExist } from '@/object-metadata/hooks/useDoObje import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { type WatchQueryFetchPolicy } from '@apollo/client'; import { useMemo } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { type ObjectRecordFilterInput, @@ -35,7 +35,7 @@ export const useObjectRecordSearchRecords = ({ filter, fetchPolicy, }: UseSearchRecordsParams) => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const areDefined = useDoObjectMetadataItemsExist(objectNameSingulars); const { enqueueErrorSnackBar } = useSnackBar(); diff --git a/packages/twenty-front/src/modules/object-record/hooks/useRestoreManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useRestoreManyRecords.ts index aa7229595e..3ee2c1bf5d 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useRestoreManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useRestoreManyRecords.ts @@ -14,7 +14,7 @@ import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useU import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { dispatchObjectRecordOperationBrowserEvent } from '@/browser-event/utils/dispatchObjectRecordOperationBrowserEvent'; import { getRestoreManyRecordsMutationResponseField } from '@/object-record/utils/getRestoreManyRecordsMutationResponseField'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { sleep } from '~/utils/sleep'; @@ -34,7 +34,7 @@ export const useRestoreManyRecords = ({ }: useRestoreManyRecordProps) => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const apiConfig = useRecoilValueV2(apiConfigState); + const apiConfig = useAtomStateValue(apiConfigState); const mutationPageSize = apiConfig?.mutationMaximumAffectedRecords ?? DEFAULT_MUTATION_BATCH_SIZE; diff --git a/packages/twenty-front/src/modules/object-record/hooks/useUpdateManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useUpdateManyRecords.ts index af1edc2bc3..6a3246ebaf 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useUpdateManyRecords.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useUpdateManyRecords.ts @@ -20,7 +20,7 @@ import { dispatchObjectRecordOperationBrowserEvent } from '@/browser-event/utils import { getUpdatedFieldsFromRecordInput } from '@/object-record/utils/getUpdatedFieldsFromRecordInput'; import { getUpdateManyRecordsMutationResponseField } from '@/object-record/utils/getUpdateManyRecordsMutationResponseField'; import { sanitizeRecordInput } from '@/object-record/utils/sanitizeRecordInput'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { sleep } from '~/utils/sleep'; @@ -44,7 +44,7 @@ export const useUpdateManyRecords = ({ recordGqlFields, }: UseUpdateManyRecordsProps) => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const apiConfig = useRecoilValueV2(apiConfigState); + const apiConfig = useAtomStateValue(apiConfigState); const mutationPageSize = apiConfig?.mutationMaximumAffectedRecords ?? DEFAULT_MUTATION_BATCH_SIZE; diff --git a/packages/twenty-front/src/modules/object-record/hooks/useUpdateOneRecord.ts b/packages/twenty-front/src/modules/object-record/hooks/useUpdateOneRecord.ts index b4dab560d9..585a51615e 100644 --- a/packages/twenty-front/src/modules/object-record/hooks/useUpdateOneRecord.ts +++ b/packages/twenty-front/src/modules/object-record/hooks/useUpdateOneRecord.ts @@ -21,7 +21,7 @@ import { getUpdatedFieldsFromRecordInput } from '@/object-record/utils/getUpdate import { getUpdateOneRecordMutationResponseField } from '@/object-record/utils/getUpdateOneRecordMutationResponseField'; import { sanitizeRecordInput } from '@/object-record/utils/sanitizeRecordInput'; import { isNull } from '@sniptt/guards'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { buildRecordFromKeysWithSameValue } from '~/utils/array/buildRecordFromKeysWithSameValue'; @@ -37,7 +37,7 @@ export const useUpdateOneRecord = () => { const apolloCoreClient = useApolloCoreClient(); const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { objectMetadataItems } = useObjectMetadataItems(); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); diff --git a/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useGenerateCombinedFindManyRecordsQuery.ts b/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useGenerateCombinedFindManyRecordsQuery.ts index 64fc47542f..0dab1604ce 100644 --- a/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useGenerateCombinedFindManyRecordsQuery.ts +++ b/packages/twenty-front/src/modules/object-record/multiple-objects/hooks/useGenerateCombinedFindManyRecordsQuery.ts @@ -2,7 +2,7 @@ import { gql } from '@apollo/client'; import { isNonEmptyArray, isUndefined } from '@sniptt/guards'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getObjectPermissionsForObject } from '@/object-metadata/utils/getObjectPermissionsForObject'; import { mapObjectMetadataToGraphQLQuery } from '@/object-metadata/utils/mapObjectMetadataToGraphQLQuery'; import { type RecordGqlOperationSignature } from 'twenty-shared/types'; @@ -17,7 +17,7 @@ export const useGenerateCombinedFindManyRecordsQuery = ({ }: { operationSignatures: RecordGqlOperationSignature[]; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); if (!isNonEmptyArray(operationSignatures)) { diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx index a57f6704c0..2e8ca67f55 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx @@ -8,7 +8,7 @@ import { MultipleSelectDropdown } from '@/object-record/select/components/Multip import { useRecordsForSelect } from '@/object-record/select/hooks/useRecordsForSelect'; import { type SelectableItem } from '@/object-record/select/types/SelectableItem'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type RelationFilterValue } from '@/views/view-filter-value/types/RelationFilterValue'; import { t } from '@lingui/core/macro'; import { @@ -37,7 +37,7 @@ export const ObjectFilterDropdownActorSelect = ({ const { applyObjectFilterDropdownFilterValue } = useApplyObjectFilterDropdownFilterValue(); - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownAnyFieldSearchInput.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownAnyFieldSearchInput.tsx index f226bba443..829528e738 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownAnyFieldSearchInput.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownAnyFieldSearchInput.tsx @@ -1,13 +1,13 @@ import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useLingui } from '@lingui/react/macro'; export const ObjectFilterDropdownAnyFieldSearchInput = () => { const { t } = useLingui(); const [anyFieldFilterSearchValue, setAnyFieldFilterSearchValue] = - useRecoilComponentStateV2(anyFieldFilterValueComponentState); + useAtomComponentState(anyFieldFilterValueComponentState); const handleSearchChange = (event: React.ChangeEvent) => { const inputValue = event.target.value; diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownContentWrapper.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownContentWrapper.tsx index f083bd5106..863335a054 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownContentWrapper.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownContentWrapper.tsx @@ -3,13 +3,13 @@ import { DATE_PICKER_DROPDOWN_CONTENT_WIDTH } from '@/object-record/object-filte import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { getFilterTypeFromFieldType, isDefined } from 'twenty-shared/utils'; export const ObjectFilterDropdownContentWrapper = ({ children, }: React.PropsWithChildren) => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCountrySelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCountrySelect.tsx index cc1bbfad50..48d7811b34 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCountrySelect.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCountrySelect.tsx @@ -10,8 +10,8 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useLingui } from '@lingui/react/macro'; import { isNonEmptyString } from '@sniptt/guards'; import { type ChangeEvent, useState } from 'react'; @@ -24,17 +24,16 @@ export const MAX_ITEMS_TO_DISPLAY = 5; export const ObjectFilterDropdownCountrySelect = () => { const [searchText, setSearchText] = useState(''); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); const { applyObjectFilterDropdownFilterValue } = useApplyObjectFilterDropdownFilterValue(); - const fieldMetadataItemUsedInFilterDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); + const fieldMetadataItemUsedInFilterDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); const countries = useCountries(); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx index 60cdc93634..a359fe41b3 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx @@ -9,8 +9,8 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useLingui } from '@lingui/react/macro'; import { isNonEmptyString } from '@sniptt/guards'; import { type ChangeEvent, useState } from 'react'; @@ -23,17 +23,16 @@ export const MAX_ITEMS_TO_DISPLAY = 3; export const ObjectFilterDropdownCurrencySelect = () => { const [searchText, setSearchText] = useState(''); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); const { applyObjectFilterDropdownFilterValue } = useApplyObjectFilterDropdownFilterValue(); - const fieldMetadataItemUsedInFilterDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); + const fieldMetadataItemUsedInFilterDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); const currenciesAsSelectableItems = CURRENCIES.map( turnCurrencyIntoSelectableItem, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateInput.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateInput.tsx index cb7d9942c6..5cc171fd09 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateInput.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateInput.tsx @@ -7,8 +7,8 @@ import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object- import { selectedOperandInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState'; import { getRelativeDateDisplayValue } from '@/object-record/object-filter-dropdown/utils/getRelativeDateDisplayValue'; import { DatePicker } from '@/ui/input/components/internal/date/components/DatePicker'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { stringifyRelativeDateFilter } from '@/views/view-filter-value/utils/stringifyRelativeDateFilter'; import { useContext } from 'react'; @@ -23,14 +23,14 @@ import { formatDateString } from '~/utils/string/formatDateString'; export const ObjectFilterDropdownDateInput = () => { const { dateFormat, timeZone } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const dateLocale = useAtomStateValue(dateLocaleState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateTimeInput.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateTimeInput.tsx index cc0d06e0c9..78966e523a 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateTimeInput.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownDateTimeInput.tsx @@ -6,8 +6,8 @@ import { useApplyObjectFilterDropdownFilterValue } from '@/object-record/object- import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState'; import { getRelativeDateDisplayValue } from '@/object-record/object-filter-dropdown/utils/getRelativeDateDisplayValue'; import { DateTimePicker } from '@/ui/input/components/internal/date/components/DateTimePicker'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { stringifyRelativeDateFilter } from '@/views/view-filter-value/utils/stringifyRelativeDateFilter'; import { useContext } from 'react'; @@ -26,12 +26,12 @@ import { formatDateTimeString } from '~/utils/string/formatDateTimeString'; export const ObjectFilterDropdownDateTimeInput = () => { const { dateFormat, timeFormat, timeZone } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const dateLocale = useAtomStateValue(dateLocaleState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { userTimezone } = useUserTimezone(); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInput.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInput.tsx index 63540799ce..e79598ee31 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInput.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInput.tsx @@ -17,8 +17,8 @@ import { NUMBER_FILTER_TYPES } from '@/object-record/object-filter-dropdown/cons import { TEXT_FILTER_TYPES } from '@/object-record/object-filter-dropdown/constants/TextFilterTypes'; import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector'; import { selectedOperandInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { getFilterTypeFromFieldType, isDefined } from 'twenty-shared/utils'; type ObjectFilterDropdownFilterInputProps = { @@ -34,11 +34,11 @@ export const ObjectFilterDropdownFilterInput = ({ const isWholeDayFilterEnabled = featureFlags.IS_DATE_TIME_WHOLE_DAY_FILTER_ENABLED ?? false; - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInputHeader.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInputHeader.tsx index 4340c8bf75..29f8f6e151 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInputHeader.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterInputHeader.tsx @@ -3,7 +3,7 @@ import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenu import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { ViewBarFilterDropdownFilterInputMenuHeader } from '@/views/components/ViewBarFilterDropdownFilterInputMenuHeader'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { useContext } from 'react'; @@ -11,7 +11,7 @@ import { IconX } from 'twenty-ui/display'; // TODO: we shouldn't guess in which parent we are, this should be splitted in two components, one for each case export const ObjectFilterDropdownFilterInputHeader = () => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelectMenuItem.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelectMenuItem.tsx index e6acae9f2a..1ebc8821a5 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelectMenuItem.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownFilterSelectMenuItem.tsx @@ -3,7 +3,7 @@ import { FILTER_FIELD_LIST_ID } from '@/object-record/object-filter-dropdown/con import { isCompositeFieldType } from '@/object-record/object-filter-dropdown/utils/isCompositeFieldType'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { useIcons } from 'twenty-ui/display'; import { MenuItem } from 'twenty-ui/navigation'; @@ -18,7 +18,7 @@ export const ObjectFilterDropdownFilterSelectMenuItem = ({ }: ObjectFilterDropdownFilterSelectMenuItemProps) => { const { resetSelectedItem } = useSelectableList(FILTER_FIELD_LIST_ID); - const isSelectedItem = useRecoilComponentFamilyValueV2( + const isSelectedItem = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, fieldMetadataItemToSelect.id, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownInnerSelectOperandDropdown.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownInnerSelectOperandDropdown.tsx index f8b59b6a6a..f2209850e8 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownInnerSelectOperandDropdown.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownInnerSelectOperandDropdown.tsx @@ -11,8 +11,8 @@ import { getRecordFilterOperands } from '@/object-record/record-filter/utils/get import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; import { DropdownMenuInnerSelect } from '@/ui/layout/dropdown/components/DropdownMenuInnerSelect'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { getFilterTypeFromFieldType, isDefined } from 'twenty-shared/utils'; import { type SelectOption } from 'twenty-ui/input'; @@ -20,15 +20,15 @@ const OBJECT_FILTER_DROPDOWN_INNER_SELECT_OPERAND_DROPDOWN_ID = 'object-filter-dropdown-inner-select-operand-dropdown'; export const ObjectFilterDropdownInnerSelectOperandDropdown = () => { - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); - const subFieldNameUsedInDropdown = useRecoilComponentValueV2( + const subFieldNameUsedInDropdown = useAtomComponentStateValue( subFieldNameUsedInDropdownComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownNumberInput.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownNumberInput.tsx index a851a75340..3745aa4e07 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownNumberInput.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownNumberInput.tsx @@ -6,7 +6,7 @@ import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-recor import { DropdownMenuInput } from '@/ui/layout/dropdown/components/DropdownMenuInput'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; type ObjectFilterDropdownNumberInputProps = { filterDropdownId: string; @@ -15,7 +15,7 @@ type ObjectFilterDropdownNumberInputProps = { export const ObjectFilterDropdownNumberInput = ({ filterDropdownId, }: ObjectFilterDropdownNumberInputProps) => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx index b170940733..3e4a59e2d0 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownOptionSelect.tsx @@ -17,8 +17,8 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { isNonEmptyString } from '@sniptt/guards'; import { MAX_OPTIONS_TO_DISPLAY } from 'twenty-shared/constants'; @@ -36,11 +36,11 @@ export const ObjectFilterDropdownOptionSelect = ({ }: { focusId: string; }) => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); @@ -48,7 +48,7 @@ export const ObjectFilterDropdownOptionSelect = ({ ObjectFilterDropdownComponentInstanceContext, ); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); @@ -69,7 +69,7 @@ export const ObjectFilterDropdownOptionSelect = ({ const { resetSelectedItem } = useSelectableList(componentInstanceId); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordSelect.tsx index ba181deaa0..0fa41e9b5d 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownRecordSelect.tsx @@ -12,8 +12,8 @@ import { MultipleSelectDropdown } from '@/object-record/select/components/Multip import { useRecordsForSelect } from '@/object-record/select/hooks/useRecordsForSelect'; import { type SelectableItem } from '@/object-record/select/types/SelectableItem'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type RelationFilterValue } from '@/views/view-filter-value/types/RelationFilterValue'; import { arrayOfUuidOrVariableSchema, @@ -22,7 +22,7 @@ import { } from 'twenty-shared/utils'; import { IconUserCircle } from 'twenty-ui/display'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const EMPTY_FILTER_VALUE: string = JSON.stringify({ isCurrentWorkspaceMemberSelected: false, @@ -40,12 +40,11 @@ export const ObjectFilterDropdownRecordSelect = ({ recordFilterId, dropdownId, }: ObjectFilterDropdownRecordSelectProps) => { - const fieldMetadataItemUsedInFilterDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); + const fieldMetadataItemUsedInFilterDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); @@ -55,15 +54,15 @@ export const ObjectFilterDropdownRecordSelect = ({ const { applyObjectFilterDropdownFilterValue } = useApplyObjectFilterDropdownFilterValue(); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSearchInput.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSearchInput.tsx index 327cbbbe09..50d36a46d2 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSearchInput.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSearchInput.tsx @@ -4,24 +4,24 @@ import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-recor import { objectFilterDropdownSearchInputComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState'; import { selectedOperandInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState'; import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export const ObjectFilterDropdownSearchInput = () => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); - const setObjectFilterDropdownSearchInput = useSetRecoilComponentStateV2( + const setObjectFilterDropdownSearchInput = useSetAtomComponentState( objectFilterDropdownSearchInputComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsx index 4b48567a78..11271dbf11 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownSourceSelect.tsx @@ -7,8 +7,8 @@ import { MultipleSelectDropdown } from '@/object-record/select/components/Multip import { type SelectableItem } from '@/object-record/select/types/SelectableItem'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; @@ -21,16 +21,15 @@ export const ObjectFilterDropdownSourceSelect = ({ }: { dropdownId: string; }) => { - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); - const fieldMetadataItemUsedInFilterDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); + const fieldMetadataItemUsedInFilterDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownTextInput.tsx b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownTextInput.tsx index ee5360d9f3..6ad6ac375a 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownTextInput.tsx +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownTextInput.tsx @@ -6,7 +6,7 @@ import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-recor import { DropdownMenuInput } from '@/ui/layout/dropdown/components/DropdownMenuInput'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; type ObjectFilterDropdownTextInputProps = { filterDropdownId: string; @@ -15,7 +15,7 @@ type ObjectFilterDropdownTextInputProps = { export const ObjectFilterDropdownTextInput = ({ filterDropdownId, }: ObjectFilterDropdownTextInputProps) => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownFilterValue.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownFilterValue.ts index 862d8140a3..e71e388438 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownFilterValue.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownFilterValue.ts @@ -5,22 +5,21 @@ import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-recor import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState'; import { useCreateRecordFilterFromObjectFilterDropdownCurrentStates } from '@/object-record/record-filter/hooks/useCreateRecordFilterFromObjectFilterDropdownCurrentStates'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { isDefined } from 'twenty-shared/utils'; import { useStore } from 'jotai'; export const useApplyObjectFilterDropdownFilterValue = () => { const store = useStore(); const objectFilterDropdownCurrentRecordFilter = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownCurrentRecordFilterComponentState, ); - const fieldMetadataItemUsedInDropdown = - useRecoilComponentSelectorCallbackStateV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorCallbackState( + fieldMetadataItemUsedInDropdownComponentSelector, + ); const { createRecordFilterFromObjectFilterDropdownCurrentStates } = useCreateRecordFilterFromObjectFilterDropdownCurrentStates(); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownOperand.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownOperand.ts index 1eec3866a5..3304402ed5 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownOperand.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useApplyObjectFilterDropdownOperand.ts @@ -10,9 +10,9 @@ import { useGetRelativeDateFilterWithUserTimezone } from '@/object-record/record import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { RecordFilterOperand } from '@/object-record/record-filter/types/RecordFilterOperand'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { stringifyRelativeDateFilter } from '@/views/view-filter-value/utils/stringifyRelativeDateFilter'; import { useFeatureFlagsMap } from '@/workspace/hooks/useFeatureFlagsMap'; @@ -24,11 +24,11 @@ import { export const useApplyObjectFilterDropdownOperand = () => { const { userTimezone } = useUserTimezone(); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); - const setSelectedOperandInDropdown = useSetRecoilComponentStateV2( + const setSelectedOperandInDropdown = useSetAtomComponentState( selectedOperandInDropdownComponentState, ); @@ -36,7 +36,7 @@ export const useApplyObjectFilterDropdownOperand = () => { objectFilterDropdownCurrentRecordFilter, ); - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useEmptyRecordFilter.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useEmptyRecordFilter.ts index 656d58c74d..6d2d7683d0 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useEmptyRecordFilter.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useEmptyRecordFilter.ts @@ -2,19 +2,18 @@ import { useCallback } from 'react'; import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState'; import { objectFilterDropdownSearchInputComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; export const useEmptyRecordFilter = (componentInstanceId?: string) => { const store = useStore(); - const objectFilterDropdownSearchInput = - useRecoilComponentStateCallbackStateV2( - objectFilterDropdownSearchInputComponentState, - componentInstanceId, - ); + const objectFilterDropdownSearchInput = useAtomComponentStateCallbackState( + objectFilterDropdownSearchInputComponentState, + componentInstanceId, + ); const objectFilterDropdownCurrentRecordFilter = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownCurrentRecordFilterComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useFilterDropdownSelectableFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useFilterDropdownSelectableFieldMetadataItems.ts index fb04fef001..df8ddc6c3d 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useFilterDropdownSelectableFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useFilterDropdownSelectableFieldMetadataItems.ts @@ -2,20 +2,20 @@ import { objectFilterDropdownSearchInputComponentState } from '@/object-record/o import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector'; import { useFilterableFieldMetadataItemsInRecordIndexContext } from '@/object-record/record-filter/hooks/useFilterableFieldMetadataItemsInRecordIndexContext'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useFilterDropdownSelectableFieldMetadataItems = () => { const { recordIndexId } = useRecordIndexContextOrThrow(); - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); const { filterableFieldMetadataItems } = useFilterableFieldMetadataItemsInRecordIndexContext(); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useObjectFilterDropdownFilterValue.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useObjectFilterDropdownFilterValue.ts index aba751ac22..2a9beb94b6 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useObjectFilterDropdownFilterValue.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useObjectFilterDropdownFilterValue.ts @@ -1,8 +1,8 @@ import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useObjectFilterDropdownFilterValue = () => { - const currentRecordFilter = useRecoilComponentValueV2( + const currentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useResetFilterDropdown.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useResetFilterDropdown.ts index 5ff3a7b569..7f56e5aa16 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useResetFilterDropdown.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useResetFilterDropdown.ts @@ -7,48 +7,46 @@ import { objectFilterDropdownFilterIsSelectedComponentState } from '@/object-rec import { objectFilterDropdownIsSelectingCompositeFieldComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownIsSelectingCompositeFieldComponentState'; import { objectFilterDropdownSearchInputComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState'; import { selectedOperandInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; export const useResetFilterDropdown = (componentInstanceId?: string) => { const store = useStore(); - const objectFilterDropdownSearchInput = - useRecoilComponentStateCallbackStateV2( - objectFilterDropdownSearchInputComponentState, - componentInstanceId, - ); + const objectFilterDropdownSearchInput = useAtomComponentStateCallbackState( + objectFilterDropdownSearchInputComponentState, + componentInstanceId, + ); - const fieldMetadataItemIdUsedInDropdown = - useRecoilComponentStateCallbackStateV2( - fieldMetadataItemIdUsedInDropdownComponentState, - componentInstanceId, - ); + const fieldMetadataItemIdUsedInDropdown = useAtomComponentStateCallbackState( + fieldMetadataItemIdUsedInDropdownComponentState, + componentInstanceId, + ); - const selectedOperandInDropdown = useRecoilComponentStateCallbackStateV2( + const selectedOperandInDropdown = useAtomComponentStateCallbackState( selectedOperandInDropdownComponentState, componentInstanceId, ); const objectFilterDropdownFilterIsSelected = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownFilterIsSelectedComponentState, componentInstanceId, ); const objectFilterDropdownAnyFieldSearchIsSelected = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownAnyFieldSearchIsSelectedComponentState, componentInstanceId, ); const objectFilterDropdownIsSelectingCompositeField = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownIsSelectingCompositeFieldComponentState, componentInstanceId, ); const objectFilterDropdownCurrentRecordFilter = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownCurrentRecordFilterComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useUpsertObjectFilterDropdownCurrentFilter.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useUpsertObjectFilterDropdownCurrentFilter.ts index fb2bf59502..afe93c5529 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useUpsertObjectFilterDropdownCurrentFilter.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/hooks/useUpsertObjectFilterDropdownCurrentFilter.ts @@ -3,13 +3,13 @@ import { useCallback } from 'react'; import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState'; import { useUpsertRecordFilter } from '@/object-record/record-filter/hooks/useUpsertRecordFilter'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; export const useUpsertObjectFilterDropdownCurrentFilter = () => { const store = useStore(); const objectFilterDropdownCurrentRecordFilter = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownCurrentRecordFilterComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemIdUsedInDropdownComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemIdUsedInDropdownComponentState.ts index 685c3b3126..fd52a97d04 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemIdUsedInDropdownComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemIdUsedInDropdownComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const fieldMetadataItemIdUsedInDropdownComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'fieldMetadataItemIdUsedInDropdownComponentState', defaultValue: null, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector.ts index 2050099e29..300f07d60c 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector.ts @@ -2,10 +2,10 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; import { fieldMetadataItemIdUsedInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemIdUsedInDropdownComponentState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const fieldMetadataItemUsedInDropdownComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'fieldMetadataItemUsedInDropdownComponentSelector', componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedComponentState.ts index 574077dc6f..f9359d3f11 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isObjectFilterDropdownOperandSelectUnfoldedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isObjectFilterDropdownOperandSelectUnfoldedComponentState', defaultValue: false, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedComponentState.ts index 1db4eb618e..77caf66747 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isObjectFilterDropdownUnfoldedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isObjectFilterDropdownUnfoldedComponentState', defaultValue: false, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownAnyFieldSearchIsSelectedComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownAnyFieldSearchIsSelectedComponentState.ts index b9eb3a55da..31d2560002 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownAnyFieldSearchIsSelectedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownAnyFieldSearchIsSelectedComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const objectFilterDropdownAnyFieldSearchIsSelectedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectFilterDropdownAnyFieldSearchIsSelectedComponentState', defaultValue: false, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState.ts index 9d213144ba..fb6cf4275f 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState.ts @@ -1,9 +1,9 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; export const objectFilterDropdownCurrentRecordFilterComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectFilterDropdownCurrentRecordFilterComponentState', defaultValue: undefined, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownFilterIsSelectedComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownFilterIsSelectedComponentState.ts index f7cdd9eaff..83326f9690 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownFilterIsSelectedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownFilterIsSelectedComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const objectFilterDropdownFilterIsSelectedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectFilterDropdownFilterIsSelectedComponentState', defaultValue: false, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownIsSelectingCompositeFieldComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownIsSelectingCompositeFieldComponentState.ts index 146b87944a..cb840f3914 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownIsSelectingCompositeFieldComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownIsSelectingCompositeFieldComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const objectFilterDropdownIsSelectingCompositeFieldComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectFilterDropdownIsSelectingCompositeFieldComponentState', defaultValue: false, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState.ts index 20cd234e38..ac2537a5e8 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const objectFilterDropdownSearchInputComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectFilterDropdownSearchInputComponentState', defaultValue: '', componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedOptionValuesComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedOptionValuesComponentState.ts index 4018cdc34e..c07b571c9c 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedOptionValuesComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedOptionValuesComponentState.ts @@ -1,8 +1,8 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const objectFilterDropdownSelectedOptionValuesComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectFilterDropdownSelectedOptionValuesComponentState', defaultValue: [], componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSubMenuFieldTypeComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSubMenuFieldTypeComponentState.ts index 4a0715ba6b..538ee7a5dd 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSubMenuFieldTypeComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSubMenuFieldTypeComponentState.ts @@ -1,9 +1,9 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; import { type CompositeFilterableFieldType } from '@/object-record/record-filter/types/CompositeFilterableFieldType'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const objectFilterDropdownSubMenuFieldTypeComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectFilterDropdownSubMenuFieldTypeComponentState', defaultValue: null, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState.ts index 10514dafc3..59d76ad6f2 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState.ts @@ -1,9 +1,9 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type ViewFilterOperand } from 'twenty-shared/types'; export const selectedOperandInDropdownComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'selectedOperandInDropdownComponentState', defaultValue: null, componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/subFieldNameUsedInDropdownComponentState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/subFieldNameUsedInDropdownComponentState.ts index db83c217ad..046b66e612 100644 --- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/subFieldNameUsedInDropdownComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/subFieldNameUsedInDropdownComponentState.ts @@ -1,11 +1,10 @@ import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; import { type CompositeFieldSubFieldName } from '@/settings/data-model/types/CompositeFieldSubFieldName'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const subFieldNameUsedInDropdownComponentState = createComponentStateV2< - CompositeFieldSubFieldName | null | undefined ->({ - key: 'subFieldNameUsedInDropdownComponentState', - defaultValue: null, - componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, -}); +export const subFieldNameUsedInDropdownComponentState = + createAtomComponentState({ + key: 'subFieldNameUsedInDropdownComponentState', + defaultValue: null, + componentInstanceContext: ObjectFilterDropdownComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdown.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdown.tsx index 1dc4b667af..5b6a4c3b34 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdown.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdown.tsx @@ -10,7 +10,7 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { StyledHeaderDropdownButton } from '@/ui/layout/dropdown/components/StyledHeaderDropdownButton'; import { DROPDOWN_OFFSET_Y } from '@/ui/layout/dropdown/constants/DropdownOffsetY'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type ViewType } from '@/views/types/ViewType'; import { Trans } from '@lingui/react/macro'; @@ -28,7 +28,7 @@ export const ObjectOptionsDropdown = ({ const { currentContentId, handleContentChange, handleResetContent } = useDropdownContextCurrentContentId(); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarFieldsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarFieldsContent.tsx index 86e5083579..21d8efb407 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarFieldsContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarFieldsContent.tsx @@ -10,7 +10,7 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView'; import { useGetAvailableFieldsForCalendar } from '@/views/view-picker/hooks/useGetAvailableFieldsForCalendar'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; import { isFieldMetadataDateKind } from 'twenty-shared/utils'; @@ -29,7 +29,7 @@ export const ObjectOptionsDropdownCalendarFieldsContent = () => { const { updateCurrentView } = useUpdateCurrentView(); const { navigateToDateFieldSettings } = useGetAvailableFieldsForCalendar(); - const setRecordIndexCalendarFieldMetadataId = useSetRecoilStateV2( + const setRecordIndexCalendarFieldMetadataId = useSetAtomState( recordIndexCalendarFieldMetadataIdState, ); const availableFieldsForCalendar = objectMetadataItem.fields.filter((field) => diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx index 67f3d88a9c..8bb9c97060 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx @@ -8,9 +8,9 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView'; import { t } from '@lingui/core/macro'; import { Pill } from 'twenty-ui/components'; @@ -25,15 +25,15 @@ import { ViewCalendarLayout } from '~/generated-metadata/graphql'; export const ObjectOptionsDropdownCalendarViewContent = () => { const { resetContent } = useObjectOptionsDropdown(); - const recordIndexCalendarLayout = useRecoilValueV2( + const recordIndexCalendarLayout = useAtomStateValue( recordIndexCalendarLayoutState, ); - const setRecordIndexCalendarLayout = useSetRecoilStateV2( + const setRecordIndexCalendarLayout = useSetAtomState( recordIndexCalendarLayoutState, ); const { updateCurrentView } = useUpdateCurrentView(); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx index 7afd1d4069..5a4b23be44 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCustomView.tsx @@ -11,14 +11,14 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Gene import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { ViewKey } from '@/views/types/ViewKey'; import { ViewType, viewTypeIconMapping } from '@/views/types/ViewType'; import { useDestroyViewFromCurrentState } from '@/views/view-picker/hooks/useDestroyViewFromCurrentState'; import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { @@ -54,7 +54,7 @@ export const ObjectOptionsDropdownCustomView = ({ } : null; - const recordGroupFieldMetadata = useRecoilComponentValueV2( + const recordGroupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); @@ -66,7 +66,7 @@ export const ObjectOptionsDropdownCustomView = ({ const isDefaultView = currentView?.key === ViewKey.Index; - const recordIndexCalendarLayout = useRecoilValueV2( + const recordIndexCalendarLayout = useAtomStateValue( recordIndexCalendarLayoutState, ); @@ -79,7 +79,7 @@ export const ObjectOptionsDropdownCustomView = ({ const visibleFieldsCount = visibleBoardFields.length; const { destroyViewFromCurrentState } = useDestroyViewFromCurrentState(); - const setViewPickerReferenceViewId = useSetRecoilComponentStateV2( + const setViewPickerReferenceViewId = useSetAtomComponentState( viewPickerReferenceViewIdComponentState, recordIndexId, ); @@ -105,7 +105,7 @@ export const ObjectOptionsDropdownCustomView = ({ 'Delete view', ]; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownDefaultView.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownDefaultView.tsx index 314feb9a23..b4af4521d6 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownDefaultView.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownDefaultView.tsx @@ -8,8 +8,8 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { useOpenCreateViewDropdown } from '@/views/hooks/useOpenCreateViewDropown'; import { useLingui } from '@lingui/react/macro'; @@ -29,7 +29,7 @@ export const ObjectOptionsDropdownDefaultView = () => { const { currentView } = useGetCurrentViewOnly(); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, recordIndexId, ); @@ -42,7 +42,7 @@ export const ObjectOptionsDropdownDefaultView = () => { 'Create custom view', ]; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenFieldsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenFieldsContent.tsx index bdc93b7b0a..42bf13b584 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenFieldsContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenFieldsContent.tsx @@ -9,7 +9,7 @@ import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { ViewFieldsHiddenDropdownSection } from '@/views/components/ViewFieldsHiddenDropdownSection'; import { useLingui } from '@lingui/react/macro'; import { SettingsPath } from 'twenty-shared/types'; @@ -31,7 +31,7 @@ export const ObjectOptionsDropdownHiddenFieldsContent = () => { }); const location = useLocation(); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenRecordGroupsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenRecordGroupsContent.tsx index fbeb06ddc7..cd4f86a297 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenRecordGroupsContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownHiddenRecordGroupsContent.tsx @@ -14,10 +14,10 @@ import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useLingui } from '@lingui/react/macro'; import { useLocation } from 'react-router-dom'; import { VIEW_GROUP_VISIBLE_OPTIONS_MAX } from 'twenty-shared/constants'; @@ -36,15 +36,15 @@ export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => { viewType, } = useObjectOptionsDropdown(); - const recordGroupFieldMetadata = useRecoilComponentValueV2( + const recordGroupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); - const hiddenRecordGroupIds = useRecoilComponentSelectorValueV2( + const hiddenRecordGroupIds = useAtomComponentSelectorValue( hiddenRecordGroupIdsComponentSelector, ); - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, viewType, ); @@ -65,7 +65,7 @@ export const ObjectOptionsDropdownHiddenRecordGroupsContent = () => { }); const location = useLocation(); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx index e97c572387..96aa54a008 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx @@ -13,7 +13,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView'; import { type GraphQLView } from '@/views/types/GraphQLView'; @@ -21,7 +21,7 @@ import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; import { ViewType, viewTypeIconMapping } from '@/views/types/ViewType'; import { useGetAvailableFieldsForCalendar } from '@/views/view-picker/hooks/useGetAvailableFieldsForCalendar'; import { useGetAvailableFieldsToGroupRecordsBy } from '@/views/view-picker/hooks/useGetAvailableFieldsToGroupRecordsBy'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -60,13 +60,13 @@ export const ObjectOptionsDropdownLayoutContent = () => { [updateCurrentView], ); - const recordIndexOpenRecordIn = useRecoilValueV2( + const recordIndexOpenRecordIn = useAtomStateValue( recordIndexOpenRecordInState, ); - const recordIndexCalendarLayout = useRecoilValueV2( + const recordIndexCalendarLayout = useAtomStateValue( recordIndexCalendarLayoutState, ); - const recordGroupFieldMetadata = useRecoilComponentValueV2( + const recordGroupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); @@ -126,7 +126,7 @@ export const ObjectOptionsDropdownLayoutContent = () => { ...(currentView?.type !== ViewType.Table ? ['Compact view'] : []), ]; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutOpenInContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutOpenInContent.tsx index fd4a455e25..03f1495a66 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutOpenInContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutOpenInContent.tsx @@ -11,8 +11,8 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; import { t } from '@lingui/core/macro'; @@ -25,7 +25,7 @@ import { MenuItemSelect } from 'twenty-ui/navigation'; export const ObjectOptionsDropdownLayoutOpenInContent = () => { const { onContentChange } = useObjectOptionsDropdown(); - const recordIndexOpenRecordIn = useRecoilValueV2( + const recordIndexOpenRecordIn = useAtomStateValue( recordIndexOpenRecordInState, ); const { currentView } = useGetCurrentViewOnly(); @@ -35,7 +35,7 @@ export const ObjectOptionsDropdownLayoutOpenInContent = () => { objectMetadataItem.nameSingular, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx index b49f92bcbb..a4465ba82f 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuViewName.tsx @@ -3,9 +3,9 @@ import { IconPicker } from '@/ui/input/components/IconPicker'; import { TextInput } from '@/ui/input/components/TextInput'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { type View } from '@/views/types/View'; import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId'; import { useUpdateViewFromCurrentState } from '@/views/view-picker/hooks/useUpdateViewFromCurrentState'; @@ -60,12 +60,12 @@ export const ObjectOptionsDropdownMenuViewName = ({ currentView, }: ObjectOptionsDropdownMenuViewNameProps) => { const [viewPickerSelectedIcon, setViewPickerSelectedIcon] = - useRecoilComponentStateV2(viewPickerSelectedIconComponentState); + useAtomComponentState(viewPickerSelectedIconComponentState); - const viewPickerIsPersisting = useRecoilComponentValueV2( + const viewPickerIsPersisting = useAtomComponentStateValue( viewPickerIsPersistingComponentState, ); - const setViewPickerIsDirty = useSetRecoilComponentStateV2( + const setViewPickerIsDirty = useSetAtomComponentState( viewPickerIsDirtyComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupFieldsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupFieldsContent.tsx index c4b85d901e..c6cdbee6f1 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupFieldsContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupFieldsContent.tsx @@ -15,9 +15,9 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { ViewType } from '@/views/types/ViewType'; import { useLingui } from '@lingui/react/macro'; import { useLocation } from 'react-router-dom'; @@ -48,11 +48,11 @@ export const ObjectOptionsDropdownRecordGroupFieldsContent = () => { objectNameSingular: objectMetadataItem.nameSingular, }); - const hiddenRecordGroupIds = useRecoilComponentSelectorValueV2( + const hiddenRecordGroupIds = useAtomComponentSelectorValue( hiddenRecordGroupIdsComponentSelector, ); - const recordGroupFieldMetadata = useRecoilComponentValueV2( + const recordGroupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); @@ -78,7 +78,7 @@ export const ObjectOptionsDropdownRecordGroupFieldsContent = () => { ); const location = useLocation(); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsx index bca986d1d3..9f8ff6caeb 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupSortContent.tsx @@ -12,9 +12,9 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { IconChevronLeft, @@ -27,11 +27,11 @@ import { MenuItemSelect } from 'twenty-ui/navigation'; export const ObjectOptionsDropdownRecordGroupSortContent = () => { const { currentContentId, onContentChange } = useObjectOptionsDropdown(); - const hiddenRecordGroupIds = useRecoilComponentSelectorValueV2( + const hiddenRecordGroupIds = useAtomComponentSelectorValue( hiddenRecordGroupIdsComponentSelector, ); - const [recordGroupSort, setRecordGroupSort] = useRecoilComponentStateV2( + const [recordGroupSort, setRecordGroupSort] = useAtomComponentState( recordIndexRecordGroupSortComponentState, ); @@ -39,7 +39,7 @@ export const ObjectOptionsDropdownRecordGroupSortContent = () => { setRecordGroupSort(sort); }; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx index c566b56bd9..c3ddf229c6 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx @@ -17,9 +17,9 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { useGetAvailableFieldsToGroupRecordsBy } from '@/views/view-picker/hooks/useGetAvailableFieldsToGroupRecordsBy'; import { useLingui } from '@lingui/react/macro'; @@ -48,27 +48,27 @@ export const ObjectOptionsDropdownRecordGroupsContent = () => { const { currentView } = useGetCurrentViewOnly(); - const recordGroupFieldMetadata = useRecoilComponentValueV2( + const recordGroupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, viewType, ); - const hiddenRecordGroupIds = useRecoilComponentSelectorValueV2( + const hiddenRecordGroupIds = useAtomComponentSelectorValue( hiddenRecordGroupIdsComponentSelector, ); - const hideEmptyRecordGroup = useRecoilComponentValueV2( + const hideEmptyRecordGroup = useAtomComponentStateValue( recordIndexShouldHideEmptyRecordGroupsComponentState, ); const shouldHideEmptyGroups = hideEmptyRecordGroup ?? currentView?.shouldHideEmptyGroups ?? false; - const recordGroupSort = useRecoilComponentValueV2( + const recordGroupSort = useAtomComponentStateValue( recordIndexRecordGroupSortComponentState, ); @@ -91,7 +91,7 @@ export const ObjectOptionsDropdownRecordGroupsContent = () => { } }, [hiddenRecordGroupIds, currentContentId, onContentChange]); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsx index f8a9a5616e..2f8659134e 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownVisibilityContent.tsx @@ -10,7 +10,7 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Gene import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView'; @@ -39,7 +39,7 @@ export const ObjectOptionsDropdownVisibilityContent = () => { const hasViewsPermission = useHasPermissionFlag(PermissionFlagType.VIEWS); const { canPersistChanges } = useCanPersistViewChanges(); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_OPTIONS_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useObjectOptionsForBoard.ts b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useObjectOptionsForBoard.ts index d6294d7e73..2cc8e67a25 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useObjectOptionsForBoard.ts +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useObjectOptionsForBoard.ts @@ -11,8 +11,8 @@ import { type RecordField } from '@/object-record/record-field/types/RecordField import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { recordIndexFieldDefinitionsState } from '@/object-record/record-index/states/recordIndexFieldDefinitionsState'; import { type ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useSaveCurrentViewFields } from '@/views/hooks/useSaveCurrentViewFields'; import { mapRecordFieldToViewField } from '@/views/utils/mapRecordFieldToViewField'; import { produce } from 'immer'; @@ -32,7 +32,7 @@ export const useObjectOptionsForBoard = ({ recordBoardId, }: useObjectOptionsForBoardParams) => { const [recordIndexFieldDefinitions, setRecordIndexFieldDefinitions] = - useRecoilStateV2(recordIndexFieldDefinitionsState); + useAtomState(recordIndexFieldDefinitionsState); const { saveViewFields } = useSaveCurrentViewFields(); @@ -130,7 +130,7 @@ export const useObjectOptionsForBoard = ({ ], ); - const currentRecordFields = useRecoilComponentValueV2( + const currentRecordFields = useAtomComponentStateValue( currentRecordFieldsComponentState, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSearchRecordGroupField.ts b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSearchRecordGroupField.ts index 96e99a2ad2..31ec829f8c 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSearchRecordGroupField.ts +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSearchRecordGroupField.ts @@ -1,6 +1,6 @@ import { objectOptionsDropdownSearchInputComponentState } from '@/object-record/object-options-dropdown/states/objectOptionsDropdownSearchInputComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useMemo } from 'react'; import { FieldMetadataType } from '~/generated-metadata/graphql'; @@ -8,7 +8,7 @@ export const useSearchRecordGroupField = () => { const { objectMetadataItem } = useRecordIndexContextOrThrow(); const [recordGroupFieldSearchInput, setRecordGroupFieldSearchInput] = - useRecoilComponentStateV2(objectOptionsDropdownSearchInputComponentState); + useAtomComponentState(objectOptionsDropdownSearchInputComponentState); const filteredRecordGroupFieldMetadataItems = useMemo(() => { const searchInputLowerCase = diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts index d762a994c8..21948911f0 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts @@ -12,7 +12,7 @@ import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; import { convertViewTypeToCore } from '@/views/utils/convertViewTypeToCore'; import { useGetAvailableFieldsForCalendar } from '@/views/view-picker/hooks/useGetAvailableFieldsForCalendar'; import { useGetAvailableFieldsToGroupRecordsBy } from '@/views/view-picker/hooks/useGetAvailableFieldsToGroupRecordsBy'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { assertUnreachable, isDefined } from 'twenty-shared/utils'; @@ -20,7 +20,7 @@ import { ViewCalendarLayout } from '~/generated-metadata/graphql'; export const useSetViewTypeFromLayoutOptionsMenu = () => { const { updateCurrentView } = useUpdateCurrentView(); - const setRecordIndexViewType = useSetRecoilStateV2(recordIndexViewTypeState); + const setRecordIndexViewType = useSetAtomState(recordIndexViewTypeState); const { availableFieldsForGrouping } = useGetAvailableFieldsToGroupRecordsBy(); const { objectMetadataItem } = useRecordIndexContextOrThrow(); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useUpdateObjectViewOptions.ts b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useUpdateObjectViewOptions.ts index 0682da5987..4715d384bb 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useUpdateObjectViewOptions.ts +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useUpdateObjectViewOptions.ts @@ -1,7 +1,7 @@ import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState'; import { recordIndexOpenRecordInStateV2 } from '@/object-record/record-index/states/recordIndexOpenRecordInStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useStore } from 'jotai'; import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView'; import { type GraphQLView } from '@/views/types/GraphQLView'; @@ -13,15 +13,15 @@ import { useCallback } from 'react'; export const useUpdateObjectViewOptions = () => { const store = useStore(); - const setRecordIndexOpenRecordIn = useSetRecoilStateV2( + const setRecordIndexOpenRecordIn = useSetAtomState( recordIndexOpenRecordInState, ); - const setRecordIndexViewName = useSetRecoilComponentStateV2( + const setRecordIndexViewName = useSetAtomComponentState( viewPickerInputNameComponentState, ); - const setRecordIndexViewIcon = useSetRecoilComponentStateV2( + const setRecordIndexViewIcon = useSetAtomComponentState( viewPickerSelectedIconComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/states/objectOptionsDropdownSearchInputComponentState.ts b/packages/twenty-front/src/modules/object-record/object-options-dropdown/states/objectOptionsDropdownSearchInputComponentState.ts index 3ff53b1503..1b7bf38f2e 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/states/objectOptionsDropdownSearchInputComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/states/objectOptionsDropdownSearchInputComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const objectOptionsDropdownSearchInputComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectOptionsDropdownSearchInputComponentState', defaultValue: '', componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/components/ObjectSortDropdownButton.tsx b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/components/ObjectSortDropdownButton.tsx index 6a14f6a7f3..c0e82decfc 100644 --- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/components/ObjectSortDropdownButton.tsx +++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/components/ObjectSortDropdownButton.tsx @@ -25,11 +25,11 @@ import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDrop import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { Trans, useLingui } from '@lingui/react/macro'; import { findByProperty } from 'twenty-shared/utils'; import { IconX, useIcons } from 'twenty-ui/display'; @@ -41,7 +41,7 @@ export const ObjectSortDropdownButton = () => { const { resetRecordSortDropdownSearchInput } = useResetRecordSortDropdownSearchInput(); - const setObjectSortDropdownSearchInput = useSetRecoilComponentStateV2( + const setObjectSortDropdownSearchInput = useSetAtomComponentState( objectSortDropdownSearchInputComponentState, ); @@ -49,11 +49,11 @@ export const ObjectSortDropdownButton = () => { const { recordIndexId, objectMetadataItem } = useRecordIndexContextOrThrow(); - const objectSortDropdownSearchInput = useRecoilComponentValueV2( + const objectSortDropdownSearchInput = useAtomComponentStateValue( objectSortDropdownSearchInputComponentState, ); - const sortableFieldMetadataItems = useFamilySelectorValueV2( + const sortableFieldMetadataItems = useAtomFamilySelectorValue( availableFieldMetadataItemsForSortFamilySelector, { objectMetadataItemId: objectMetadataItem.id, @@ -62,7 +62,7 @@ export const ObjectSortDropdownButton = () => { const { getIcon } = useIcons(); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, recordIndexId, ); @@ -129,9 +129,9 @@ export const ObjectSortDropdownButton = () => { }; const [selectedRecordSortDirection, setSelectedRecordSortDirection] = - useRecoilComponentStateV2(selectedRecordSortDirectionComponentState); + useAtomComponentState(selectedRecordSortDirectionComponentState); - const setIsRecordSortDirectionMenuUnfolded = useSetRecoilComponentStateV2( + const setIsRecordSortDirectionMenuUnfolded = useSetAtomComponentState( isRecordSortDirectionDropdownMenuUnfoldedComponentState, ); @@ -140,7 +140,7 @@ export const ObjectSortDropdownButton = () => { setIsRecordSortDirectionMenuUnfolded(false); }; - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, OBJECT_SORT_DROPDOWN_ID, ); @@ -152,12 +152,12 @@ export const ObjectSortDropdownButton = () => { ...hiddenFieldMetadataItemsSorted.map((item) => item.id), ]; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, OBJECT_SORT_DROPDOWN_ID, ); - const setSelectedItemId = useSetRecoilComponentStateV2( + const setSelectedItemId = useSetAtomComponentState( selectedItemIdComponentState, OBJECT_SORT_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetRecordSortDropdownSearchInput.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetRecordSortDropdownSearchInput.ts index 24b668c798..b96ec1d30e 100644 --- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetRecordSortDropdownSearchInput.ts +++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetRecordSortDropdownSearchInput.ts @@ -1,11 +1,11 @@ import { objectSortDropdownSearchInputComponentState } from '@/object-record/object-sort-dropdown/states/objectSortDropdownSearchInputComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; export const useResetRecordSortDropdownSearchInput = () => { const objectSortDropdownSearchInputCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectSortDropdownSearchInputComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetSortDropdown.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetSortDropdown.ts index 9e1698f357..a41a76194e 100644 --- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetSortDropdown.ts +++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/hooks/useResetSortDropdown.ts @@ -1,15 +1,14 @@ import { isRecordSortDirectionDropdownMenuUnfoldedComponentState } from '@/object-record/object-sort-dropdown/states/isRecordSortDirectionDropdownMenuUnfoldedComponentState'; import { selectedRecordSortDirectionComponentState } from '@/object-record/object-sort-dropdown/states/selectedRecordSortDirectionComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { ViewSortDirection } from '~/generated-metadata/graphql'; export const useResetSortDropdown = () => { - const setIsRecordSortDirectionDropdownMenuUnfolded = - useSetRecoilComponentStateV2( - isRecordSortDirectionDropdownMenuUnfoldedComponentState, - ); + const setIsRecordSortDirectionDropdownMenuUnfolded = useSetAtomComponentState( + isRecordSortDirectionDropdownMenuUnfoldedComponentState, + ); - const setSelectedRecordSortDirection = useSetRecoilComponentStateV2( + const setSelectedRecordSortDirection = useSetAtomComponentState( selectedRecordSortDirectionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isRecordSortDirectionDropdownMenuUnfoldedComponentState.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isRecordSortDirectionDropdownMenuUnfoldedComponentState.ts index 66a458fbb8..35390a791b 100644 --- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isRecordSortDirectionDropdownMenuUnfoldedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isRecordSortDirectionDropdownMenuUnfoldedComponentState.ts @@ -1,8 +1,8 @@ import { ObjectSortDropdownComponentInstanceContext } from '@/object-record/object-sort-dropdown/states/context/ObjectSortDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isRecordSortDirectionDropdownMenuUnfoldedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isRecordSortDirectionDropdownMenuUnfoldedComponentState', defaultValue: false, componentInstanceContext: ObjectSortDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/objectSortDropdownSearchInputComponentState.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/objectSortDropdownSearchInputComponentState.ts index 4badb45065..dd3bc87cf1 100644 --- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/objectSortDropdownSearchInputComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/objectSortDropdownSearchInputComponentState.ts @@ -1,8 +1,8 @@ import { ObjectSortDropdownComponentInstanceContext } from '@/object-record/object-sort-dropdown/states/context/ObjectSortDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const objectSortDropdownSearchInputComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'objectSortDropdownSearchInputComponentState', defaultValue: '', componentInstanceContext: ObjectSortDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/selectedRecordSortDirectionComponentState.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/selectedRecordSortDirectionComponentState.ts index 2964b95b71..dfcdeefccb 100644 --- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/selectedRecordSortDirectionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/selectedRecordSortDirectionComponentState.ts @@ -1,9 +1,9 @@ import { ObjectSortDropdownComponentInstanceContext } from '@/object-record/object-sort-dropdown/states/context/ObjectSortDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewSortDirection } from '~/generated-metadata/graphql'; export const selectedRecordSortDirectionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'selectedRecordSortDirectionComponentState', defaultValue: ViewSortDirection.ASC, componentInstanceContext: ObjectSortDropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx index 471862ea98..3034de9c2f 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardBodyEscapeHotkeyEffect.tsx @@ -8,7 +8,7 @@ import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/r import { useResetFocusStackToRecordIndex } from '@/object-record/record-index/hooks/useResetFocusStackToRecordIndex'; import { PageFocusId } from '@/types/PageFocusId'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; export const RecordBoardBodyEscapeHotkeyEffect = () => { const { recordBoardId } = useContext(RecordBoardContext); @@ -18,7 +18,7 @@ export const RecordBoardBodyEscapeHotkeyEffect = () => { const { unfocusBoardCard } = useFocusedRecordBoardCard(recordBoardId); const { resetFocusStackToRecordIndex } = useResetFocusStackToRecordIndex(); - const selectedRecordIds = useRecoilComponentSelectorValueV2( + const selectedRecordIds = useAtomComponentSelectorValue( recordBoardSelectedRecordIdsComponentSelector, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsx index 71c8557acd..cd8f1daa18 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardClickOutsideEffect.tsx @@ -11,14 +11,14 @@ import { isDraggingRecordComponentState } from '@/object-record/record-drag/stat import { MODAL_BACKDROP_CLICK_OUTSIDE_ID } from '@/ui/layout/modal/constants/ModalBackdropClickOutsideId'; import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constants/PageActionContainerClickOutsideId'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { LINK_CHIP_CLICK_OUTSIDE_ID } from 'twenty-ui/components'; export const RecordBoardClickOutsideEffect = () => { const { recordBoardId } = useContext(RecordBoardContext); - const isDraggingRecord = useRecoilComponentValueV2( + const isDraggingRecord = useAtomComponentStateValue( isDraggingRecordComponentState, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardColumns.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardColumns.tsx index 3923085d3a..60a401b1ee 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardColumns.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardColumns.tsx @@ -1,6 +1,6 @@ import { RecordBoardColumn } from '@/object-record/record-board/record-board-column/components/RecordBoardColumn'; import { visibleRecordGroupIdsComponentFamilySelector } from '@/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; import { ViewType } from '@/views/types/ViewType'; import styled from '@emotion/styled'; @@ -13,7 +13,7 @@ const StyledColumnContainer = styled.div` `; export const RecordBoardColumns = () => { - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, ViewType.Kanban, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsx index eae76be24e..6db4308fac 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardContainer.tsx @@ -14,7 +14,7 @@ import { RecordIndexRemoveSortingModal } from '@/object-record/record-index/comp import { RECORD_INDEX_REMOVE_SORTING_MODAL_ID } from '@/object-record/record-index/constants/RecordIndexRemoveSortingModalId'; import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; type RecordBoardContainerProps = { @@ -35,7 +35,7 @@ export const RecordBoardContainer = ({ objectMetadataItem.id, ); - const recordIndexGroupFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); @@ -55,7 +55,7 @@ export const RecordBoardContainer = ({ ...args, }); - const isRecordIndexRemoveSortingModalOpened = useRecoilComponentValueV2( + const isRecordIndexRemoveSortingModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, RECORD_INDEX_REMOVE_SORTING_MODAL_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDataChangedEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDataChangedEffect.tsx index 2936ef5e4a..3f6f9ca13d 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDataChangedEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDataChangedEffect.tsx @@ -10,9 +10,9 @@ import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { type ObjectRecordOperationBrowserEventDetail } from '@/browser-event/types/ObjectRecordOperationBrowserEventDetail'; -import { useRecoilComponentFamilySelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilySelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -25,15 +25,14 @@ export const RecordBoardDataChangedEffect = () => { useGetShouldInitializeRecordBoardForUpdateInputs(); const recordGroupFromGroupValueCallbackState = - useRecoilComponentFamilySelectorCallbackStateV2( + useAtomComponentFamilySelectorCallbackState( recordGroupFromGroupValueComponentFamilySelector, ); - const recordIndexGroupFieldMetadataItem = - useRecoilComponentStateCallbackStateV2( - recordIndexGroupFieldMetadataItemComponentState, - ); + const recordIndexGroupFieldMetadataItem = useAtomComponentStateCallbackState( + recordIndexGroupFieldMetadataItemComponentState, + ); const recordIndexRecordIdsByGroupCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDragDropContext.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDragDropContext.tsx index 8923757fd0..af78d6cd2e 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDragDropContext.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardDragDropContext.tsx @@ -8,8 +8,8 @@ import { originalDragSelectionComponentState } from '@/object-record/record-drag import { RECORD_INDEX_REMOVE_SORTING_MODAL_ID } from '@/object-record/record-index/constants/RecordIndexRemoveSortingModalId'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { DragDropContext, @@ -23,20 +23,19 @@ export const RecordBoardDragDropContext = ({ }: React.PropsWithChildren) => { const { recordBoardId } = useContext(RecordBoardContext); - const currentRecordSorts = useRecoilComponentStateCallbackStateV2( + const currentRecordSorts = useAtomComponentStateCallbackState( currentRecordSortsComponentState, recordBoardId, ); - const recordBoardSelectedRecordIds = - useRecoilComponentSelectorCallbackStateV2( - recordBoardSelectedRecordIdsComponentSelector, - recordBoardId, - ); + const recordBoardSelectedRecordIds = useAtomComponentSelectorCallbackState( + recordBoardSelectedRecordIdsComponentSelector, + recordBoardId, + ); const store = useStore(); - const originalDragSelection = useRecoilComponentStateCallbackStateV2( + const originalDragSelection = useAtomComponentStateCallbackState( originalDragSelectionComponentState, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardFetchMoreInViewTriggerComponent.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardFetchMoreInViewTriggerComponent.tsx index 433d28cf9f..5bd76a72d5 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardFetchMoreInViewTriggerComponent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardFetchMoreInViewTriggerComponent.tsx @@ -10,9 +10,9 @@ import { recordBoardShouldFetchMoreComponentState } from '@/object-record/record import { visibleRecordGroupIdsComponentFamilySelector } from '@/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector'; import { recordIndexRecordGroupsAreInInitialLoadingComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupsAreInInitialLoadingComponentState'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewType } from '@/views/types/ViewType'; const StyledFetchMoreTriggerDiv = styled.div<{ width: number }>` @@ -21,15 +21,15 @@ const StyledFetchMoreTriggerDiv = styled.div<{ width: number }>` `; export const RecordBoardFetchMoreInViewTriggerComponent = () => { - const [shouldFetchMore, setShouldFetchMore] = useRecoilComponentStateV2( + const [shouldFetchMore, setShouldFetchMore] = useAtomComponentState( recordBoardShouldFetchMoreComponentState, ); - const isInitialLoading = useRecoilComponentValueV2( + const isInitialLoading = useAtomComponentStateValue( recordIndexRecordGroupsAreInInitialLoadingComponentState, ); - const isFetchingMore = useRecoilComponentValueV2( + const isFetchingMore = useAtomComponentStateValue( recordBoardIsFetchingMoreComponentState, ); @@ -40,7 +40,7 @@ export const RecordBoardFetchMoreInViewTriggerComponent = () => { root: scrollWrapperHTMLElement, }); - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, ViewType.Kanban, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHeader.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHeader.tsx index 51f9d96ffe..56fc616386 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHeader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardHeader.tsx @@ -2,7 +2,7 @@ import { RecordBoardColumnHeaderWrapper } from '@/object-record/record-board/rec import { RecordGroupContext } from '@/object-record/record-group/states/context/RecordGroupContext'; import { visibleRecordGroupIdsComponentFamilySelector } from '@/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector'; import { RecordIndexGroupAggregatesDataLoader } from '@/object-record/record-index/components/RecordIndexGroupAggregatesDataLoader'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; import { ViewType } from '@/views/types/ViewType'; import styled from '@emotion/styled'; @@ -26,7 +26,7 @@ const StyledHeaderContainer = styled.div` `; export const RecordBoardHeader = () => { - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, ViewType.Kanban, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardQueryEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardQueryEffect.tsx index c081a71ff6..832a523eee 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardQueryEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardQueryEffect.tsx @@ -12,9 +12,9 @@ import { useRecordIndexGroupCommonQueryVariables } from '@/object-record/record- import { recordIndexRecordGroupsAreInInitialLoadingComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupsAreInInitialLoadingComponentState'; import { getQueryIdentifier } from '@/object-record/utils/getQueryIdentifier'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect } from 'react'; import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; @@ -23,17 +23,17 @@ export const RecordBoardQueryEffect = () => { const { objectMetadataItem } = useRecordIndexContextOrThrow(); const [lastRecordBoardQueryIdentifier, setLastRecordBoardQueryIdentifier] = - useRecoilComponentStateV2(lastRecordBoardQueryIdentifierComponentState); + useAtomComponentState(lastRecordBoardQueryIdentifierComponentState); - const [lastRecordGroupIds, setLastRecordGroupIds] = useRecoilComponentStateV2( + const [lastRecordGroupIds, setLastRecordGroupIds] = useAtomComponentState( lastRecordGroupIdsComponentState, ); - const recordIndexRecordGroupsAreInInitialLoading = useRecoilComponentValueV2( + const recordIndexRecordGroupsAreInInitialLoading = useAtomComponentStateValue( recordIndexRecordGroupsAreInInitialLoadingComponentState, ); - const setRecordBoardCurrentGroupByQueryOffset = useSetRecoilComponentStateV2( + const setRecordBoardCurrentGroupByQueryOffset = useSetAtomComponentState( recordBoardCurrentGroupByQueryOffsetComponentState, ); @@ -51,11 +51,11 @@ export const RecordBoardQueryEffect = () => { const { scrollWrapperHTMLElement } = useScrollWrapperHTMLElement(); - const [shouldFetchMore] = useRecoilComponentStateV2( + const [shouldFetchMore] = useAtomComponentState( recordBoardShouldFetchMoreComponentState, ); - const recordBoardIsFetchingMore = useRecoilComponentValueV2( + const recordBoardIsFetchingMore = useAtomComponentStateValue( recordBoardIsFetchingMoreComponentState, ); @@ -64,7 +64,7 @@ export const RecordBoardQueryEffect = () => { const { triggerRecordBoardInitialQuery } = useTriggerRecordBoardInitialQuery(); - const recordGroupdIds = useRecoilComponentValueV2( + const recordGroupdIds = useAtomComponentStateValue( recordGroupIdsComponentState, ); const recordGroupIdsHaveChanged = !isDeeplyEqual( diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardScrollToFocusedCardEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardScrollToFocusedCardEffect.tsx index 46ab01fdd1..c83a2d4bfc 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardScrollToFocusedCardEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardScrollToFocusedCardEffect.tsx @@ -3,17 +3,17 @@ import { useContext, useEffect } from 'react'; import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext'; import { focusedRecordBoardCardIndexesComponentState } from '@/object-record/record-board/states/focusedRecordBoardCardIndexesComponentState'; import { isRecordBoardCardFocusActiveComponentState } from '@/object-record/record-board/states/isRecordBoardCardFocusActiveComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const RecordBoardScrollToFocusedCardEffect = () => { const { recordBoardId } = useContext(RecordBoardContext); - const focusedCardIndexes = useRecoilComponentValueV2( + const focusedCardIndexes = useAtomComponentStateValue( focusedRecordBoardCardIndexesComponentState, recordBoardId, ); - const isFocusActive = useRecoilComponentValueV2( + const isFocusActive = useAtomComponentStateValue( isRecordBoardCardFocusActiveComponentState, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardSelectRecordsEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardSelectRecordsEffect.tsx index 3c234a6002..4ccc59c3fe 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardSelectRecordsEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardSelectRecordsEffect.tsx @@ -3,17 +3,17 @@ import { useEffect } from 'react'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export const RecordBoardSelectRecordsEffect = () => { const { recordIndexId } = useRecordIndexContextOrThrow(); - const selectedRecordIds = useRecoilComponentSelectorValueV2( + const selectedRecordIds = useAtomComponentSelectorValue( recordBoardSelectedRecordIdsComponentSelector, ); - const setContextStoreTargetedRecords = useSetRecoilComponentStateV2( + const setContextStoreTargetedRecords = useSetAtomComponentState( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardStickyHeaderEffect.tsx b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardStickyHeaderEffect.tsx index 9ba2a5d52f..837c306080 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardStickyHeaderEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/components/RecordBoardStickyHeaderEffect.tsx @@ -1,9 +1,9 @@ import { scrollWrapperScrollTopComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useEffect } from 'react'; export const RecordBoardStickyHeaderEffect = () => { - const scrollTop = useRecoilComponentValueV2( + const scrollTop = useAtomComponentStateValue( scrollWrapperScrollTopComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useActiveRecordBoardCard.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useActiveRecordBoardCard.ts index ad4ae447fc..d64b0973aa 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useActiveRecordBoardCard.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useActiveRecordBoardCard.ts @@ -4,17 +4,17 @@ import { useStore } from 'jotai'; import { activeRecordBoardCardIndexesComponentState } from '@/object-record/record-board/states/activeRecordBoardCardIndexesComponentState'; import { isRecordBoardCardActiveComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardActiveComponentFamilyState'; import { type BoardCardIndexes } from '@/object-record/record-board/types/BoardCardIndexes'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { isDefined } from 'twenty-shared/utils'; export const useActiveRecordBoardCard = (recordBoardId?: string) => { - const isCardActiveState = useRecoilComponentFamilyStateCallbackStateV2( + const isCardActiveState = useAtomComponentFamilyStateCallbackState( isRecordBoardCardActiveComponentFamilyState, recordBoardId, ); - const activeBoardCardIndexesState = useRecoilComponentStateCallbackStateV2( + const activeBoardCardIndexesState = useAtomComponentStateCallbackState( activeRecordBoardCardIndexesComponentState, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts index d51709f2bb..0fd19346f3 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useFocusedRecordBoardCard.ts @@ -7,24 +7,24 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePush import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import { useStore } from 'jotai'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useFocusedRecordBoardCard = (recordBoardId?: string) => { const store = useStore(); - const isCardFocused = useRecoilComponentFamilyStateCallbackStateV2( + const isCardFocused = useAtomComponentFamilyStateCallbackState( isRecordBoardCardFocusedComponentFamilyState, recordBoardId, ); - const focusedBoardCardIndexes = useRecoilComponentStateCallbackStateV2( + const focusedBoardCardIndexes = useAtomComponentStateCallbackState( focusedRecordBoardCardIndexesComponentState, recordBoardId, ); - const isCardFocusActive = useRecoilComponentStateCallbackStateV2( + const isCardFocusActive = useAtomComponentStateCallbackState( isRecordBoardCardFocusActiveComponentState, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useGetShouldInitializeRecordBoardForUpdateInputs.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useGetShouldInitializeRecordBoardForUpdateInputs.ts index 3c92363f45..650ef3c78e 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useGetShouldInitializeRecordBoardForUpdateInputs.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useGetShouldInitializeRecordBoardForUpdateInputs.ts @@ -4,7 +4,7 @@ import { useRecordIndexContextOrThrow } from '@/object-record/record-index/conte import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { type ObjectRecordOperationUpdateInput } from '@/object-record/types/ObjectRecordOperationUpdateInput'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldMetadataType } from 'twenty-shared/types'; import { isDefined, mapById } from 'twenty-shared/utils'; @@ -15,15 +15,15 @@ export const useGetShouldInitializeRecordBoardForUpdateInputs = () => { objectMetadataItem, }); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const recordIndexGroupFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts index 63cf95286d..82b0f0212c 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardHotkeys.ts @@ -9,8 +9,8 @@ import { RecordBoardCardContext } from '@/object-record/record-board/record-boar import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState'; import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useContext } from 'react'; import { Key } from 'ts-key-enum'; @@ -27,12 +27,12 @@ export const useRecordBoardCardHotkeys = (focusId: string) => { const { resetRecordBoardSelection } = useResetRecordBoardSelection(); const { unfocusBoardCard } = useFocusedRecordBoardCard(recordBoardId); - const isRecordBoardCardSelected = useRecoilComponentFamilyValueV2( + const isRecordBoardCardSelected = useAtomComponentFamilyStateValue( isRecordBoardCardSelectedComponentFamilyState, recordId, ); - const selectedRecordIds = useRecoilComponentSelectorValueV2( + const selectedRecordIds = useAtomComponentSelectorValue( recordBoardSelectedRecordIdsComponentSelector, recordBoardId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardNavigation.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardNavigation.ts index 90564bd5cb..8e9b16d583 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardNavigation.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardCardNavigation.ts @@ -5,9 +5,9 @@ import { useFocusedRecordBoardCard } from '@/object-record/record-board/hooks/us import { focusedRecordBoardCardIndexesComponentState } from '@/object-record/record-board/states/focusedRecordBoardCardIndexesComponentState'; import { visibleRecordGroupIdsComponentFamilySelector } from '@/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; import { ViewType } from '@/views/types/ViewType'; import { isDefined } from 'twenty-shared/utils'; @@ -17,17 +17,17 @@ export const useRecordBoardCardNavigation = (recordBoardId?: string) => { const store = useStore(); const { focusBoardCard } = useFocusedRecordBoardCard(recordBoardId); - const focusedBoardCardIndexes = useRecoilComponentStateCallbackStateV2( + const focusedBoardCardIndexes = useAtomComponentStateCallbackState( focusedRecordBoardCardIndexesComponentState, recordBoardId, ); - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, ViewType.Kanban, ); - const recordIdsByGroupState = useRecoilComponentFamilyStateCallbackStateV2( + const recordIdsByGroupState = useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelection.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelection.ts index 18328d1bb9..d5d82eeb8a 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelection.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRecordBoardSelection.ts @@ -5,8 +5,8 @@ import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/r import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -17,16 +17,15 @@ export const useRecordBoardSelection = (recordBoardId?: string) => { ); const isRecordBoardCardSelectedFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordBoardCardSelectedComponentFamilyState, recordBoardId, ); - const recordBoardSelectedRecordIds = - useRecoilComponentSelectorCallbackStateV2( - recordBoardSelectedRecordIdsComponentSelector, - recordBoardId, - ); + const recordBoardSelectedRecordIds = useAtomComponentSelectorCallbackState( + recordBoardSelectedRecordIdsComponentSelector, + recordBoardId, + ); const { closeDropdown } = useCloseDropdown(); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveRecordsFromBoard.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveRecordsFromBoard.ts index 3c2b3f082c..311f690e80 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveRecordsFromBoard.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveRecordsFromBoard.ts @@ -4,26 +4,25 @@ import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record import { useStore } from 'jotai'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilySelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilySelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useRemoveRecordsFromBoard = () => { const store = useStore(); - const recordIndexGroupFieldMetadataItem = - useRecoilComponentStateCallbackStateV2( - recordIndexGroupFieldMetadataItemComponentState, - ); + const recordIndexGroupFieldMetadataItem = useAtomComponentStateCallbackState( + recordIndexGroupFieldMetadataItemComponentState, + ); const recordGroupFromGroupValueFamilyCallbackState = - useRecoilComponentFamilySelectorCallbackStateV2( + useAtomComponentFamilySelectorCallbackState( recordGroupFromGroupValueComponentFamilySelector, ); const recordIndexRecordIdsByGroupFamilyCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveSelectedRecordsFromRecordBoard.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveSelectedRecordsFromRecordBoard.ts index 89cb3dda9d..d5ee347e08 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveSelectedRecordsFromRecordBoard.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useRemoveSelectedRecordsFromRecordBoard.ts @@ -5,10 +5,10 @@ import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/r import { recordGroupDefinitionsComponentSelector } from '@/object-record/record-group/states/selectors/recordGroupDefinitionsComponentSelector'; import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useCallback } from 'react'; import { isDefined, isNonEmptyArray } from 'twenty-shared/utils'; @@ -16,27 +16,26 @@ export const useRemoveSelectedRecordsFromRecordBoard = ( recordBoardIndexId: string, ) => { const store = useStore(); - const recordGroupDefinitions = useRecoilComponentSelectorValueV2( + const recordGroupDefinitions = useAtomComponentSelectorValue( recordGroupDefinitionsComponentSelector, recordBoardIndexId, ); - const groupByFieldMetadataItem = useRecoilComponentValueV2( + const groupByFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, recordBoardIndexId, ); const recordIndexRecordIdsByGroupCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, recordBoardIndexId, ); - const recordBoardSelectedRecordIds = - useRecoilComponentSelectorCallbackStateV2( - recordBoardSelectedRecordIdsComponentSelector, - recordBoardIndexId, - ); + const recordBoardSelectedRecordIds = useAtomComponentSelectorCallbackState( + recordBoardSelectedRecordIdsComponentSelector, + recordBoardIndexId, + ); const { resetRecordBoardSelection } = useResetRecordBoardSelection(recordBoardIndexId); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useResetRecordBoardSelection.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useResetRecordBoardSelection.ts index 983e3c45f0..d280bc0ae4 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useResetRecordBoardSelection.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useResetRecordBoardSelection.ts @@ -5,8 +5,8 @@ import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/r import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -17,16 +17,15 @@ export const useResetRecordBoardSelection = (recordBoardId?: string) => { ); const isRecordBoardCardSelectedFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordBoardCardSelectedComponentFamilyState, recordBoardId, ); - const recordBoardSelectedRecordIds = - useRecoilComponentSelectorCallbackStateV2( - recordBoardSelectedRecordIdsComponentSelector, - recordBoardId, - ); + const recordBoardSelectedRecordIds = useAtomComponentSelectorCallbackState( + recordBoardSelectedRecordIdsComponentSelector, + recordBoardId, + ); const { closeDropdown } = useCloseDropdown(); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts index a6a890796e..0a171e5714 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSelectAllCards.ts @@ -2,26 +2,25 @@ import { useResetRecordBoardSelection } from '@/object-record/record-board/hooks import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState'; import { allCardsSelectedStatusComponentSelector } from '@/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector'; import { allRecordIdsOfAllRecordGroupsComponentSelector } from '@/object-record/record-index/states/selectors/allRecordIdsOfAllRecordGroupsComponentSelector'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; export const useSelectAllCards = (recordBoardId?: string) => { - const allCardsSelectedStatus = useRecoilComponentSelectorCallbackStateV2( + const allCardsSelectedStatus = useAtomComponentSelectorCallbackState( allCardsSelectedStatusComponentSelector, recordBoardId, ); const isRecordBoardCardSelectedFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordBoardCardSelectedComponentFamilyState, recordBoardId, ); - const allRecordIdsOfAllRecordGroups = - useRecoilComponentSelectorCallbackStateV2( - allRecordIdsOfAllRecordGroupsComponentSelector, - recordBoardId, - ); + const allRecordIdsOfAllRecordGroups = useAtomComponentSelectorCallbackState( + allRecordIdsOfAllRecordGroupsComponentSelector, + recordBoardId, + ); const { resetRecordBoardSelection } = useResetRecordBoardSelection(recordBoardId); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts index d6f09d6a63..ada7809d5f 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useSetRecordIdsForColumn.ts @@ -6,27 +6,27 @@ import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/s import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; import { isDefined } from 'twenty-shared/utils'; import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; export const useSetRecordIdsForColumn = (recordBoardId?: string) => { const store = useStore(); - const recordGroupFieldMetadata = useRecoilComponentStateCallbackStateV2( + const recordGroupFieldMetadata = useAtomComponentStateCallbackState( recordIndexGroupFieldMetadataItemComponentState, recordBoardId, ); const recordIndexRecordIdsByGroupFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, recordBoardId, ); const emptyRecordGroupByIdCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( emptyRecordGroupByIdComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardFetchMore.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardFetchMore.ts index eed8673d0a..d186ce2a10 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardFetchMore.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardFetchMore.ts @@ -16,10 +16,10 @@ import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { getGroupByQueryResultGqlFieldName } from '@/page-layout/utils/getGroupByQueryResultGqlFieldName'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { isNonEmptyArray } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { sortByProperty } from '~/utils/array/sortByProperty'; @@ -27,18 +27,18 @@ import { sleep } from '~/utils/sleep'; export const useTriggerRecordBoardFetchMore = () => { const store = useStore(); - const recordGroupDefinitions = useRecoilComponentSelectorValueV2( + const recordGroupDefinitions = useAtomComponentSelectorValue( recordGroupDefinitionsComponentSelector, ); const { objectMetadataItem } = useRecordIndexContextOrThrow(); - const recordIndexGroupFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); const recordBoardShouldFetchMoreInColumnFamilyCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordBoardShouldFetchMoreInColumnComponentFamilyState, ); @@ -47,7 +47,7 @@ export const useTriggerRecordBoardFetchMore = () => { const { upsertRecordsInStore } = useUpsertRecordsInStore(); const recordBoardCurrentGroupByQueryOffsetCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordBoardCurrentGroupByQueryOffsetComponentState, ); @@ -58,11 +58,11 @@ export const useTriggerRecordBoardFetchMore = () => { }); const recordIndexRecordIdsByGroupCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); - const recordBoardIsFetchingMore = useRecoilComponentStateCallbackStateV2( + const recordBoardIsFetchingMore = useAtomComponentStateCallbackState( recordBoardIsFetchingMoreComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardInitialQuery.ts b/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardInitialQuery.ts index ce833d2af4..ddb1c42cd8 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardInitialQuery.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/hooks/useTriggerRecordBoardInitialQuery.ts @@ -14,44 +14,44 @@ import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useU import { getQueryIdentifier } from '@/object-record/utils/getQueryIdentifier'; import { getGroupByQueryResultGqlFieldName } from '@/page-layout/utils/getGroupByQueryResultGqlFieldName'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isNonEmptyArray } from '@sniptt/guards'; import { useCallback } from 'react'; import { useStore } from 'jotai'; import { isDefined } from 'twenty-shared/utils'; export const useTriggerRecordBoardInitialQuery = () => { - const recordGroupDefinitions = useRecoilComponentSelectorValueV2( + const recordGroupDefinitions = useAtomComponentSelectorValue( recordGroupDefinitionsComponentSelector, ); const { objectMetadataItem } = useRecordIndexContextOrThrow(); - const recordIndexGroupFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); - const setLastRecordBoardQueryIdentifier = useSetRecoilComponentStateV2( + const setLastRecordBoardQueryIdentifier = useSetAtomComponentState( lastRecordBoardQueryIdentifierComponentState, ); const recordBoardShouldFetchMoreInColumnFamilyCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordBoardShouldFetchMoreInColumnComponentFamilyState, ); const recordIndexRecordGroupsAreInInitialLoading = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordIndexRecordGroupsAreInInitialLoadingComponentState, ); const store = useStore(); - const setRecordBoardCurrentGroupByQueryOffset = useSetRecoilComponentStateV2( + const setRecordBoardCurrentGroupByQueryOffset = useSetAtomComponentState( recordBoardCurrentGroupByQueryOffsetComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellEditModePortal.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellEditModePortal.tsx index 68b2e0d94a..2d7add27c9 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellEditModePortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellEditModePortal.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext'; import { RecordBoardCardInputContextProvider } from '@/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardInputContextProvider'; @@ -16,7 +16,7 @@ export const RecordBoardCardCellEditModePortal = () => { const { objectMetadataItem } = useContext(RecordBoardContext); const { recordId } = useContext(RecordBoardCardContext); - const editModePosition = useRecoilComponentValueV2( + const editModePosition = useAtomComponentStateValue( recordBoardCardEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellHoveredPortalContent.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellHoveredPortalContent.tsx index 25be176ad7..643bda1a44 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellHoveredPortalContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardCellHoveredPortalContent.tsx @@ -10,8 +10,8 @@ import { RecordInlineCellDisplayMode } from '@/object-record/record-inline-cell/ import { RecordInlineCellHoveredPortalContent } from '@/object-record/record-inline-cell/components/RecordInlineCellHoveredPortalContent'; import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext } from 'react'; export const RecordBoardCardCellHoveredPortalContent = () => { @@ -32,9 +32,9 @@ export const RecordBoardCardCellHoveredPortalContent = () => { !isRecordFieldReadOnly && !editModeContentOnly; const [recordBoardCardHoverPosition, setRecordBoardCardHoverPosition] = - useRecoilComponentStateV2(recordBoardCardHoverPositionComponentState); + useAtomComponentState(recordBoardCardHoverPositionComponentState); - const setRecordBoardCardEditModePosition = useSetRecoilComponentStateV2( + const setRecordBoardCardEditModePosition = useSetAtomComponentState( recordBoardCardEditModePositionComponentState, ); const { openFieldInput } = useOpenFieldInputEditMode(); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardInputContextProvider.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardInputContextProvider.tsx index 056aea7c5a..3937c5f573 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardInputContextProvider.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/anchored-portal/components/RecordBoardCardInputContextProvider.tsx @@ -10,7 +10,7 @@ import { import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell'; import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { useAvailableComponentInstanceId } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceId'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -23,7 +23,7 @@ export const RecordBoardCardInputContextProvider = ({ }: RecordBoardCardInputContextProviderProps) => { const store = useStore(); const { closeInlineCell } = useInlineCell(); - const setRecordBoardCardEditModePosition = useSetRecoilComponentStateV2( + const setRecordBoardCardEditModePosition = useSetAtomComponentState( recordBoardCardEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx index d6797aeac9..b8e345c6a0 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCard.tsx @@ -25,10 +25,10 @@ import { RecordFieldsScopeContextProvider } from '@/object-record/record-field-l import { useOpenRecordFromIndexView } from '@/object-record/record-index/hooks/useOpenRecordFromIndexView'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import styled from '@emotion/styled'; import { useContext } from 'react'; @@ -59,12 +59,12 @@ export const RecordBoardCard = () => { RecordBoardComponentInstanceContext, ); - const isRecordIdPrimaryDragMultiple = useRecoilComponentFamilyValueV2( + const isRecordIdPrimaryDragMultiple = useAtomComponentFamilyStateValue( isRecordIdPrimaryDragMultipleComponentFamilyState, { recordId }, ); - const isRecordIdSecondaryDragMultiple = useRecoilComponentFamilyValueV2( + const isRecordIdSecondaryDragMultiple = useAtomComponentFamilyStateValue( isRecordIdSecondaryDragMultipleComponentFamilyState, { recordId }, ); @@ -73,18 +73,18 @@ export const RecordBoardCard = () => { const isCompactModeActive = currentView?.isCompact ?? false; - const [isCardExpanded, setIsCardExpanded] = useRecoilComponentStateV2( + const [isCardExpanded, setIsCardExpanded] = useAtomComponentState( recordBoardCardIsExpandedComponentState, `record-board-card-${recordId}`, ); const [isCurrentCardSelected, setIsCurrentCardSelected] = - useRecoilComponentFamilyStateV2( + useAtomComponentFamilyState( isRecordBoardCardSelectedComponentFamilyState, recordId, ); - const isCurrentCardFocused = useRecoilComponentFamilyValueV2( + const isCurrentCardFocused = useAtomComponentFamilyStateValue( isRecordBoardCardFocusedComponentFamilyState, { rowIndex, @@ -92,7 +92,7 @@ export const RecordBoardCard = () => { }, ); - const isCurrentCardActive = useRecoilComponentFamilyValueV2( + const isCurrentCardActive = useAtomComponentFamilyStateValue( isRecordBoardCardActiveComponentFamilyState, { rowIndex, @@ -105,7 +105,7 @@ export const RecordBoardCard = () => { const actionMenuDropdownId = getActionMenuDropdownIdFromActionMenuId(actionMenuId); - const setActionMenuDropdownPosition = useSetRecoilComponentStateV2( + const setActionMenuDropdownPosition = useSetAtomComponentState( recordIndexActionMenuDropdownPositionComponentState, actionMenuDropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardBody.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardBody.tsx index 712bdf8fa6..0c3d8b2d17 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardBody.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardBody.tsx @@ -15,8 +15,8 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-fiel import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext } from 'react'; export const RecordBoardCardBody = () => { @@ -40,7 +40,7 @@ export const RecordBoardCardBody = () => { return [updateEntity, { loading: false }]; }; - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); @@ -49,7 +49,7 @@ export const RecordBoardCardBody = () => { recordField.fieldMetadataItemId !== labelIdentifierFieldMetadataItem?.id, ); - const setRecordBoardCardHoverPosition = useSetRecoilComponentStateV2( + const setRecordBoardCardHoverPosition = useSetAtomComponentState( recordBoardCardHoverPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardDraggableContainer.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardDraggableContainer.tsx index 07f36acc28..4083d59c38 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardDraggableContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardDraggableContainer.tsx @@ -11,7 +11,7 @@ import { RecordBoardCardContext } from '@/object-record/record-board/record-boar import { RecordBoardColumnContext } from '@/object-record/record-board/record-board-column/contexts/RecordBoardColumnContext'; import { isRecordBoardCardFocusedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardFocusedComponentFamilyState'; import { DragAndDropLibraryLegacyReRenderBreaker } from '@/ui/drag-and-drop/components/DragAndDropReRenderBreaker'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; const StyledDraggableContainer = styled.div` position: relative; @@ -36,7 +36,7 @@ export const RecordBoardCardDraggableContainer = ({ const { columnIndex } = useContext(RecordBoardColumnContext); - const isRecordBoardCardFocusActive = useRecoilComponentFamilyValueV2( + const isRecordBoardCardFocusActive = useAtomComponentFamilyStateValue( isRecordBoardCardFocusedComponentFamilyState, { rowIndex, diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx index 65f921746a..d0cb6c1695 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardHeader.tsx @@ -12,10 +12,10 @@ import { RecordCardHeaderContainer } from '@/object-record/record-card/component import { useOpenRecordFromIndexView } from '@/object-record/record-index/hooks/useOpenRecordFromIndexView'; import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; import styled from '@emotion/styled'; @@ -54,7 +54,7 @@ export const RecordBoardCardHeader = () => { const isCompactModeActive = currentView?.isCompact ?? false; - const [isCardExpanded, setIsCardExpanded] = useRecoilComponentStateV2( + const [isCardExpanded, setIsCardExpanded] = useAtomComponentState( recordBoardCardIsExpandedComponentState, ); @@ -62,18 +62,18 @@ export const RecordBoardCardHeader = () => { useRecordBoardSelection(recordBoardId); const [isCurrentCardSelected, setIsCurrentCardSelected] = - useRecoilComponentFamilyStateV2( + useAtomComponentFamilyState( isRecordBoardCardSelectedComponentFamilyState, recordId, ); const { openRecordFromIndexView } = useOpenRecordFromIndexView(); - const recordIndexOpenRecordIn = useRecoilValueV2( + const recordIndexOpenRecordIn = useAtomStateValue( recordIndexOpenRecordInState, ); - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const record = useAtomFamilyStateValue(recordStoreFamilyState, recordId); const triggerEvent = recordIndexOpenRecordIn === ViewOpenRecordInType.SIDE_PANEL diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragCounterChip.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragCounterChip.tsx index 62c3be9717..edb2bdedbe 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragCounterChip.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragCounterChip.tsx @@ -1,5 +1,5 @@ import { originalDragSelectionComponentState } from '@/object-record/record-drag/states/originalDragSelectionComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { NotificationCounter } from 'twenty-ui/navigation'; @@ -11,7 +11,7 @@ const StyledNotificationCounter = styled(NotificationCounter)` `; export const RecordBoardCardMultiDragCounterChip = () => { - const originalDragSelection = useRecoilComponentValueV2( + const originalDragSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragPreview.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragPreview.tsx index e951dc2202..42bca8d7e6 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragPreview.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragPreview.tsx @@ -1,14 +1,14 @@ import { RecordBoardCardMultiDragCounterChip } from '@/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragCounterChip'; import { RecordBoardCardContext } from '@/object-record/record-board/record-board-card/contexts/RecordBoardCardContext'; import { isRecordIdPrimaryDragMultipleComponentFamilyState } from '@/object-record/record-drag/states/isRecordIdPrimaryDragMultipleComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { useContext } from 'react'; // TODO: use the same concept as PortalHovered components in the app export const RecordBoardCardMultiDragPreview = () => { const { recordId } = useContext(RecordBoardCardContext); - const isRecordIdPrimaryDragMultiple = useRecoilComponentFamilyValueV2( + const isRecordIdPrimaryDragMultiple = useAtomComponentFamilyStateValue( isRecordIdPrimaryDragMultipleComponentFamilyState, { recordId }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragStack.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragStack.tsx index b9e1fb3fb5..0b4f1ec1a5 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragStack.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/components/RecordBoardCardMultiDragStack.tsx @@ -1,5 +1,5 @@ import { originalDragSelectionComponentState } from '@/object-record/record-drag/states/originalDragSelectionComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; const StyledRecordBoardCardStackCard = styled.div<{ offset: number }>` @@ -15,7 +15,7 @@ const StyledRecordBoardCardStackCard = styled.div<{ offset: number }>` `; export const RecordBoardCardMultiDragStack = () => { - const originalDragSelection = useRecoilComponentValueV2( + const originalDragSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/hooks/useRecordBoardCardMetadataFromPosition.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/hooks/useRecordBoardCardMetadataFromPosition.ts index c70281fbdb..d6bb3826a2 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/hooks/useRecordBoardCardMetadataFromPosition.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/hooks/useRecordBoardCardMetadataFromPosition.ts @@ -3,23 +3,23 @@ import { recordBoardCardEditModePositionComponentState } from '@/object-record/r import { recordBoardCardHoverPositionComponentState } from '@/object-record/record-board/record-board-card/states/recordBoardCardHoverPositionComponentState'; import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useRecordBoardCardMetadataFromPosition = () => { const { objectMetadataItem } = useContext(RecordBoardContext); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordBoardCardHoverPositionComponentState, ); - const editModePosition = useRecoilComponentValueV2( + const editModePosition = useAtomComponentStateValue( recordBoardCardEditModePositionComponentState, ); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardEditModePositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardEditModePositionComponentState.ts index 72568be946..5d5428322d 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardEditModePositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardEditModePositionComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardCardComponentInstanceContext } from '@/object-record/record-board/record-board-card/states/contexts/RecordBoardCardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordBoardCardEditModePositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordBoardCardEditModePositionComponentState', defaultValue: null, componentInstanceContext: RecordBoardCardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardHoverPositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardHoverPositionComponentState.ts index cdb5066ab0..542df9098b 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardHoverPositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardHoverPositionComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardCardComponentInstanceContext } from '@/object-record/record-board/record-board-card/states/contexts/RecordBoardCardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordBoardCardHoverPositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordBoardCardHoverPositionComponentState', defaultValue: null, componentInstanceContext: RecordBoardCardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardIsExpandedComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardIsExpandedComponentState.ts index ab598dcf0c..15a9197372 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardIsExpandedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-card/states/recordBoardCardIsExpandedComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardCardComponentInstanceContext } from '@/object-record/record-board/record-board-card/states/contexts/RecordBoardCardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordBoardCardIsExpandedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordBoardCardIsExpandedComponentState', defaultValue: false, componentInstanceContext: RecordBoardCardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumn.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumn.tsx index 5ca76180e3..67c5a233aa 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumn.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumn.tsx @@ -7,8 +7,8 @@ import { useShouldHideRecordGroup } from '@/object-record/record-group/hooks/use import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { DragAndDropLibraryLegacyReRenderBreaker } from '@/ui/drag-and-drop/components/DragAndDropReRenderBreaker'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; const StyledColumn = styled.div` @@ -34,11 +34,11 @@ export const RecordBoardColumn = ({ recordBoardColumnId, recordBoardColumnIndex, }: RecordBoardColumnProps) => { - const recordGroupDefinition = useFamilyRecoilValueV2( + const recordGroupDefinition = useAtomFamilyStateValue( recordGroupDefinitionFamilyState, recordBoardColumnId, ); - const recordIdsByGroup = useRecoilComponentFamilyValueV2( + const recordIdsByGroup = useAtomComponentFamilyStateValue( recordIndexRecordIdsByGroupComponentFamilyState, recordBoardColumnId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx index f6f6041311..09d3a3fa7a 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx @@ -6,7 +6,7 @@ import { SKELETON_LOADER_HEIGHT_SIZES } from '@/activities/components/SkeletonLo import { RecordCardBodyContainer } from '@/object-record/record-card/components/RecordCardBodyContainer'; import { RecordCardHeaderContainer } from '@/object-record/record-card/components/RecordCardHeaderContainer'; import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; const StyledSkeletonIconAndText = styled.div` @@ -41,7 +41,7 @@ export const RecordBoardColumnCardContainerSkeletonLoader = () => { const isCompactModeActive = currentView?.isCompact ?? false; - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardsContainer.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardsContainer.tsx index ac2015156e..bd3a5a90fa 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardsContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardsContainer.tsx @@ -10,7 +10,7 @@ import { RecordBoardColumnContext } from '@/object-record/record-board/record-bo import { RecordBoardColumnLoadingSkeletonCards } from '@/object-record/record-board/record-board-column/components/RecordBoardColumnLoadingSkeletonCards'; import { recordBoardShouldFetchMoreInColumnComponentFamilyState } from '@/object-record/record-board/states/recordBoardShouldFetchMoreInColumnComponentFamilyState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; const StyledColumnCardsContainer = styled.div` display: flex; @@ -33,12 +33,12 @@ export const RecordBoardColumnCardsContainer = ({ }: RecordBoardColumnCardsContainerProps) => { const { columnDefinition } = useContext(RecordBoardColumnContext); - const recordIds = useRecoilComponentFamilyValueV2( + const recordIds = useAtomComponentFamilyStateValue( recordIndexRecordIdsByGroupComponentFamilyState, recordBoardColumnId, ); - const recordBoardShouldFetchMoreInColumn = useRecoilComponentFamilyValueV2( + const recordBoardShouldFetchMoreInColumn = useAtomComponentFamilyStateValue( recordBoardShouldFetchMoreInColumnComponentFamilyState, recordBoardColumnId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeader.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeader.tsx index 48c99f1201..a9dac3b763 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeader.tsx @@ -15,9 +15,9 @@ import { recordIndexAggregateDisplayValueForGroupValueComponentFamilyState } fro import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useCreateNewIndexRecord'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { useToggleDropdown } from '@/ui/layout/dropdown/hooks/useToggleDropdown'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { Tag } from 'twenty-ui/components'; import { IconDotsVertical, IconPlus } from 'twenty-ui/display'; import { LightIconButton } from 'twenty-ui/input'; @@ -92,7 +92,7 @@ export const RecordBoardColumnHeader = () => { const hasObjectUpdatePermissions = objectPermissions.canUpdateObjectRecords; - const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2( + const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue( hasAnySoftDeleteFilterOnViewComponentSelector, ); @@ -101,12 +101,12 @@ export const RecordBoardColumnHeader = () => { }); const recordIndexAggregateDisplayValueForGroupValue = - useRecoilComponentFamilyValueV2( + useAtomComponentFamilyStateValue( recordIndexAggregateDisplayValueForGroupValueComponentFamilyState, { groupValue: columnDefinition?.value ?? '' }, ); - const recordIndexAggregateDisplayLabel = useRecoilComponentValueV2( + const recordIndexAggregateDisplayLabel = useAtomComponentStateValue( recordIndexAggregateDisplayLabelComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownButton.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownButton.tsx index 8f0b17343f..53be332772 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownButton.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownButton.tsx @@ -1,6 +1,6 @@ import { StyledHeaderDropdownButton } from '@/ui/layout/dropdown/components/StyledHeaderDropdownButton'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { type Nullable } from 'twenty-shared/types'; import { Tag } from 'twenty-ui/components'; @@ -23,7 +23,7 @@ export const RecordBoardColumnHeaderAggregateDropdownButton = ({ value?: Nullable; tooltip?: Nullable; }) => { - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownFieldsContent.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownFieldsContent.tsx index ea5334a7e6..e97188f221 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownFieldsContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownFieldsContent.tsx @@ -9,7 +9,7 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader'; import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useUpdateViewAggregate } from '@/views/hooks/useUpdateViewAggregate'; import { isDefined } from 'twenty-shared/utils'; import { @@ -35,19 +35,19 @@ export const RecordBoardColumnHeaderAggregateDropdownFieldsContent = () => { const { getIcon } = useIcons(); - const aggregateOperation = useRecoilComponentValueV2( + const aggregateOperation = useAtomComponentStateValue( aggregateOperationComponentState, ); - const availableFieldsIdsForAggregateOperation = useRecoilComponentValueV2( + const availableFieldsIdsForAggregateOperation = useAtomComponentStateValue( availableFieldIdsForAggregateOperationComponentState, ); - const recordIndexGroupAggregateOperation = useRecoilComponentValueV2( + const recordIndexGroupAggregateOperation = useAtomComponentStateValue( recordIndexGroupAggregateOperationComponentState, ); - const recordIndexGroupAggregateFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupAggregateFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupAggregateFieldMetadataItemComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx index 13dd1f496a..ab0d601285 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx @@ -15,8 +15,8 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader'; import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useUpdateViewAggregate } from '@/views/hooks/useUpdateViewAggregate'; import isEmpty from 'lodash.isempty'; import { IconCheck, IconChevronLeft } from 'twenty-ui/display'; @@ -35,17 +35,17 @@ export const RecordBoardColumnHeaderAggregateDropdownOptionsContent = ({ }, ); - const setAggregateOperation = useSetRecoilComponentStateV2( + const setAggregateOperation = useSetAtomComponentState( aggregateOperationComponentState, ); - const setAvailableFieldsForAggregateOperation = useSetRecoilComponentStateV2( + const setAvailableFieldsForAggregateOperation = useSetAtomComponentState( availableFieldIdsForAggregateOperationComponentState, ); const { updateViewAggregate } = useUpdateViewAggregate(); - const recordIndexGroupAggregateOperation = useRecoilComponentValueV2( + const recordIndexGroupAggregateOperation = useAtomComponentStateValue( recordIndexGroupAggregateOperationComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderWrapper.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderWrapper.tsx index a2853b6041..e2e10b8b99 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderWrapper.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderWrapper.tsx @@ -3,8 +3,8 @@ import { RecordBoardColumnContext } from '@/object-record/record-board/record-bo import { useShouldHideRecordGroup } from '@/object-record/record-group/hooks/useShouldHideRecordGroup'; import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; type RecordBoardColumnHeaderWrapperProps = { @@ -16,12 +16,12 @@ export const RecordBoardColumnHeaderWrapper = ({ columnId, columnIndex, }: RecordBoardColumnHeaderWrapperProps) => { - const recordGroupDefinition = useFamilyRecoilValueV2( + const recordGroupDefinition = useAtomFamilyStateValue( recordGroupDefinitionFamilyState, columnId, ); - const recordIdsByGroup = useRecoilComponentFamilyValueV2( + const recordIdsByGroup = useAtomComponentFamilyStateValue( recordIndexRecordIdsByGroupComponentFamilyState, columnId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx index cf85d7c5a8..9505ded406 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnNewRecordButton.tsx @@ -3,7 +3,7 @@ import { RecordBoardContext } from '@/object-record/record-board/contexts/Record import { RecordBoardColumnContext } from '@/object-record/record-board/record-board-column/contexts/RecordBoardColumnContext'; import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/record-filter/states/hasAnySoftDeleteFilterOnView'; import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useCreateNewIndexRecord'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -35,7 +35,7 @@ export const RecordBoardColumnNewRecordButton = () => { const { columnDefinition } = useContext(RecordBoardColumnContext); - const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2( + const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue( hasAnySoftDeleteFilterOnViewComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateOperationComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateOperationComponentState.ts index 2e7dd5e7d3..ab1284914c 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateOperationComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/aggregateOperationComponentState.ts @@ -1,9 +1,9 @@ import { RecordBoardColumnHeaderAggregateDropdownComponentInstanceContext } from '@/object-record/record-board/contexts/RecordBoardColumnHeaderAggregateDropdownComponentInstanceContext'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const aggregateOperationComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'aggregateOperationComponentFamilyState', defaultValue: null, componentInstanceContext: diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/availableFieldIdsForAggregateOperationComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/availableFieldIdsForAggregateOperationComponentState.ts index 0cef6b6732..c9fa54076e 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/availableFieldIdsForAggregateOperationComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/states/availableFieldIdsForAggregateOperationComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardColumnHeaderAggregateDropdownComponentInstanceContext } from '@/object-record/record-board/contexts/RecordBoardColumnHeaderAggregateDropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const availableFieldIdsForAggregateOperationComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'availableFieldIdsForAggregateOperationComponentFamilyState', defaultValue: [], componentInstanceContext: diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIndexesComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIndexesComponentState.ts index 086193aa27..691c242a4c 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIndexesComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIndexesComponentState.ts @@ -1,9 +1,9 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; import { type BoardCardIndexes } from '@/object-record/record-board/types/BoardCardIndexes'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const activeRecordBoardCardIndexesComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'activeRecordBoardCardIndexesComponentState', defaultValue: null, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/focusedRecordBoardCardIndexesComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/focusedRecordBoardCardIndexesComponentState.ts index 6861dd578d..1253552d78 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/focusedRecordBoardCardIndexesComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/focusedRecordBoardCardIndexesComponentState.ts @@ -1,9 +1,9 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; import { type BoardCardIndexes } from '@/object-record/record-board/types/BoardCardIndexes'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const focusedRecordBoardCardIndexesComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'focusedRecordBoardCardIndexesComponentState', defaultValue: null, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardActiveComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardActiveComponentFamilyState.ts index 5781a75ee0..022659f496 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardActiveComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardActiveComponentFamilyState.ts @@ -1,9 +1,9 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; import { type BoardCardIndexes } from '@/object-record/record-board/types/BoardCardIndexes'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const isRecordBoardCardActiveComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordBoardCardActiveComponentFamilyState', defaultValue: false, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusActiveComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusActiveComponentState.ts index 005a12e7a6..021d2c76fe 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusActiveComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusActiveComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isRecordBoardCardFocusActiveComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isRecordBoardCardFocusActiveComponentState', defaultValue: false, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusedComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusedComponentFamilyState.ts index 116ace6d4c..f8a2259854 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusedComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardFocusedComponentFamilyState.ts @@ -1,9 +1,9 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; import { type BoardCardIndexes } from '@/object-record/record-board/types/BoardCardIndexes'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const isRecordBoardCardFocusedComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordBoardCardFocusedComponentFamilyState', defaultValue: false, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState.ts index 873a22707b..0feba7af83 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState.ts @@ -1,8 +1,8 @@ -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; export const isRecordBoardCardSelectedComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordBoardCardSelectedComponentFamilyState', defaultValue: false, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardFetchingRecordsByColumnFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardFetchingRecordsByColumnFamilyState.ts index b419a397bb..64081ee543 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardFetchingRecordsByColumnFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardFetchingRecordsByColumnFamilyState.ts @@ -1,8 +1,8 @@ import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; export const isRecordBoardFetchingRecordsByColumnFamilyState = - createFamilyStateV2({ + createAtomFamilyState({ key: 'isRecordBoardFetchingRecordsByColumnFamilyState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordBoardQueryIdentifierComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordBoardQueryIdentifierComponentState.ts index 8f5e32a320..369ea64048 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordBoardQueryIdentifierComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordBoardQueryIdentifierComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const lastRecordBoardQueryIdentifierComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'lastRecordBoardQueryIdentifierComponentState', componentInstanceContext: RecordBoardComponentInstanceContext, defaultValue: '', diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordGroupIdsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordGroupIdsComponentState.ts index 09eed15cd5..aaae175e11 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordGroupIdsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/lastRecordGroupIdsComponentState.ts @@ -1,7 +1,7 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const lastRecordGroupIdsComponentState = createComponentStateV2< +export const lastRecordGroupIdsComponentState = createAtomComponentState< string[] >({ key: 'lastRecordGroupIdsComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCurrentGroupByQueryOffsetComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCurrentGroupByQueryOffsetComponentState.ts index d171b787a6..8b4d32ca82 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCurrentGroupByQueryOffsetComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCurrentGroupByQueryOffsetComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordBoardCurrentGroupByQueryOffsetComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordBoardCurrentGroupByQueryOffsetComponentState', defaultValue: 0, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardIsFetchingMoreComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardIsFetchingMoreComponentState.ts index a88024f359..c677e44cf9 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardIsFetchingMoreComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardIsFetchingMoreComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordBoardIsFetchingMoreComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordBoardIsFetchingMoreComponentState', defaultValue: false, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreComponentState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreComponentState.ts index e76fff4af0..4c32736e7d 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreComponentState.ts @@ -1,8 +1,8 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordBoardShouldFetchMoreComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordBoardShouldFetchMoreComponentState', defaultValue: false, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreInColumnComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreInColumnComponentFamilyState.ts index f0356ae6ac..23980e9133 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreInColumnComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardShouldFetchMoreInColumnComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const recordBoardShouldFetchMoreInColumnComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'recordBoardShouldFetchMoreInColumnComponentFamilyState', defaultValue: true, componentInstanceContext: RecordBoardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts index 7723e3cc62..e1bce9f0b3 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/allCardsSelectedStatusComponentSelector.ts @@ -1,11 +1,11 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; import { recordBoardSelectedRecordIdsComponentSelector } from '@/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector'; import { allRecordIdsOfAllRecordGroupsComponentSelector } from '@/object-record/record-index/states/selectors/allRecordIdsOfAllRecordGroupsComponentSelector'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { type AllRowsSelectedStatus } from '@/object-record/record-table/types/AllRowSelectedStatus'; export const allCardsSelectedStatusComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'allCardsSelectedStatusComponentSelector', componentInstanceContext: RecordBoardComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector.ts index b9287b3eea..c8679a9d2c 100644 --- a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/recordBoardSelectedRecordIdsComponentSelector.ts @@ -1,10 +1,10 @@ import { RecordBoardComponentInstanceContext } from '@/object-record/record-board/states/contexts/RecordBoardComponentInstanceContext'; import { isRecordBoardCardSelectedComponentFamilyState } from '@/object-record/record-board/states/isRecordBoardCardSelectedComponentFamilyState'; import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const recordBoardSelectedRecordIdsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'recordBoardSelectedRecordIdsSelector', componentInstanceContext: RecordBoardComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx index 63fb834b93..f1bb68d504 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarAddNew.tsx @@ -5,8 +5,8 @@ import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/r import { recordIndexCalendarFieldMetadataIdState } from '@/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState'; import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useCreateNewIndexRecord'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { type Temporal } from 'temporal-polyfill'; @@ -40,11 +40,11 @@ export const RecordCalendarAddNew = ({ const hasObjectUpdatePermissions = objectPermissions.canUpdateObjectRecords; - const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2( + const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue( hasAnySoftDeleteFilterOnViewComponentSelector, ); - const recordIndexCalendarFieldMetadataId = useRecoilValueV2( + const recordIndexCalendarFieldMetadataId = useAtomStateValue( recordIndexCalendarFieldMetadataIdState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarSSESubscribeEffect.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarSSESubscribeEffect.tsx index 5e624474a9..8d3c492e68 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarSSESubscribeEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarSSESubscribeEffect.tsx @@ -5,7 +5,7 @@ import { RecordCalendarComponentInstanceContext } from '@/object-record/record-c import { recordCalendarSelectedDateComponentState } from '@/object-record/record-calendar/states/recordCalendarSelectedDateComponentState'; import { useListenToEventsForQuery } from '@/sse-db-event/hooks/useListenToEventsForQuery'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type RecordGqlOperationOrderBy } from 'twenty-shared/types'; export const RecordCalendarSSESubscribeEffect = () => { @@ -13,7 +13,7 @@ export const RecordCalendarSSESubscribeEffect = () => { RecordCalendarComponentInstanceContext, ); const { objectMetadataItem } = useRecordCalendarContextOrThrow(); - const recordCalendarSelectedDate = useRecoilComponentValueV2( + const recordCalendarSelectedDate = useAtomComponentStateValue( recordCalendarSelectedDateComponentState, ); const { dateRangeFilter } = useRecordCalendarQueryDateRangeFilter( diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarTopBar.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarTopBar.tsx index 6f62665fc4..767c94d6cf 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarTopBar.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordCalendarTopBar.tsx @@ -8,7 +8,7 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { type DropdownOffset } from '@/ui/layout/dropdown/types/DropdownOffset'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { format } from 'date-fns'; @@ -52,7 +52,7 @@ export const RecordCalendarTopBar = () => { ); const [recordCalendarSelectedDate, setRecordCalendarSelectedDate] = - useRecoilComponentStateV2(recordCalendarSelectedDateComponentState); + useAtomComponentState(recordCalendarSelectedDateComponentState); const datePickerDropdownId = `record-calendar-date-picker-${recordCalendarId}`; const { closeDropdown } = useCloseDropdown(); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarDataLoaderEffect.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarDataLoaderEffect.tsx index d2d0142765..8dc88dd5e4 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarDataLoaderEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarDataLoaderEffect.tsx @@ -7,9 +7,9 @@ import { recordCalendarSelectedDateComponentState } from '@/object-record/record import { recordCalendarSelectedRecordIdsComponentSelector } from '@/object-record/record-calendar/states/selectors/recordCalendarSelectedRecordIdsComponentSelector'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect } from 'react'; export const RecordIndexCalendarDataLoaderEffect = () => { @@ -17,24 +17,24 @@ export const RecordIndexCalendarDataLoaderEffect = () => { RecordCalendarComponentInstanceContext, ); - const selectedRecordIds = useRecoilComponentSelectorValueV2( + const selectedRecordIds = useAtomComponentSelectorValue( recordCalendarSelectedRecordIdsComponentSelector, recordCalendarId, ); - const recordCalendarSelectedDate = useRecoilComponentValueV2( + const recordCalendarSelectedDate = useAtomComponentStateValue( recordCalendarSelectedDateComponentState, recordCalendarId, ); const { upsertRecordsInStore } = useUpsertRecordsInStore(); - const setContextStoreTargetedRecords = useSetRecoilComponentStateV2( + const setContextStoreTargetedRecords = useSetAtomComponentState( contextStoreTargetedRecordsRuleComponentState, recordCalendarId, ); - const setRecordCalendarRecordIds = useSetRecoilComponentStateV2( + const setRecordCalendarRecordIds = useSetAtomComponentState( recordCalendarRecordIdsComponentState, recordCalendarId, ); @@ -43,7 +43,7 @@ export const RecordIndexCalendarDataLoaderEffect = () => { recordCalendarSelectedDate, ); - const hasInitializedRecordCalendarSelectedDate = useRecoilComponentValueV2( + const hasInitializedRecordCalendarSelectedDate = useAtomComponentStateValue( hasInitializedRecordCalendarSelectedDateComponentState, recordCalendarId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarSelectedDateInitEffect.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarSelectedDateInitEffect.tsx index a75b7cbd38..fe424f68f3 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarSelectedDateInitEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/components/RecordIndexCalendarSelectedDateInitEffect.tsx @@ -1,19 +1,19 @@ import { hasInitializedRecordCalendarSelectedDateComponentState } from '@/object-record/record-calendar/states/hasInitializedRecordCalendarSelectedDateComponentState'; import { recordCalendarSelectedDateComponentState } from '@/object-record/record-calendar/states/recordCalendarSelectedDateComponentState'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useEffect } from 'react'; import { Temporal } from 'temporal-polyfill'; export const RecordIndexCalendarSelectedDateInitEffect = () => { - const [, setRecordCalendarSelectedDate] = useRecoilComponentStateV2( + const [, setRecordCalendarSelectedDate] = useAtomComponentState( recordCalendarSelectedDateComponentState, ); const [ hasInitializedRecordCalendarSelectedDate, setHasInitializedRecordCalendarSelectedDate, - ] = useRecoilComponentStateV2( + ] = useAtomComponentState( hasInitializedRecordCalendarSelectedDateComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarGroupByRecords.ts b/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarGroupByRecords.ts index 3cba96e7d1..263675dc7c 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarGroupByRecords.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/hooks/useRecordCalendarGroupByRecords.ts @@ -10,7 +10,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { buildGroupByFieldObject } from '@/page-layout/widgets/graph/utils/buildGroupByFieldObject'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; import { useQuery } from '@apollo/client'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useMemo } from 'react'; import { type Temporal } from 'temporal-polyfill'; import { @@ -26,7 +26,7 @@ export const useRecordCalendarGroupByRecords = ( const { userTimezone } = useUserTimezone(); - const recordIndexCalendarFieldMetadataId = useRecoilValueV2( + const recordIndexCalendarFieldMetadataId = useAtomStateValue( recordIndexCalendarFieldMetadataIdState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonth.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonth.tsx index 81b0a18411..da9a68fd37 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonth.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonth.tsx @@ -6,7 +6,7 @@ import { recordCalendarSelectedDateComponentState } from '@/object-record/record import { useEndRecordDrag } from '@/object-record/record-drag/hooks/useEndRecordDrag'; import { useProcessCalendarCardDrop } from '@/object-record/record-drag/hooks/useProcessCalendarCardDrop'; import { useStartRecordDrag } from '@/object-record/record-drag/hooks/useStartRecordDrag'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { DragDropContext, @@ -23,7 +23,7 @@ const StyledContainer = styled.div` `; export const RecordCalendarMonth = () => { - const recordCalendarSelectedDate = useRecoilComponentValueV2( + const recordCalendarSelectedDate = useAtomComponentStateValue( recordCalendarSelectedDateComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonthBodyDay.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonthBodyDay.tsx index 4c81459c5d..9103811170 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonthBodyDay.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/month/components/RecordCalendarMonthBodyDay.tsx @@ -2,8 +2,8 @@ import { RecordCalendarCardDraggableContainer } from '@/object-record/record-cal import { recordCalendarSelectedDateComponentState } from '@/object-record/record-calendar/states/recordCalendarSelectedDateComponentState'; import { calendarDayRecordIdsComponentFamilySelector } from '@/object-record/record-calendar/states/selectors/calendarDayRecordsComponentFamilySelector'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { css } from '@emotion/react'; import styled from '@emotion/styled'; import { Droppable } from '@hello-pangea/dnd'; @@ -108,13 +108,13 @@ export const RecordCalendarMonthBodyDay = ({ }: RecordCalendarMonthBodyDayProps) => { const { userTimezone } = useUserTimezone(); - const recordCalendarSelectedDate = useRecoilComponentValueV2( + const recordCalendarSelectedDate = useAtomComponentStateValue( recordCalendarSelectedDateComponentState, ); const dayKey = day.toString(); - const recordIds = useRecoilComponentFamilySelectorValueV2( + const recordIds = useAtomComponentFamilySelectorValue( calendarDayRecordIdsComponentFamilySelector, { day: day, diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/month/components/__stories__/RecordCalendarMonth.stories.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/month/components/__stories__/RecordCalendarMonth.stories.tsx index 0b667509dc..48f59c0276 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/month/components/__stories__/RecordCalendarMonth.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/month/components/__stories__/RecordCalendarMonth.stories.tsx @@ -8,7 +8,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; import { RecordIndexContextProvider } from '@/object-record/record-index/contexts/RecordIndexContext'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; @@ -19,7 +19,7 @@ import { currentRecordFieldsComponentState } from '@/object-record/record-field/ import { type RecordField } from '@/object-record/record-field/types/RecordField'; import { useRecordIndexFieldMetadataDerivedStates } from '@/object-record/record-index/hooks/useRecordIndexFieldMetadataDerivedStates'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { coreViewsState } from '@/views/states/coreViewState'; import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing'; import { ContextStoreDecorator } from '~/testing/decorators/ContextStoreDecorator'; @@ -39,16 +39,16 @@ const meta: Meta = { )!; const instanceId = companyObjectMetadataItem.id; - const setCurrentRecordFields = useSetRecoilComponentStateV2( + const setCurrentRecordFields = useSetAtomComponentState( currentRecordFieldsComponentState, instanceId, ); - const setCoreViews = useSetRecoilStateV2(coreViewsState); + const setCoreViews = useSetAtomState(coreViewsState); const mockCoreView = mockedCoreViewsData[0]; - const setCurrentViewId = useSetRecoilComponentStateV2( + const setCurrentViewId = useSetAtomComponentState( contextStoreCurrentViewIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarMonthDaysRange.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarMonthDaysRange.tsx index e3f8f1b2b6..27c5b9178c 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarMonthDaysRange.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarMonthDaysRange.tsx @@ -9,7 +9,7 @@ import { format, startOfWeek, } from 'date-fns'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type Temporal } from 'temporal-polyfill'; import { @@ -23,8 +23,8 @@ import { dateLocaleState } from '~/localization/states/dateLocaleState'; export const useRecordCalendarMonthDaysRange = ( selectedDate: Temporal.PlainDate, ) => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); - const dateLocale = useRecoilValueV2(dateLocaleState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); + const dateLocale = useAtomStateValue(dateLocaleState); if (!currentWorkspaceMember) { throw new Error('Current workspace member not found'); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarQueryDateRangeFilter.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarQueryDateRangeFilter.tsx index d469ad8874..0302b81e6b 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarQueryDateRangeFilter.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/month/hooks/useRecordCalendarQueryDateRangeFilter.tsx @@ -7,7 +7,7 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { RecordFilterOperand } from '@/object-record/record-filter/types/RecordFilterOperand'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { t } from '@lingui/core/macro'; import { type Temporal } from 'temporal-polyfill'; @@ -34,19 +34,19 @@ export const useRecordCalendarQueryDateRangeFilter = ( const { currentView } = useGetCurrentViewOnly(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, viewBarInstanceId, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, viewBarInstanceId, ); const { filterValueDependencies } = useFilterValueDependencies(); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, viewBarInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellEditModePortal.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellEditModePortal.tsx index b8675b9cf8..1de59477c4 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellEditModePortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellEditModePortal.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useRecordCalendarContextOrThrow } from '@/object-record/record-calendar/contexts/RecordCalendarContext'; import { RecordCalendarCardInputContextProvider } from '@/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardInputContextProvider'; @@ -19,7 +19,7 @@ export const RecordCalendarCardCellEditModePortal = ({ }: RecordCalendarCardCellEditModePortalProps) => { const { objectMetadataItem } = useRecordCalendarContextOrThrow(); - const editModePosition = useRecoilComponentValueV2( + const editModePosition = useAtomComponentStateValue( recordCalendarCardEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortal.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortal.tsx index 322cd50283..2dd8717b53 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortal.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useRecordCalendarContextOrThrow } from '@/object-record/record-calendar/contexts/RecordCalendarContext'; import { RecordCalendarCardCellHoveredPortalContent } from '@/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortalContent'; @@ -18,7 +18,7 @@ export const RecordCalendarCardCellHoveredPortal = ({ }: RecordCalendarCardCellHoveredPortalProps) => { const { objectMetadataItem } = useRecordCalendarContextOrThrow(); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordCalendarCardHoverPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortalContent.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortalContent.tsx index 051f192135..32aa0906d7 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortalContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardCellHoveredPortalContent.tsx @@ -10,8 +10,8 @@ import { RecordInlineCellDisplayMode } from '@/object-record/record-inline-cell/ import { RecordInlineCellHoveredPortalContent } from '@/object-record/record-inline-cell/components/RecordInlineCellHoveredPortalContent'; import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext } from 'react'; export const RecordCalendarCardCellHoveredPortalContent = () => { @@ -32,9 +32,9 @@ export const RecordCalendarCardCellHoveredPortalContent = () => { !isRecordFieldReadOnly && !editModeContentOnly; const [recordCalendarCardHoverPosition, setRecordCalendarCardHoverPosition] = - useRecoilComponentStateV2(recordCalendarCardHoverPositionComponentState); + useAtomComponentState(recordCalendarCardHoverPositionComponentState); - const setRecordCalendarCardEditModePosition = useSetRecoilComponentStateV2( + const setRecordCalendarCardEditModePosition = useSetAtomComponentState( recordCalendarCardEditModePositionComponentState, ); const { openFieldInput } = useOpenFieldInputEditMode(); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardInputContextProvider.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardInputContextProvider.tsx index d375c92713..de1e875042 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardInputContextProvider.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/anchored-portal/components/RecordCalendarCardInputContextProvider.tsx @@ -10,7 +10,7 @@ import { import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell'; import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { useAvailableComponentInstanceId } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceId'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -23,7 +23,7 @@ export const RecordCalendarCardInputContextProvider = ({ }: RecordCalendarCardInputContextProviderProps) => { const store = useStore(); const { closeInlineCell } = useInlineCell(); - const setRecordCalendarCardEditModePosition = useSetRecoilComponentStateV2( + const setRecordCalendarCardEditModePosition = useSetAtomComponentState( recordCalendarCardEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsx index d092fcc28b..6db54d8208 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard.tsx @@ -14,8 +14,8 @@ import { RecordCard } from '@/object-record/record-card/components/RecordCard'; import { RecordFieldsScopeContextProvider } from '@/object-record/record-field-list/contexts/RecordFieldsScopeContext'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import styled from '@emotion/styled'; import { AnimatedEaseInOut } from 'twenty-ui/utilities'; @@ -37,7 +37,7 @@ export const RecordCalendarCard = ({ recordId }: RecordCalendarCardProps) => { const isCompactModeActive = currentView?.isCompact ?? false; const [isCurrentCardSelected, setIsCurrentCardSelected] = - useRecoilComponentFamilyStateV2( + useAtomComponentFamilyState( isRecordCalendarCardSelectedComponentFamilyState, recordId, ); @@ -51,7 +51,7 @@ export const RecordCalendarCard = ({ recordId }: RecordCalendarCardProps) => { const actionMenuDropdownId = getActionMenuDropdownIdFromActionMenuId(actionMenuId); - const setActionMenuDropdownPosition = useSetRecoilComponentStateV2( + const setActionMenuDropdownPosition = useSetAtomComponentState( recordIndexActionMenuDropdownPositionComponentState, actionMenuDropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardBody.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardBody.tsx index daf1ac26d7..feaa60b0c3 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardBody.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardBody.tsx @@ -15,8 +15,8 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-fiel import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { RecordInlineCell } from '@/object-record/record-inline-cell/components/RecordInlineCell'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; const StyledRecordCardBodyContainer = styled(RecordCardBodyContainer)` @@ -54,7 +54,7 @@ export const RecordCalendarCardBody = ({ fieldDefinitionByFieldMetadataItemId, } = useRecordIndexContextOrThrow(); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); @@ -63,7 +63,7 @@ export const RecordCalendarCardBody = ({ recordField.fieldMetadataItemId !== labelIdentifierFieldMetadataItem?.id, ); - const setRecordCalendarCardHoverPosition = useSetRecoilComponentStateV2( + const setRecordCalendarCardHoverPosition = useSetAtomComponentState( recordCalendarCardHoverPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardDraggableContainer.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardDraggableContainer.tsx index 12765cc683..82d127ccbb 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardDraggableContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardDraggableContainer.tsx @@ -8,7 +8,7 @@ import { useRecordCalendarContextOrThrow } from '@/object-record/record-calendar import { RecordCalendarCard } from '@/object-record/record-calendar/record-calendar-card/components/RecordCalendarCard'; import { RecordCalendarCardComponentInstanceContext } from '@/object-record/record-calendar/record-calendar-card/states/contexts/RecordCalendarCardComponentInstanceContext'; import { recordIndexCalendarFieldMetadataIdState } from '@/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; const StyledDraggableContainer = styled.div` @@ -36,7 +36,7 @@ export const RecordCalendarCardDraggableContainer = ({ objectMetadataItem.id, ); - const recordIndexCalendarFieldMetadataId = useRecoilValueV2( + const recordIndexCalendarFieldMetadataId = useAtomStateValue( recordIndexCalendarFieldMetadataIdState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsx b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsx index d0e45e46f9..5f76340b3a 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/components/RecordCalendarCardHeader.tsx @@ -5,11 +5,11 @@ import { RecordCardHeaderContainer } from '@/object-record/record-card/component import { isDraggingRecordComponentState } from '@/object-record/record-drag/states/isDraggingRecordComponentState'; import { useOpenRecordFromIndexView } from '@/object-record/record-index/hooks/useOpenRecordFromIndexView'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import styled from '@emotion/styled'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; import { ChipVariant } from 'twenty-ui/components'; import { Checkbox, CheckboxVariant } from 'twenty-ui/input'; @@ -38,19 +38,19 @@ export const RecordCalendarCardHeader = ({ recordId, }: RecordCalendarCardHeaderProps) => { const { objectMetadataItem } = useRecordCalendarContextOrThrow(); - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const record = useAtomFamilyStateValue(recordStoreFamilyState, recordId); const { openRecordFromIndexView } = useOpenRecordFromIndexView(); const { currentView } = useGetCurrentViewOnly(); const isCompactModeActive = currentView?.isCompact ?? false; - const isDraggingRecord = useRecoilComponentValueV2( + const isDraggingRecord = useAtomComponentStateValue( isDraggingRecordComponentState, ); const [isCurrentCardSelected, setIsCurrentCardSelected] = - useRecoilComponentFamilyStateV2( + useAtomComponentFamilyState( isRecordCalendarCardSelectedComponentFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/hooks/useRecordCalendarCardMetadataFromPosition.ts b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/hooks/useRecordCalendarCardMetadataFromPosition.ts index 9d07cdb83c..2ae39b7376 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/hooks/useRecordCalendarCardMetadataFromPosition.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/hooks/useRecordCalendarCardMetadataFromPosition.ts @@ -3,22 +3,22 @@ import { recordCalendarCardEditModePositionComponentState } from '@/object-recor import { recordCalendarCardHoverPositionComponentState } from '@/object-record/record-calendar/record-calendar-card/states/recordCalendarCardHoverPositionComponentState'; import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useRecordCalendarCardMetadataFromPosition = () => { const { objectMetadataItem } = useRecordCalendarContextOrThrow(); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordCalendarCardHoverPositionComponentState, ); - const editModePosition = useRecoilComponentValueV2( + const editModePosition = useAtomComponentStateValue( recordCalendarCardEditModePositionComponentState, ); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/isRecordCalendarCardSelectedComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/isRecordCalendarCardSelectedComponentFamilyState.ts index 0ac3958216..0cbd38beb7 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/isRecordCalendarCardSelectedComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/isRecordCalendarCardSelectedComponentFamilyState.ts @@ -1,8 +1,8 @@ -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { RecordCalendarComponentInstanceContext } from '@/object-record/record-calendar/states/contexts/RecordCalendarComponentInstanceContext'; export const isRecordCalendarCardSelectedComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordCalendarCardSelectedComponentFamilyState', defaultValue: false, componentInstanceContext: RecordCalendarComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardEditModePositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardEditModePositionComponentState.ts index 15a0a5a09d..f6357c2835 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardEditModePositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardEditModePositionComponentState.ts @@ -1,8 +1,8 @@ import { RecordCalendarCardComponentInstanceContext } from '@/object-record/record-calendar/record-calendar-card/states/contexts/RecordCalendarCardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordCalendarCardEditModePositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordCalendarCardEditModePositionComponentState', defaultValue: null, componentInstanceContext: RecordCalendarCardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardHoverPositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardHoverPositionComponentState.ts index 91d864085a..354a8d8acb 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardHoverPositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/record-calendar-card/states/recordCalendarCardHoverPositionComponentState.ts @@ -1,8 +1,8 @@ import { RecordCalendarCardComponentInstanceContext } from '@/object-record/record-calendar/record-calendar-card/states/contexts/RecordCalendarCardComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordCalendarCardHoverPositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordCalendarCardHoverPositionComponentState', defaultValue: null, componentInstanceContext: RecordCalendarCardComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/states/hasInitializedRecordCalendarSelectedDateComponentState.ts b/packages/twenty-front/src/modules/object-record/record-calendar/states/hasInitializedRecordCalendarSelectedDateComponentState.ts index ef72476cfb..38a9290ae4 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/states/hasInitializedRecordCalendarSelectedDateComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/states/hasInitializedRecordCalendarSelectedDateComponentState.ts @@ -1,8 +1,8 @@ import { RecordCalendarComponentInstanceContext } from '@/object-record/record-calendar/states/contexts/RecordCalendarComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const hasInitializedRecordCalendarSelectedDateComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'hasInitializedRecordCalendarSelectedDateComponentState', defaultValue: false, componentInstanceContext: RecordCalendarComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarRecordIdsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarRecordIdsComponentState.ts index 73d54c3413..05e7e5cef0 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarRecordIdsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarRecordIdsComponentState.ts @@ -1,7 +1,7 @@ import { RecordCalendarComponentInstanceContext } from '@/object-record/record-calendar/states/contexts/RecordCalendarComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const recordCalendarRecordIdsComponentState = createComponentStateV2< +export const recordCalendarRecordIdsComponentState = createAtomComponentState< string[] >({ key: 'recordCalendarRecordIdsComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarSelectedDateComponentState.ts b/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarSelectedDateComponentState.ts index 6d0b894c70..fc9fc66f14 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarSelectedDateComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/states/recordCalendarSelectedDateComponentState.ts @@ -1,9 +1,9 @@ import { RecordCalendarComponentInstanceContext } from '@/object-record/record-calendar/states/contexts/RecordCalendarComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { Temporal } from 'temporal-polyfill'; export const recordCalendarSelectedDateComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordCalendarSelectedDateComponentState', defaultValue: Temporal.Now.plainDateISO(), componentInstanceContext: RecordCalendarComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/calendarDayRecordsComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/calendarDayRecordsComponentFamilySelector.ts index 7b717c55d8..2267655eea 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/calendarDayRecordsComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/calendarDayRecordsComponentFamilySelector.ts @@ -6,7 +6,7 @@ import { RecordCalendarComponentInstanceContext } from '@/object-record/record-c import { recordCalendarRecordIdsComponentState } from '@/object-record/record-calendar/states/recordCalendarRecordIdsComponentState'; import { recordIndexCalendarFieldMetadataIdState } from '@/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; import { isNonEmptyString } from '@sniptt/guards'; import { Temporal } from 'temporal-polyfill'; @@ -14,7 +14,7 @@ import { isDefined, isSamePlainDate } from 'twenty-shared/utils'; import { FieldMetadataType } from '~/generated-metadata/graphql'; export const calendarDayRecordIdsComponentFamilySelector = - createComponentFamilySelectorV2< + createAtomComponentFamilySelector< string[], { day: Temporal.PlainDate; timeZone: string } >({ diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/recordCalendarSelectedRecordIdsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/recordCalendarSelectedRecordIdsComponentSelector.ts index cef408bb83..176227e520 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/recordCalendarSelectedRecordIdsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/recordCalendarSelectedRecordIdsComponentSelector.ts @@ -1,10 +1,10 @@ import { isRecordCalendarCardSelectedComponentFamilyState } from '@/object-record/record-calendar/record-calendar-card/states/isRecordCalendarCardSelectedComponentFamilyState'; import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { RecordCalendarComponentInstanceContext } from '@/object-record/record-calendar/states/contexts/RecordCalendarComponentInstanceContext'; export const recordCalendarSelectedRecordIdsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'recordCalendarSelectedRecordIdsSelector', componentInstanceContext: RecordCalendarComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/useRecordCalendarSelection.ts b/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/useRecordCalendarSelection.ts index 6374bfbb37..94692e359c 100644 --- a/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/useRecordCalendarSelection.ts +++ b/packages/twenty-front/src/modules/object-record/record-calendar/states/selectors/useRecordCalendarSelection.ts @@ -4,8 +4,8 @@ import { getActionMenuDropdownIdFromActionMenuId } from '@/action-menu/utils/get import { getActionMenuIdFromRecordIndexId } from '@/action-menu/utils/getActionMenuIdFromRecordIndexId'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { isRecordCalendarCardSelectedComponentFamilyState } from '@/object-record/record-calendar/record-calendar-card/states/isRecordCalendarCardSelectedComponentFamilyState'; import { RecordCalendarComponentInstanceContext } from '@/object-record/record-calendar/states/contexts/RecordCalendarComponentInstanceContext'; @@ -18,16 +18,15 @@ export const useRecordCalendarSelection = (recordCalendarId?: string) => { ); const isRecordCalendarCardSelectedFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordCalendarCardSelectedComponentFamilyState, recordCalendarId, ); - const recordCalendarSelectedRecordIds = - useRecoilComponentSelectorCallbackStateV2( - recordCalendarSelectedRecordIdsComponentSelector, - recordCalendarId, - ); + const recordCalendarSelectedRecordIds = useAtomComponentSelectorCallbackState( + recordCalendarSelectedRecordIdsComponentSelector, + recordCalendarId, + ); const { closeDropdown } = useCloseDropdown(); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useEndRecordDrag.test.tsx b/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useEndRecordDrag.test.tsx index cff7e5d1a2..5e81152b13 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useEndRecordDrag.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useEndRecordDrag.test.tsx @@ -6,7 +6,7 @@ import { draggedRecordIdsComponentState } from '@/object-record/record-drag/stat import { isMultiDragActiveComponentState } from '@/object-record/record-drag/states/isMultiDragActiveComponentState'; import { originalDragSelectionComponentState } from '@/object-record/record-drag/states/originalDragSelectionComponentState'; import { primaryDraggedRecordIdComponentState } from '@/object-record/record-drag/states/primaryDraggedRecordIdComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; describe('useEndRecordDrag', () => { @@ -15,17 +15,20 @@ describe('useEndRecordDrag', () => { it('should clear all board drag states', () => { const { result } = renderHook( () => { - const [isMultiDragActive, setIsMultiDragActive] = - useRecoilComponentStateV2(isMultiDragActiveComponentState); + const [isMultiDragActive, setIsMultiDragActive] = useAtomComponentState( + isMultiDragActiveComponentState, + ); - const [draggedRecordIds, setDraggedRecordIds] = - useRecoilComponentStateV2(draggedRecordIdsComponentState); + const [draggedRecordIds, setDraggedRecordIds] = useAtomComponentState( + draggedRecordIdsComponentState, + ); const [primaryDraggedRecordId, setPrimaryDraggedRecordId] = - useRecoilComponentStateV2(primaryDraggedRecordIdComponentState); + useAtomComponentState(primaryDraggedRecordIdComponentState); - const [originalSelection, setOriginalSelection] = - useRecoilComponentStateV2(originalDragSelectionComponentState); + const [originalSelection, setOriginalSelection] = useAtomComponentState( + originalDragSelectionComponentState, + ); const { endRecordDrag } = useEndRecordDrag(); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useStartRecordDrag.test.tsx b/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useStartRecordDrag.test.tsx index 79b36aab49..28c9329412 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useStartRecordDrag.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/__tests__/useStartRecordDrag.test.tsx @@ -7,7 +7,7 @@ import { draggedRecordIdsComponentState } from '@/object-record/record-drag/stat import { isMultiDragActiveComponentState } from '@/object-record/record-drag/states/isMultiDragActiveComponentState'; import { originalDragSelectionComponentState } from '@/object-record/record-drag/states/originalDragSelectionComponentState'; import { primaryDraggedRecordIdComponentState } from '@/object-record/record-drag/states/primaryDraggedRecordIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; const createDragStart = (draggableId: string, index: number): DragStart => ({ @@ -26,16 +26,16 @@ describe('useStartRecordDrag', () => { it('should set single drag state when dragged record is not in selection', () => { const { result } = renderHook( () => { - const isMultiDragActive = useRecoilComponentValueV2( + const isMultiDragActive = useAtomComponentStateValue( isMultiDragActiveComponentState, ); - const draggedRecordIds = useRecoilComponentValueV2( + const draggedRecordIds = useAtomComponentStateValue( draggedRecordIdsComponentState, ); - const primaryDraggedRecordId = useRecoilComponentValueV2( + const primaryDraggedRecordId = useAtomComponentStateValue( primaryDraggedRecordIdComponentState, ); - const originalSelection = useRecoilComponentValueV2( + const originalSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); @@ -68,16 +68,16 @@ describe('useStartRecordDrag', () => { it('should set single drag state when only one record is selected', () => { const { result } = renderHook( () => { - const isMultiDragActive = useRecoilComponentValueV2( + const isMultiDragActive = useAtomComponentStateValue( isMultiDragActiveComponentState, ); - const draggedRecordIds = useRecoilComponentValueV2( + const draggedRecordIds = useAtomComponentStateValue( draggedRecordIdsComponentState, ); - const primaryDraggedRecordId = useRecoilComponentValueV2( + const primaryDraggedRecordId = useAtomComponentStateValue( primaryDraggedRecordIdComponentState, ); - const originalSelection = useRecoilComponentValueV2( + const originalSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); @@ -110,16 +110,16 @@ describe('useStartRecordDrag', () => { it('should set multi drag state when multiple records are selected', () => { const { result } = renderHook( () => { - const isMultiDragActive = useRecoilComponentValueV2( + const isMultiDragActive = useAtomComponentStateValue( isMultiDragActiveComponentState, ); - const draggedRecordIds = useRecoilComponentValueV2( + const draggedRecordIds = useAtomComponentStateValue( draggedRecordIdsComponentState, ); - const primaryDraggedRecordId = useRecoilComponentValueV2( + const primaryDraggedRecordId = useAtomComponentStateValue( primaryDraggedRecordIdComponentState, ); - const originalSelection = useRecoilComponentValueV2( + const originalSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); @@ -160,16 +160,16 @@ describe('useStartRecordDrag', () => { it('should handle empty selection', () => { const { result } = renderHook( () => { - const isMultiDragActive = useRecoilComponentValueV2( + const isMultiDragActive = useAtomComponentStateValue( isMultiDragActiveComponentState, ); - const draggedRecordIds = useRecoilComponentValueV2( + const draggedRecordIds = useAtomComponentStateValue( draggedRecordIdsComponentState, ); - const primaryDraggedRecordId = useRecoilComponentValueV2( + const primaryDraggedRecordId = useAtomComponentStateValue( primaryDraggedRecordIdComponentState, ); - const originalSelection = useRecoilComponentValueV2( + const originalSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); @@ -202,16 +202,16 @@ describe('useStartRecordDrag', () => { it('should set single drag state when dragged record is not in selection', () => { const { result } = renderHook( () => { - const isMultiDragActive = useRecoilComponentValueV2( + const isMultiDragActive = useAtomComponentStateValue( isMultiDragActiveComponentState, ); - const draggedRecordIds = useRecoilComponentValueV2( + const draggedRecordIds = useAtomComponentStateValue( draggedRecordIdsComponentState, ); - const primaryDraggedRecordId = useRecoilComponentValueV2( + const primaryDraggedRecordId = useAtomComponentStateValue( primaryDraggedRecordIdComponentState, ); - const originalSelection = useRecoilComponentValueV2( + const originalSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); @@ -244,16 +244,16 @@ describe('useStartRecordDrag', () => { it('should set multi drag state when multiple records are selected', () => { const { result } = renderHook( () => { - const isMultiDragActive = useRecoilComponentValueV2( + const isMultiDragActive = useAtomComponentStateValue( isMultiDragActiveComponentState, ); - const draggedRecordIds = useRecoilComponentValueV2( + const draggedRecordIds = useAtomComponentStateValue( draggedRecordIdsComponentState, ); - const primaryDraggedRecordId = useRecoilComponentValueV2( + const primaryDraggedRecordId = useAtomComponentStateValue( primaryDraggedRecordIdComponentState, ); - const originalSelection = useRecoilComponentValueV2( + const originalSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useEndRecordDrag.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useEndRecordDrag.ts index 7dc0b5baa7..c97a7b8c48 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useEndRecordDrag.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useEndRecordDrag.ts @@ -1,8 +1,8 @@ import { useCallback } from 'react'; import { useStore } from 'jotai'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { isMultiDragActiveComponentState } from '@/object-record/record-drag/states/isMultiDragActiveComponentState'; @@ -16,40 +16,40 @@ import { isDefined } from 'twenty-shared/utils'; export const useEndRecordDrag = (contextStoreInstanceId?: string) => { const store = useStore(); - const isMultiDragActiveCallbackState = useRecoilComponentStateCallbackStateV2( + const isMultiDragActiveCallbackState = useAtomComponentStateCallbackState( isMultiDragActiveComponentState, contextStoreInstanceId, ); - const draggedRecordIdsCallbackState = useRecoilComponentStateCallbackStateV2( + const draggedRecordIdsCallbackState = useAtomComponentStateCallbackState( draggedRecordIdsComponentState, contextStoreInstanceId, ); const primaryDraggedRecordIdCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( primaryDraggedRecordIdComponentState, contextStoreInstanceId, ); - const originalSelection = useRecoilComponentStateCallbackStateV2( + const originalSelection = useAtomComponentStateCallbackState( originalDragSelectionComponentState, contextStoreInstanceId, ); const isRecordIdPrimaryDragMultipleCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordIdPrimaryDragMultipleComponentFamilyState, contextStoreInstanceId, ); const isRecordIdSecondaryDragMultipleCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordIdSecondaryDragMultipleComponentFamilyState, contextStoreInstanceId, ); - const isDraggingRecord = useRecoilComponentStateCallbackStateV2( + const isDraggingRecord = useAtomComponentStateCallbackState( isDraggingRecordComponentState, contextStoreInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessBoardCardDrop.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessBoardCardDrop.ts index 932a0bf400..ce0070f5fb 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessBoardCardDrop.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessBoardCardDrop.ts @@ -7,14 +7,14 @@ import { processGroupDrop } from '@/object-record/record-drag/utils/processGroup import { RecordBoardContext } from '@/object-record/record-board/contexts/RecordBoardContext'; import { useUpdateDroppedRecordOnBoard } from '@/object-record/record-drag/hooks/useUpdateDroppedRecordOnBoard'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; export const useProcessBoardCardDrop = () => { const store = useStore(); const { selectFieldMetadataItem } = useContext(RecordBoardContext); const recordIndexRecordIdsByGroupCallbackFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessCalendarCardDrop.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessCalendarCardDrop.ts index 9e5c2a63d9..f8ed810127 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessCalendarCardDrop.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessCalendarCardDrop.ts @@ -10,7 +10,7 @@ import { extractRecordPositions } from '@/object-record/record-drag/utils/extrac import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { computeNewPositionOfDraggedRecord } from '@/object-record/utils/computeNewPositionOfDraggedRecord'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentFamilySelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2'; +import { useAtomComponentFamilySelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { Temporal } from 'temporal-polyfill'; import { FieldMetadataType } from 'twenty-shared/types'; @@ -25,7 +25,7 @@ export const useProcessCalendarCardDrop = () => { const { userTimezone } = useUserTimezone(); const calendarDayRecordIdsSelector = - useRecoilComponentFamilySelectorCallbackStateV2( + useAtomComponentFamilySelectorCallbackState( calendarDayRecordIdsComponentFamilySelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.ts index dc981396c4..bc4f883187 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithGroupRecordDrop.ts @@ -16,10 +16,10 @@ import { useRecordIndexContextOrThrow } from '@/object-record/record-index/conte import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { selectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/selectedRowIdsComponentSelector'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useProcessTableWithGroupRecordDrop = () => { const store = useStore(); @@ -31,32 +31,31 @@ export const useProcessTableWithGroupRecordDrop = () => { const { openModal } = useModal(); - const recordIdsByGroupFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( - recordIndexRecordIdsByGroupComponentFamilyState, - ); + const recordIdsByGroupFamilyState = useAtomComponentFamilyStateCallbackState( + recordIndexRecordIdsByGroupComponentFamilyState, + ); - const currentRecordSorts = useRecoilComponentStateCallbackStateV2( + const currentRecordSorts = useAtomComponentStateCallbackState( currentRecordSortsComponentState, recordTableId, ); - const selectedRowIds = useRecoilComponentSelectorCallbackStateV2( + const selectedRowIds = useAtomComponentSelectorCallbackState( selectedRowIdsComponentSelector, recordTableId, ); - const isDraggingRecord = useRecoilComponentStateCallbackStateV2( + const isDraggingRecord = useAtomComponentStateCallbackState( isDraggingRecordComponentState, recordIndexId, ); - const originalDragSelection = useRecoilComponentStateCallbackStateV2( + const originalDragSelection = useAtomComponentStateCallbackState( originalDragSelectionComponentState, recordIndexId, ); - const groupFieldMetadata = useRecoilComponentValueV2( + const groupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.ts index e5c51f7d16..9c3b9434fa 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useProcessTableWithoutGroupRecordDrop.ts @@ -18,9 +18,9 @@ import { useRecordTableContextOrThrow } from '@/object-record/record-table/conte import { selectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/selectedRowIdsComponentSelector'; import { type RecordWithPosition } from '@/object-record/utils/computeNewPositionOfDraggedRecord'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -31,20 +31,20 @@ export const useProcessTableWithoutGroupRecordDrop = () => { const { updateOneRecord } = useUpdateOneRecord(); - const allRecordIdsWithoutGroup = useRecoilComponentSelectorCallbackStateV2( + const allRecordIdsWithoutGroup = useAtomComponentSelectorCallbackState( allRecordIdsWithoutGroupsComponentSelector, ); - const selectedRowIds = useRecoilComponentSelectorCallbackStateV2( + const selectedRowIds = useAtomComponentSelectorCallbackState( selectedRowIdsComponentSelector, ); - const originalDragSelection = useRecoilComponentStateCallbackStateV2( + const originalDragSelection = useAtomComponentStateCallbackState( originalDragSelectionComponentState, recordIndexId, ); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useStartRecordDrag.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useStartRecordDrag.ts index e7578a5c9e..ccf5c26b0d 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useStartRecordDrag.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useStartRecordDrag.ts @@ -10,46 +10,46 @@ import { originalDragSelectionComponentState } from '@/object-record/record-drag import { primaryDraggedRecordIdComponentState } from '@/object-record/record-drag/states/primaryDraggedRecordIdComponentState'; import { getDragOperationType } from '@/object-record/record-drag/utils/getDragOperationType'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { type DragStart } from '@hello-pangea/dnd'; export const useStartRecordDrag = (contextStoreInstanceId?: string) => { const store = useStore(); - const isMultiDragActiveCallbackState = useRecoilComponentStateCallbackStateV2( + const isMultiDragActiveCallbackState = useAtomComponentStateCallbackState( isMultiDragActiveComponentState, contextStoreInstanceId, ); - const draggedRecordIdsCallbackState = useRecoilComponentStateCallbackStateV2( + const draggedRecordIdsCallbackState = useAtomComponentStateCallbackState( draggedRecordIdsComponentState, contextStoreInstanceId, ); const isRecordIdPrimaryDragMultipleCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordIdPrimaryDragMultipleComponentFamilyState, contextStoreInstanceId, ); const isRecordIdSecondaryDragMultipleCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( isRecordIdSecondaryDragMultipleComponentFamilyState, contextStoreInstanceId, ); const primaryDraggedRecordIdCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( primaryDraggedRecordIdComponentState, contextStoreInstanceId, ); - const originalSelection = useRecoilComponentStateCallbackStateV2( + const originalSelection = useAtomComponentStateCallbackState( originalDragSelectionComponentState, contextStoreInstanceId, ); - const isDraggingRecord = useRecoilComponentStateCallbackStateV2( + const isDraggingRecord = useAtomComponentStateCallbackState( isDraggingRecordComponentState, contextStoreInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useTriggerTableWithoutGroupDragAndDropOptimisticUpdate.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useTriggerTableWithoutGroupDragAndDropOptimisticUpdate.ts index b3a4043457..a8138df6c0 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useTriggerTableWithoutGroupDragAndDropOptimisticUpdate.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useTriggerTableWithoutGroupDragAndDropOptimisticUpdate.ts @@ -10,23 +10,24 @@ import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/ import { getVirtualizationOverscanWindow } from '@/object-record/record-table/virtualization/utils/getVirtualizationOverscanWindow'; import { type RecordWithPosition } from '@/object-record/utils/computeNewPositionOfDraggedRecord'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilySelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilySelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState'; import { findById, isDefined } from 'twenty-shared/utils'; import { sortByProperty } from '~/utils/array/sortByProperty'; export const useTriggerTableWithoutGroupDragAndDropOptimisticUpdate = () => { const store = useStore(); const recordIdByRealIndexCallbackSelector = - useRecoilComponentFamilySelectorCallbackStateV2( + useAtomComponentFamilySelectorCallbackState( recordIdByRealIndexComponentFamilySelector, ); - const lastScrollPositionCallbackState = - useRecoilComponentStateCallbackStateV2(lastScrollPositionComponentState); + const lastScrollPositionCallbackState = useAtomComponentStateCallbackState( + lastScrollPositionComponentState, + ); const { scrollWrapperHTMLElement } = useScrollWrapperHTMLElement(); const totalNumberOfRecordsToVirtualizeCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( totalNumberOfRecordsToVirtualizeComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useUpdateDroppedRecordOnBoard.ts b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useUpdateDroppedRecordOnBoard.ts index 74c0171ebb..0cd039562c 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/hooks/useUpdateDroppedRecordOnBoard.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/hooks/useUpdateDroppedRecordOnBoard.ts @@ -8,8 +8,8 @@ import { type RecordGroupDefinition } from '@/object-record/record-group/types/R import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useCallback, useContext } from 'react'; import { findByProperty, isDefined } from 'twenty-shared/utils'; import { sortByProperty } from '~/utils/array/sortByProperty'; @@ -20,11 +20,11 @@ export const useUpdateDroppedRecordOnBoard = () => { useContext(RecordBoardContext); const recordIndexRecordIdsByGroupCallbackFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); - const recordGroupDefinitions = useRecoilComponentSelectorValueV2( + const recordGroupDefinitions = useAtomComponentSelectorValue( recordGroupDefinitionsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/states/draggedRecordIdsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-drag/states/draggedRecordIdsComponentState.ts index cd7885c9ec..d13d347150 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/states/draggedRecordIdsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/states/draggedRecordIdsComponentState.ts @@ -1,7 +1,9 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const draggedRecordIdsComponentState = createComponentStateV2({ +export const draggedRecordIdsComponentState = createAtomComponentState< + string[] +>({ key: 'draggedRecordIdsComponentState', defaultValue: [], componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-drag/states/isDraggingRecordComponentState.ts b/packages/twenty-front/src/modules/object-record/record-drag/states/isDraggingRecordComponentState.ts index 5c032ebc3f..e6bd49cdab 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/states/isDraggingRecordComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/states/isDraggingRecordComponentState.ts @@ -1,8 +1,10 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const isDraggingRecordComponentState = createComponentStateV2({ - key: 'isDraggingRecordComponentState', - defaultValue: false, - componentInstanceContext: ContextStoreComponentInstanceContext, -}); +export const isDraggingRecordComponentState = createAtomComponentState( + { + key: 'isDraggingRecordComponentState', + defaultValue: false, + componentInstanceContext: ContextStoreComponentInstanceContext, + }, +); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/states/isMultiDragActiveComponentState.ts b/packages/twenty-front/src/modules/object-record/record-drag/states/isMultiDragActiveComponentState.ts index 608928e2e7..0a504be4e2 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/states/isMultiDragActiveComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/states/isMultiDragActiveComponentState.ts @@ -1,8 +1,9 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const isMultiDragActiveComponentState = createComponentStateV2({ - key: 'isMultiDragActiveComponentState', - defaultValue: false, - componentInstanceContext: ContextStoreComponentInstanceContext, -}); +export const isMultiDragActiveComponentState = + createAtomComponentState({ + key: 'isMultiDragActiveComponentState', + defaultValue: false, + componentInstanceContext: ContextStoreComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdPrimaryDragMultipleComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdPrimaryDragMultipleComponentFamilyState.ts index 1928e7394c..ec39565de8 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdPrimaryDragMultipleComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdPrimaryDragMultipleComponentFamilyState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const isRecordIdPrimaryDragMultipleComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordIdPrimaryDragMultipleComponentFamilyState', defaultValue: false, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdSecondaryDragMultipleComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdSecondaryDragMultipleComponentFamilyState.ts index 554dcd58ad..658ec18f54 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdSecondaryDragMultipleComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/states/isRecordIdSecondaryDragMultipleComponentFamilyState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const isRecordIdSecondaryDragMultipleComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordIdSecondaryDragMultipleComponentFamilyState', defaultValue: false, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-drag/states/originalDragSelectionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-drag/states/originalDragSelectionComponentState.ts index 4447cfe96b..2a1f7fc09f 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/states/originalDragSelectionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/states/originalDragSelectionComponentState.ts @@ -1,7 +1,7 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const originalDragSelectionComponentState = createComponentStateV2< +export const originalDragSelectionComponentState = createAtomComponentState< string[] >({ key: 'originalDragSelectionComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-drag/states/primaryDraggedRecordIdComponentState.ts b/packages/twenty-front/src/modules/object-record/record-drag/states/primaryDraggedRecordIdComponentState.ts index 0f143a0068..bc226059b1 100644 --- a/packages/twenty-front/src/modules/object-record/record-drag/states/primaryDraggedRecordIdComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-drag/states/primaryDraggedRecordIdComponentState.ts @@ -1,7 +1,7 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const primaryDraggedRecordIdComponentState = createComponentStateV2< +export const primaryDraggedRecordIdComponentState = createAtomComponentState< string | null >({ key: 'primaryDraggedRecordIdComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellEditModePortal.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellEditModePortal.tsx index 3b1fc9afbd..0aea4d968a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellEditModePortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellEditModePortal.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { RecordFieldListInputContextProvider } from '@/object-record/record-field-list/anchored-portal/components/RecordFieldListInputContextProvider'; @@ -24,7 +24,7 @@ export const RecordFieldListCellEditModePortal = ({ RecordFieldListComponentInstanceContext, ); - const editModePosition = useRecoilComponentValueV2( + const editModePosition = useAtomComponentStateValue( recordFieldListCellEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortal.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortal.tsx index e3f477dd27..6839378159 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortal.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { RecordFieldListCellHoveredPortalContent } from '@/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortalContent'; @@ -23,7 +23,7 @@ export const RecordFieldListCellHoveredPortal = ({ RecordFieldListComponentInstanceContext, ); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordFieldListHoverPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortalContent.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortalContent.tsx index 38b1c9f0d5..cfa253a5be 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortalContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListCellHoveredPortalContent.tsx @@ -11,8 +11,8 @@ import { RecordInlineCellHoveredPortalContent } from '@/object-record/record-inl import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext } from 'react'; export const RecordFieldListCellHoveredPortalContent = () => { @@ -36,9 +36,9 @@ export const RecordFieldListCellHoveredPortalContent = () => { !isRecordFieldReadOnly && !editModeContentOnly; const [recordFieldListHoverPosition, setRecordFieldListHoverPosition] = - useRecoilComponentStateV2(recordFieldListHoverPositionComponentState); + useAtomComponentState(recordFieldListHoverPositionComponentState); - const setRecordFieldListCellEditModePosition = useSetRecoilComponentStateV2( + const setRecordFieldListCellEditModePosition = useSetAtomComponentState( recordFieldListCellEditModePositionComponentState, ); const { openFieldInput } = useOpenFieldInputEditMode(); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListInputContextProvider.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListInputContextProvider.tsx index 8edd449eb3..a3ac417436 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListInputContextProvider.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/anchored-portal/components/RecordFieldListInputContextProvider.tsx @@ -13,7 +13,7 @@ import { import { useOpenFieldInputEditMode } from '@/object-record/record-field/ui/hooks/useOpenFieldInputEditMode'; import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { useAvailableComponentInstanceId } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceId'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -39,7 +39,7 @@ export const RecordFieldListInputContextProvider = ({ const { closeFieldInput } = useOpenFieldInputEditMode(); - const setRecordFieldListCellEditModePosition = useSetRecoilComponentStateV2( + const setRecordFieldListCellEditModePosition = useSetAtomComponentState( recordFieldListCellEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/components/RecordFieldList.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/components/RecordFieldList.tsx index 54a4662776..47f4755044 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/components/RecordFieldList.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/components/RecordFieldList.tsx @@ -24,7 +24,7 @@ import { useRecordShowContainerActions } from '@/object-record/record-show/hooks import { useRecordShowContainerData } from '@/object-record/record-show/hooks/useRecordShowContainerData'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; import { getObjectPermissionsFromMapByObjectMetadataId } from '@/settings/roles/role-permissions/objects-permissions/utils/getObjectPermissionsFromMapByObjectMetadataId'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { FieldMetadataType } from 'twenty-shared/types'; type RecordFieldListProps = { @@ -66,7 +66,7 @@ export const RecordFieldList = ({ objectMetadataId: objectMetadataItem.id, }); - const setRecordFieldListHoverPosition = useSetRecoilComponentStateV2( + const setRecordFieldListHoverPosition = useSetAtomComponentState( recordFieldListHoverPositionComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/hooks/useFieldListFieldMetadataFromPosition.ts b/packages/twenty-front/src/modules/object-record/record-field-list/hooks/useFieldListFieldMetadataFromPosition.ts index 01e7fb5086..6c482da99d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/hooks/useFieldListFieldMetadataFromPosition.ts +++ b/packages/twenty-front/src/modules/object-record/record-field-list/hooks/useFieldListFieldMetadataFromPosition.ts @@ -1,7 +1,7 @@ import { useFieldListFieldMetadataItems } from '@/object-record/record-field-list/hooks/useFieldListFieldMetadataItems'; import { recordFieldListCellEditModePositionComponentState } from '@/object-record/record-field-list/states/recordFieldListCellEditModePositionComponentState'; import { recordFieldListHoverPositionComponentState } from '@/object-record/record-field-list/states/recordFieldListHoverPositionComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; type UseFieldListFieldMetadataFromPositionProps = { @@ -11,11 +11,11 @@ type UseFieldListFieldMetadataFromPositionProps = { export const useFieldListFieldMetadataFromPosition = ({ objectNameSingular, }: UseFieldListFieldMetadataFromPositionProps) => { - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordFieldListHoverPositionComponentState, ); - const editModePosition = useRecoilComponentValueV2( + const editModePosition = useAtomComponentStateValue( recordFieldListCellEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSection.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSection.tsx index 54c49925e5..4b5cbef274 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSection.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSection.tsx @@ -12,7 +12,7 @@ import { type FieldMorphRelationMetadata } from '@/object-record/record-field/ui import { getRecordFieldCardRelationPickerDropdownId } from '@/object-record/record-show/utils/getRecordFieldCardRelationPickerDropdownId'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { RecordDetailMorphRelationSectionDropdown } from '@/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdown'; import { RecordDetailRelationRecordsList } from '@/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsList'; @@ -49,7 +49,7 @@ export const RecordDetailMorphRelationSection = ({ instanceId: scopeInstanceId, }); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownManyToOne.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownManyToOne.tsx index 6db47369b0..b71a73ae30 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownManyToOne.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownManyToOne.tsx @@ -16,8 +16,8 @@ import { getRecordFieldCardRelationPickerDropdownId } from '@/object-record/reco import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { dropdownPlacementComponentState } from '@/ui/layout/dropdown/states/dropdownPlacementComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { FieldMetadataType } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { IconForbid, IconPencil } from 'twenty-ui/display'; @@ -65,17 +65,17 @@ export const RecordDetailMorphRelationSectionDropdownManyToOne = ({ const { closeDropdown } = useCloseDropdown(); - const dropdownPlacement = useRecoilComponentValueV2( + const dropdownPlacement = useAtomComponentStateValue( dropdownPlacementComponentState, dropdownId, ); - const setSingleRecordPickerSearchFilter = useSetRecoilComponentStateV2( + const setSingleRecordPickerSearchFilter = useSetAtomComponentState( singleRecordPickerSearchFilterComponentState, dropdownId, ); - const setSingleRecordPickerSelectedId = useSetRecoilComponentStateV2( + const setSingleRecordPickerSelectedId = useSetAtomComponentState( singleRecordPickerSelectedIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownOneToMany.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownOneToMany.tsx index bf436b1517..8c581922d6 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownOneToMany.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailMorphRelationSectionDropdownOneToMany.tsx @@ -18,8 +18,8 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { dropdownPlacementComponentState } from '@/ui/layout/dropdown/states/dropdownPlacementComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { FieldMetadataType } from 'twenty-shared/types'; import { CustomError, isDefined } from 'twenty-shared/utils'; import { IconPlus } from 'twenty-ui/display'; @@ -68,24 +68,23 @@ export const RecordDetailMorphRelationSectionDropdownOneToMany = ({ const { closeDropdown } = useCloseDropdown(); - const dropdownPlacement = useRecoilComponentValueV2( + const dropdownPlacement = useAtomComponentStateValue( dropdownPlacementComponentState, dropdownId, ); - const setMultipleRecordPickerSearchFilter = useSetRecoilComponentStateV2( + const setMultipleRecordPickerSearchFilter = useSetAtomComponentState( multipleRecordPickerSearchFilterComponentState, dropdownId, ); - const setMultipleRecordPickerPickableMorphItems = - useSetRecoilComponentStateV2( - multipleRecordPickerPickableMorphItemsComponentState, - dropdownId, - ); + const setMultipleRecordPickerPickableMorphItems = useSetAtomComponentState( + multipleRecordPickerPickableMorphItemsComponentState, + dropdownId, + ); const setMultipleRecordPickerSearchableObjectMetadataItems = - useSetRecoilComponentStateV2( + useSetAtomComponentState( multipleRecordPickerSearchableObjectMetadataItemsComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx index 3fae5bd650..6dd1c86a46 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationRecordsListItem.tsx @@ -28,8 +28,8 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { t } from '@lingui/core/macro'; import { Trans } from '@lingui/react/macro'; import { createPortal } from 'react-dom'; @@ -152,7 +152,7 @@ export const RecordDetailRelationRecordsListItem = ({ const dropdownInstanceId = `record-field-card-menu:${scopeInstanceId}:${relationFieldMetadataId}:${relationRecord.id}`; const { closeDropdown } = useCloseDropdown(); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownInstanceId, ); @@ -162,7 +162,7 @@ export const RecordDetailRelationRecordsListItem = ({ recordId, instanceId: scopeInstanceId, }); - const setSingleRecordPickerSelectedId = useSetRecoilComponentStateV2( + const setSingleRecordPickerSelectedId = useSetAtomComponentState( singleRecordPickerSelectedIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSection.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSection.tsx index 45911641d1..ac3bf505bc 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSection.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSection.tsx @@ -20,8 +20,8 @@ import { AggregateOperations } from '@/object-record/record-table/constants/Aggr import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; import { useLingui } from '@lingui/react/macro'; import { @@ -81,7 +81,7 @@ export const RecordDetailRelationSection = ({ ); } - const fieldValue = useFamilySelectorValueV2(recordStoreFamilySelectorV2, { + const fieldValue = useAtomFamilySelectorValue(recordStoreFamilySelectorV2, { recordId, fieldName, }) as ({ id: string } & Record) | ObjectRecord[] | null; @@ -101,12 +101,12 @@ export const RecordDetailRelationSection = ({ instanceId: scopeInstanceId, }); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); - const indexViewId = useFamilySelectorValueV2( + const indexViewId = useAtomFamilySelectorValue( coreIndexViewIdFromObjectMetadataItemFamilySelector, { objectMetadataItemId: relationObjectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx index c8fd9c020a..684a2b0799 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToMany.tsx @@ -20,9 +20,9 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { dropdownPlacementComponentState } from '@/ui/layout/dropdown/states/dropdownPlacementComponentState'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { CustomError, isDefined } from 'twenty-shared/utils'; import { IconPlus } from 'twenty-ui/display'; import { LightIconButton } from 'twenty-ui/input'; @@ -71,7 +71,7 @@ export const RecordDetailRelationSectionDropdownToMany = ({ ); } - const fieldValue = useFamilySelectorValueV2(recordStoreFamilySelectorV2, { + const fieldValue = useAtomFamilySelectorValue(recordStoreFamilySelectorV2, { recordId, fieldName, }) as ({ id: string } & Record) | ObjectRecord[] | null; @@ -86,24 +86,23 @@ export const RecordDetailRelationSectionDropdownToMany = ({ const { closeDropdown } = useCloseDropdown(); - const dropdownPlacement = useRecoilComponentValueV2( + const dropdownPlacement = useAtomComponentStateValue( dropdownPlacementComponentState, dropdownId, ); - const setMultipleRecordPickerSearchFilter = useSetRecoilComponentStateV2( + const setMultipleRecordPickerSearchFilter = useSetAtomComponentState( multipleRecordPickerSearchFilterComponentState, dropdownId, ); - const setMultipleRecordPickerPickableMorphItems = - useSetRecoilComponentStateV2( - multipleRecordPickerPickableMorphItemsComponentState, - dropdownId, - ); + const setMultipleRecordPickerPickableMorphItems = useSetAtomComponentState( + multipleRecordPickerPickableMorphItemsComponentState, + dropdownId, + ); const setMultipleRecordPickerSearchableObjectMetadataItems = - useSetRecoilComponentStateV2( + useSetAtomComponentState( multipleRecordPickerSearchableObjectMetadataItemsComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx index 8c614b4f5f..d1a466dd89 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSectionDropdownToOne.tsx @@ -17,9 +17,9 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { dropdownPlacementComponentState } from '@/ui/layout/dropdown/states/dropdownPlacementComponentState'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { getFieldMetadataItemById } from '@/object-metadata/utils/getFieldMetadataItemById'; @@ -80,7 +80,7 @@ export const RecordDetailRelationSectionDropdownToOne = ({ ); } - const fieldValue = useFamilySelectorValueV2(recordStoreFamilySelectorV2, { + const fieldValue = useAtomFamilySelectorValue(recordStoreFamilySelectorV2, { recordId, fieldName, }) as ({ id: string } & Record) | ObjectRecord[] | null; @@ -97,17 +97,17 @@ export const RecordDetailRelationSectionDropdownToOne = ({ const { closeDropdown } = useCloseDropdown(); - const dropdownPlacement = useRecoilComponentValueV2( + const dropdownPlacement = useAtomComponentStateValue( dropdownPlacementComponentState, dropdownId, ); - const setSingleRecordPickerSearchFilter = useSetRecoilComponentStateV2( + const setSingleRecordPickerSearchFilter = useSetAtomComponentState( singleRecordPickerSearchFilterComponentState, dropdownId, ); - const setSingleRecordPickerSelectedId = useSetRecoilComponentStateV2( + const setSingleRecordPickerSelectedId = useSetAtomComponentState( singleRecordPickerSelectedIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/hooks/useGetMorphRelationRelatedRecordsWithObjectNameSingular.ts b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/hooks/useGetMorphRelationRelatedRecordsWithObjectNameSingular.ts index 32a8ecaeb7..49554aff1f 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/hooks/useGetMorphRelationRelatedRecordsWithObjectNameSingular.ts +++ b/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/hooks/useGetMorphRelationRelatedRecordsWithObjectNameSingular.ts @@ -1,6 +1,6 @@ import { type FieldMetadataItemRelation } from '@/object-metadata/types/FieldMetadataItemRelation'; import { recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { CustomError, isNonEmptyArray } from 'twenty-shared/utils'; export const useGetMorphRelationRelatedRecordsWithObjectNameSingular = ({ @@ -10,7 +10,7 @@ export const useGetMorphRelationRelatedRecordsWithObjectNameSingular = ({ recordId: string; morphRelations: FieldMetadataItemRelation[]; }) => { - const morphRelationObjectNameSingularWithValues = useFamilySelectorValueV2( + const morphRelationObjectNameSingularWithValues = useAtomFamilySelectorValue( recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2, { recordId, morphRelations }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListCellEditModePositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListCellEditModePositionComponentState.ts index 14e889d805..f99ee2fc04 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListCellEditModePositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListCellEditModePositionComponentState.ts @@ -1,8 +1,8 @@ import { RecordFieldListComponentInstanceContext } from '@/object-record/record-field-list/states/contexts/RecordFieldListComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordFieldListCellEditModePositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordFieldListCellEditModePositionComponentState', defaultValue: null, componentInstanceContext: RecordFieldListComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListHoverPositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListHoverPositionComponentState.ts index 121524d7c0..04c6430a58 100644 --- a/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListHoverPositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-field-list/states/recordFieldListHoverPositionComponentState.ts @@ -1,8 +1,8 @@ import { RecordFieldListComponentInstanceContext } from '@/object-record/record-field-list/states/contexts/RecordFieldListComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordFieldListHoverPositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordFieldListHoverPositionComponentState', defaultValue: null, componentInstanceContext: RecordFieldListComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useChangeRecordFieldVisibility.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useChangeRecordFieldVisibility.ts index 58d9e5f82f..ccf6beb4b4 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useChangeRecordFieldVisibility.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useChangeRecordFieldVisibility.ts @@ -2,7 +2,7 @@ import { useUpdateRecordField } from '@/object-record/record-field/hooks/useUpda import { useUpsertRecordField } from '@/object-record/record-field/hooks/useUpsertRecordField'; import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useSaveCurrentViewFields } from '@/views/hooks/useSaveCurrentViewFields'; import { mapRecordFieldToViewField } from '@/views/utils/mapRecordFieldToViewField'; import { isDefined } from 'twenty-shared/utils'; @@ -12,7 +12,7 @@ import { sortByProperty } from '~/utils/array/sortByProperty'; export const useChangeRecordFieldVisibility = ( recordFieldComponentInstanceId?: string, ) => { - const currentRecordFields = useRecoilComponentValueV2( + const currentRecordFields = useAtomComponentStateValue( currentRecordFieldsComponentState, recordFieldComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts index 5b9bc71bea..2c1106784e 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useFilterVisibleAndReadableRecordField.ts @@ -1,10 +1,10 @@ import { flattenedReadableFieldMetadataItemsSelector } from '@/object-metadata/states/flattenedReadableFieldMetadataItemIdsSelector'; import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useFilterVisibleAndReadableRecordField = () => { - const flattenedReadableFieldMetadataItems = useRecoilValueV2( + const flattenedReadableFieldMetadataItems = useAtomStateValue( flattenedReadableFieldMetadataItemsSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useMoveRecordField.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useMoveRecordField.ts index 7b27b39f6c..368fd73326 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useMoveRecordField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useMoveRecordField.ts @@ -1,6 +1,6 @@ import { useUpdateRecordField } from '@/object-record/record-field/hooks/useUpdateRecordField'; import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useSaveCurrentViewFields } from '@/views/hooks/useSaveCurrentViewFields'; import { mapRecordFieldToViewField } from '@/views/utils/mapRecordFieldToViewField'; import { useCallback } from 'react'; @@ -9,7 +9,7 @@ import { useStore } from 'jotai'; export const useMoveRecordField = (recordTableId?: string) => { const store = useStore(); - const currentRecordFields = useRecoilComponentStateCallbackStateV2( + const currentRecordFields = useAtomComponentStateCallbackState( currentRecordFieldsComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts index ce9b65b880..ab69095d76 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useRecordsFieldVisibleGqlFields.ts @@ -8,7 +8,7 @@ import { generateActivityTargetGqlFields } from '@/object-record/graphql/record- import { generateDepthRecordGqlFieldsFromFields } from '@/object-record/graphql/record-gql-fields/utils/generateDepthRecordGqlFieldsFromFields'; import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { isDefined } from 'twenty-shared/utils'; import { FeatureFlagKey } from '~/generated-metadata/graphql'; @@ -22,7 +22,7 @@ export const useRecordsFieldVisibleGqlFields = ({ objectMetadataItem, additionalFieldMetadataId, }: UseRecordsFieldVisibleGqlFields) => { - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useReorderVisibleRecordFields.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useReorderVisibleRecordFields.ts index 1cb16395ac..a5a3a3c455 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useReorderVisibleRecordFields.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useReorderVisibleRecordFields.ts @@ -3,19 +3,19 @@ import { currentRecordFieldsComponentState } from '@/object-record/record-field/ import { visibleRecordFieldsComponentSelector } from '@/object-record/record-field/states/visibleRecordFieldsComponentSelector'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; import { computeNewPositionOfDraggedRecord } from '@/object-record/utils/computeNewPositionOfDraggedRecord'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useCallback } from 'react'; import { useStore } from 'jotai'; export const useReorderVisibleRecordFields = (recordTableId: string) => { const store = useStore(); - const visibleRecordFields = useRecoilComponentSelectorCallbackStateV2( + const visibleRecordFields = useAtomComponentSelectorCallbackState( visibleRecordFieldsComponentSelector, recordTableId, ); - const currentRecordFields = useRecoilComponentStateCallbackStateV2( + const currentRecordFields = useAtomComponentStateCallbackState( currentRecordFieldsComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpdateRecordField.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpdateRecordField.ts index 43476a1830..f128afbc8a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpdateRecordField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpdateRecordField.ts @@ -1,6 +1,6 @@ import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { useStore } from 'jotai'; @@ -9,7 +9,7 @@ export const useUpdateRecordField = ( recordFieldComponentInstanceId?: string, ) => { const store = useStore(); - const currentRecordFields = useRecoilComponentStateCallbackStateV2( + const currentRecordFields = useAtomComponentStateCallbackState( currentRecordFieldsComponentState, recordFieldComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpsertRecordField.ts b/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpsertRecordField.ts index f5fa5c5b08..0ef0317b5e 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpsertRecordField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/hooks/useUpsertRecordField.ts @@ -1,12 +1,12 @@ import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useCallback } from 'react'; import { useStore } from 'jotai'; export const useUpsertRecordField = (recordTableId?: string) => { const store = useStore(); - const currentRecordFields = useRecoilComponentStateCallbackStateV2( + const currentRecordFields = useAtomComponentStateCallbackState( currentRecordFieldsComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/states/currentRecordFieldsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-field/states/currentRecordFieldsComponentState.ts index 4646857074..841da03052 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/states/currentRecordFieldsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/states/currentRecordFieldsComponentState.ts @@ -1,8 +1,8 @@ import { RecordFieldsComponentInstanceContext } from '@/object-record/record-field/states/context/RecordFieldsComponentInstanceContext'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const currentRecordFieldsComponentState = createComponentStateV2< +export const currentRecordFieldsComponentState = createAtomComponentState< RecordField[] >({ key: 'currentRecordFieldsComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-field/states/visibleRecordFieldsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-field/states/visibleRecordFieldsComponentSelector.ts index f00baae8bf..80e44678e4 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/states/visibleRecordFieldsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/states/visibleRecordFieldsComponentSelector.ts @@ -4,11 +4,11 @@ import { isActiveFieldMetadataItem } from '@/object-metadata/utils/isActiveField import { RecordFieldsComponentInstanceContext } from '@/object-record/record-field/states/context/RecordFieldsComponentInstanceContext'; import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { findById } from 'twenty-shared/utils'; import { sortByProperty } from '~/utils/array/sortByProperty'; -export const visibleRecordFieldsComponentSelector = createComponentSelectorV2< +export const visibleRecordFieldsComponentSelector = createAtomComponentSelector< RecordField[] >({ key: 'visibleRecordFieldsComponentSelector', diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx index e4c2d963ca..bec33e6bb9 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormArrayFieldInput.tsx @@ -20,7 +20,7 @@ import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDrop import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; @@ -128,7 +128,7 @@ export const FormArrayFieldInput = ({ const containerRef = useRef(null); const dropdownId = `dropdown-${instanceId}`; - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx index dc93f0be0e..47f8a26999 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormSingleRecordPicker.tsx @@ -12,7 +12,7 @@ import { InputLabel } from '@/ui/input/components/InputLabel'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isStandaloneVariableString } from '@/workflow/utils/isStandaloneVariableString'; import { css, useTheme } from '@emotion/react'; import styled from '@emotion/styled'; @@ -116,7 +116,7 @@ export const FormSingleRecordPicker = ({ const { closeDropdown } = useCloseDropdown(); - const setRecordPickerSearchFilter = useSetRecoilComponentStateV2( + const setRecordPickerSearchFilter = useSetAtomComponentState( singleRecordPickerSearchFilterComponentState, dropdownId, ); @@ -148,7 +148,7 @@ export const FormSingleRecordPicker = ({ onClear?.(); }; - const setRecordPickerSelectedId = useSetRecoilComponentStateV2( + const setRecordPickerSelectedId = useSetAtomComponentState( singleRecordPickerSelectedIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/__tests__/useIsFieldEmpty.test.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/__tests__/useIsFieldEmpty.test.tsx index 2efebed25e..fb899cf0a5 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/__tests__/useIsFieldEmpty.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/__tests__/useIsFieldEmpty.test.tsx @@ -8,7 +8,7 @@ import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldCont import { useIsFieldEmpty } from '@/object-record/record-field/ui/hooks/useIsFieldEmpty'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; const recordId = 'recordId'; @@ -31,7 +31,7 @@ describe('useIsFieldEmpty', () => { it('should work as expected', () => { const { result } = renderHook( () => { - const setFieldState = useSetFamilyRecoilStateV2( + const setFieldState = useSetAtomFamilyState( recordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useIsRecordDeleted.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useIsRecordDeleted.ts index 34088b8f4f..6453bcb69e 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useIsRecordDeleted.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useIsRecordDeleted.ts @@ -1,6 +1,6 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; type UseIsRecordReadOnlyParams = { @@ -10,9 +10,12 @@ type UseIsRecordReadOnlyParams = { export const useIsRecordDeleted = ({ recordId, }: UseIsRecordReadOnlyParams): boolean => { - const recordDeletedAt = useFamilySelectorValueV2( + const recordDeletedAt = useAtomFamilySelectorValue( recordStoreFamilySelectorV2, - { recordId, fieldName: 'deletedAt' }, + { + recordId, + fieldName: 'deletedAt', + }, ) as ObjectRecord | null; return isDefined(recordDeletedAt); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useRecordFieldInput.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useRecordFieldInput.ts index 31673de66b..6c38615238 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useRecordFieldInput.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/hooks/useRecordFieldInput.ts @@ -1,11 +1,11 @@ import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; import { type FieldInputDraftValue } from '@/object-record/record-field/ui/types/FieldInputDraftValue'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; export const useRecordFieldInput = () => { - const recordFieldInputDraftValue = useRecoilComponentStateCallbackStateV2( + const recordFieldInputDraftValue = useAtomComponentStateCallbackState( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/FilesFieldDisplay.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/FilesFieldDisplay.tsx index dfc1d0e8dd..91164d8d67 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/FilesFieldDisplay.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/FilesFieldDisplay.tsx @@ -1,7 +1,7 @@ import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { useFilesFieldDisplay } from '@/object-record/record-field/ui/meta-types/hooks/useFilesFieldDisplay'; import { filesFieldUploadStateV2 } from '@/object-record/record-field/ui/states/filesFieldUploadStateV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { FilesDisplay } from '@/ui/field/display/components/FilesDisplay'; import { useContext } from 'react'; @@ -9,7 +9,7 @@ export const FilesFieldDisplay = () => { const { recordId, fieldDefinition } = useContext(FieldContext); const { fieldValue, disableChipClick } = useFilesFieldDisplay(); - const uploadState = useFamilyRecoilValueV2(filesFieldUploadStateV2, { + const uploadState = useAtomFamilyStateValue(filesFieldUploadStateV2, { recordId, fieldName: fieldDefinition.metadata.fieldName, }); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/RelationFromManyFieldDisplay.perf.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/RelationFromManyFieldDisplay.perf.stories.tsx index 0319342845..062b0240aa 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/RelationFromManyFieldDisplay.perf.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/__stories__/perf/RelationFromManyFieldDisplay.perf.stories.tsx @@ -6,7 +6,7 @@ import { RelationFromManyFieldDisplay } from '@/object-record/record-field/ui/me import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition'; import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { ChipGeneratorsDecorator } from '~/testing/decorators/ChipGeneratorsDecorator'; import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator'; import { getProfilingStory } from '~/testing/profiling/utils/getProfilingStory'; @@ -19,7 +19,7 @@ import { } from './relationFromManyFieldDisplayMock'; const RelationFieldValueSetterEffect = () => { - const setEntity = useSetFamilyRecoilStateV2( + const setEntity = useSetAtomFamilyState( recordStoreFamilyState, relationFromManyFieldDisplayMock.entityValue.id, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useActorFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useActorFieldDisplay.ts index 0b112e967b..508327f3b2 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useActorFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useActorFieldDisplay.ts @@ -3,7 +3,7 @@ import { useContext } from 'react'; import { type FieldActorValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { AuthContext } from '@/auth/contexts/AuthContext'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { isDefined } from 'twenty-shared/utils'; import { type WorkspaceMember } from '~/generated-metadata/graphql'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -21,7 +21,7 @@ export const useActorFieldDisplay = (): ActorFieldDisplayValue | undefined => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddSelectOption.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddSelectOption.ts index 74b7f7a683..d81bb191ba 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddSelectOption.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddSelectOption.ts @@ -1,6 +1,6 @@ import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; import { shouldNavigateBackToMemorizedUrlOnSaveState } from '@/ui/navigation/states/shouldNavigateBackToMemorizedUrlOnSaveState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useCallback } from 'react'; import { useParams } from 'react-router-dom'; import { SettingsPath } from 'twenty-shared/types'; @@ -9,11 +9,11 @@ import { useNavigateSettings } from '~/hooks/useNavigateSettings'; export const useAddSelectOption = (fieldName: string) => { const { objectNamePlural } = useParams(); const navigateSettings = useNavigateSettings(); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); - const setShouldNavigateBackToMemorizedUrlOnSave = useSetRecoilStateV2( + const setShouldNavigateBackToMemorizedUrlOnSave = useSetAtomState( shouldNavigateBackToMemorizedUrlOnSaveState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressField.ts index 7b814f6451..14d0b02cec 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressField.ts @@ -5,8 +5,8 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states import { FieldMetadataType } from '~/generated-metadata/graphql'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { type FieldAddressValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; @@ -23,14 +23,14 @@ export const useAddressField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressFieldDisplay.ts index 27522a3d4f..81414bfc98 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useAddressFieldDisplay.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { type FieldAddressValue } from '@/object-record/record-field/ui/types/FieldMetadata'; @@ -9,7 +9,7 @@ export const useAddressFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayField.ts index aed8a78d50..368f833d1a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayField.ts @@ -5,8 +5,8 @@ import { type FieldArrayValue } from '@/object-record/record-field/ui/types/Fiel import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldArray } from '@/object-record/record-field/ui/types/guards/isFieldArray'; import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { FieldMetadataType } from '~/generated-metadata/graphql'; @@ -17,14 +17,14 @@ export const useArrayField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayFieldDisplay.ts index b51d8efe27..0121ffa06c 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useArrayFieldDisplay.ts @@ -4,7 +4,7 @@ import { type FieldArrayMetadata, type FieldArrayValue, } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { useContext } from 'react'; @@ -13,7 +13,7 @@ export const useArrayFieldDisplay = () => { const { fieldName } = fieldDefinition.metadata; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanField.ts index 4179c7f7b4..eb7d3939bf 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanField.ts @@ -6,7 +6,7 @@ import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldBoolean } from '@/object-record/record-field/ui/types/guards/isFieldBoolean'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; export const useBooleanField = () => { const { recordId, fieldDefinition } = useContext(FieldContext); @@ -19,7 +19,7 @@ export const useBooleanField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanFieldDisplay.ts index 07738a2327..bdf218a287 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useBooleanFieldDisplay.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; export const useBooleanFieldDisplay = () => { @@ -8,7 +8,7 @@ export const useBooleanFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipField.ts index 60617e0496..4a617dc483 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipField.ts @@ -3,7 +3,7 @@ import { isFieldFullName } from '@/object-record/record-field/ui/types/guards/is import { isFieldNumber } from '@/object-record/record-field/ui/types/guards/isFieldNumber'; import { isFieldText } from '@/object-record/record-field/ui/types/guards/isFieldText'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -17,7 +17,7 @@ export const useChipField = () => { ? fieldDefinition.metadata.objectMetadataNameSingular : undefined; - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const record = useAtomFamilyStateValue(recordStoreFamilyState, recordId); return { objectNameSingular, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipFieldDisplay.ts index 9c96fd4d7e..e161e7315f 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useChipFieldDisplay.ts @@ -9,7 +9,7 @@ import { useContext } from 'react'; import { isFieldActor } from '@/object-record/record-field/ui/types/guards/isFieldActor'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { recordStoreFamilyStateV2 } from '@/object-record/record-store/states/recordStoreFamilyStateV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -50,7 +50,7 @@ export const useChipFieldDisplay = () => { ? fieldDefinition.metadata.objectMetadataNameSingular : undefined; - const recordValue = useFamilyRecoilValueV2( + const recordValue = useAtomFamilyStateValue( recordStoreFamilyStateV2, recordId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyField.ts index 6bf306afad..f4a3c42b43 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyField.ts @@ -7,8 +7,8 @@ import { type FieldCurrencyValue } from '@/object-record/record-field/ui/types/F import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldCurrency } from '@/object-record/record-field/ui/types/guards/isFieldCurrency'; import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { DEFAULT_DECIMAL_VALUE } from '~/utils/format/formatNumber'; @@ -23,14 +23,14 @@ export const useCurrencyField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyFieldDisplay.ts index e542b45135..628f4d5aef 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useCurrencyFieldDisplay.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldCurrency } from '@/object-record/record-field/ui/types/guards/isFieldCurrency'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldMetadataType } from 'twenty-shared/types'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { type FieldCurrencyValue } from '@/object-record/record-field/ui/types/FieldMetadata'; @@ -18,7 +18,7 @@ export const useCurrencyFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateField.ts index b76c39ffc1..c98fa09466 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateField.ts @@ -8,7 +8,7 @@ import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; export const useDateField = () => { const { recordId, fieldDefinition, clearable } = useContext(FieldContext); @@ -17,7 +17,7 @@ export const useDateField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateFieldDisplay.ts index 1902503451..39d1b67a51 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateFieldDisplay.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition'; import { type FieldDateMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; export const useDateFieldDisplay = () => { @@ -10,7 +10,7 @@ export const useDateFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeField.ts index aa5e4d1e9f..f4f8bedfe4 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeField.ts @@ -8,7 +8,7 @@ import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldDateTime } from '@/object-record/record-field/ui/types/guards/isFieldDateTime'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; export const useDateTimeField = () => { const { recordId, fieldDefinition, clearable } = useContext(FieldContext); @@ -21,7 +21,7 @@ export const useDateTimeField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeFieldDisplay.ts index 8b82241048..227f0452d8 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useDateTimeFieldDisplay.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition'; import { type FieldDateTimeMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; export const useDateTimeFieldDisplay = () => { @@ -10,7 +10,7 @@ export const useDateTimeFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsField.ts index 9f16d0011a..095123bbae 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsField.ts @@ -7,8 +7,8 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states import { FieldMetadataType } from '~/generated-metadata/graphql'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; @@ -19,14 +19,14 @@ export const useEmailsField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsFieldDisplay.ts index 6efb39062c..ed711e91e0 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useEmailsFieldDisplay.ts @@ -3,7 +3,7 @@ import { useContext } from 'react'; import { type FieldEmailsValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldEmails } from '@/object-record/record-field/ui/types/guards/isFieldEmails'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldMetadataType } from 'twenty-shared/types'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -14,7 +14,7 @@ export const useEmailsFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesField.ts index 2b6e60674a..3405b436b8 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesField.ts @@ -9,8 +9,8 @@ import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useFilesField = () => { const { recordId, fieldDefinition } = useContext(FieldContext); @@ -19,14 +19,14 @@ export const useFilesField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesFieldDisplay.ts index 0cd3dacb48..fac1d57a40 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFilesFieldDisplay.ts @@ -4,7 +4,7 @@ import { type FieldFilesMetadata, type FieldFilesValue, } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { useContext } from 'react'; @@ -14,7 +14,7 @@ export const useFilesFieldDisplay = () => { const { fieldName } = fieldDefinition.metadata; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameField.ts index 26bf6f2482..226602b5a5 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameField.ts @@ -7,8 +7,8 @@ import { type FieldFullNameValue } from '@/object-record/record-field/ui/types/F import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldFullName } from '@/object-record/record-field/ui/types/guards/isFieldFullName'; import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldMetadataType } from '~/generated-metadata/graphql'; export const useFullNameField = () => { @@ -22,14 +22,14 @@ export const useFullNameField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameFieldDisplay.ts index fd488a4915..75cef5e1f7 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useFullNameFieldDisplay.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import { type FieldFullNameValue } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; export const useFullNameFieldDisplay = () => { @@ -10,7 +10,7 @@ export const useFullNameFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonField.ts index d82b111de5..3e1efedde5 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonField.ts @@ -7,8 +7,8 @@ import { FieldMetadataType } from '~/generated-metadata/graphql'; import { usePrecomputedJsonDraftValue } from '@/object-record/record-field/ui/meta-types/hooks/usePrecomputedJsonDraftValue'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldRawJson } from '@/object-record/record-field/ui/types/guards/isFieldRawJson'; @@ -24,14 +24,14 @@ export const useJsonField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonFieldDisplay.ts index 6c9d41c6ce..f571c4df26 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useJsonFieldDisplay.ts @@ -3,7 +3,7 @@ import { useContext } from 'react'; import { type FieldJsonValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { useFormattedJsonFieldValue } from '@/object-record/record-field/ui/meta-types/hooks/useFormattedJsonFieldValue'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; export const useJsonFieldDisplay = () => { @@ -12,7 +12,7 @@ export const useJsonFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksField.ts index 23a85a4eaa..114fe0ab00 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksField.ts @@ -7,8 +7,8 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states import { FieldMetadataType } from '~/generated-metadata/graphql'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; @@ -19,14 +19,14 @@ export const useLinksField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksFieldDisplay.ts index 12d68e2edf..2aec9dd92d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useLinksFieldDisplay.ts @@ -4,7 +4,7 @@ import { type FieldLinksValue } from '@/object-record/record-field/ui/types/Fiel import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldLinks } from '@/object-record/record-field/ui/types/guards/isFieldLinks'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldMetadataType } from 'twenty-shared/types'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -15,7 +15,7 @@ export const useLinksFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationField.ts index a9e597ca1e..eeb745af0c 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationField.ts @@ -10,8 +10,8 @@ import { recordFieldInputDraftValueComponentState } from '@/object-record/record import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldMorphRelation } from '@/object-record/record-field/ui/types/guards/isFieldMorphRelation'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useMorphRelationField = < T extends ObjectRecord | ObjectRecord[], @@ -27,12 +27,12 @@ export const useMorphRelationField = < const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ) as [FieldRelationValue, (value: FieldRelationValue) => void]; - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationFromManyFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationFromManyFieldDisplay.ts index c241a55883..fe375b943b 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationFromManyFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationFromManyFieldDisplay.ts @@ -7,7 +7,7 @@ import { FieldMetadataType } from '~/generated-metadata/graphql'; import { isFieldMorphRelation } from '@/object-record/record-field/ui/types/guards/isFieldMorphRelation'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { type ObjectRecord } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -32,7 +32,7 @@ export const useMorphRelationFromManyFieldDisplay = () => { const button = fieldDefinition.editButtonIcon; - const morphValuesWithObjectNameSingular = useRecordFieldValueV2< + const morphValuesWithObjectNameSingular = useRecordFieldValue< { objectNameSingular: string; value: ObjectRecord; diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationToOneFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationToOneFieldDisplay.ts index 98cad5be40..99134159eb 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationToOneFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMorphRelationToOneFieldDisplay.ts @@ -11,7 +11,7 @@ import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldCont import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldMorphRelation } from '@/object-record/record-field/ui/types/guards/isFieldMorphRelation'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { isDefined } from 'twenty-shared/utils'; @@ -34,7 +34,7 @@ export const useMorphRelationToOneFieldDisplay = () => { const button = fieldDefinition.editButtonIcon; - const morphFieldValueWithObjectName = useRecordFieldValueV2<{ + const morphFieldValueWithObjectName = useRecordFieldValue<{ objectNameSingular: string; value: ObjectRecord; }>(recordId, fieldDefinition.metadata.fieldName, fieldDefinition); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectField.ts index 9eb85d47f8..8223973a2e 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectField.ts @@ -8,8 +8,8 @@ import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guard import { isFieldMultiSelect } from '@/object-record/record-field/ui/types/guards/isFieldMultiSelect'; import { isFieldMultiSelectValue } from '@/object-record/record-field/ui/types/guards/isFieldMultiSelectValue'; import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldMetadataType } from '~/generated-metadata/graphql'; export const useMultiSelectField = () => { @@ -23,7 +23,7 @@ export const useMultiSelectField = () => { const { fieldName } = fieldDefinition.metadata; - const [fieldValues, setFieldValue] = useFamilySelectorStateV2( + const [fieldValues, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); @@ -34,7 +34,7 @@ export const useMultiSelectField = () => { const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectFieldDisplay.ts index c1115e7ac9..6fc10d044c 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useMultiSelectFieldDisplay.ts @@ -6,14 +6,14 @@ import { type FieldMultiSelectMetadata, type FieldMultiSelectValue, } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; export const useMultiSelectFieldDisplay = () => { const { recordId, fieldDefinition } = useContext(FieldContext); const { fieldName } = fieldDefinition.metadata; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberField.ts index da6c0a13fd..62520dc1f9 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberField.ts @@ -6,8 +6,8 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states import { FieldMetadataType } from '~/generated-metadata/graphql'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldNumber } from '@/object-record/record-field/ui/types/guards/isFieldNumber'; @@ -19,14 +19,14 @@ export const useNumberField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberFieldDisplay.ts index 55adaf116b..b2b3f62c02 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useNumberFieldDisplay.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import { FieldMetadataType } from '~/generated-metadata/graphql'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldNumber } from '@/object-record/record-field/ui/types/guards/isFieldNumber'; @@ -13,7 +13,7 @@ export const useNumberFieldDisplay = () => { assertFieldMetadata(FieldMetadataType.NUMBER, isFieldNumber, fieldDefinition); const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesField.ts index 829bdf42cb..8e73ed65a9 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesField.ts @@ -7,8 +7,8 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states import { FieldMetadataType } from '~/generated-metadata/graphql'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; @@ -19,14 +19,14 @@ export const usePhonesField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesFieldDisplay.ts index ecea4effb6..b54acfe690 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/usePhonesFieldDisplay.ts @@ -4,7 +4,7 @@ import { type FieldPhonesValue } from '@/object-record/record-field/ui/types/Fie import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldPhones } from '@/object-record/record-field/ui/types/guards/isFieldPhones'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldMetadataType } from 'twenty-shared/types'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -15,7 +15,7 @@ export const usePhonesFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingField.ts index a4dbc506dc..6b64dd67d9 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingField.ts @@ -7,7 +7,7 @@ import { type FieldRatingValue } from 'twenty-shared/types'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldRating } from '@/object-record/record-field/ui/types/guards/isFieldRating'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; export const useRatingField = () => { const { recordId, fieldDefinition } = useContext(FieldContext); @@ -16,7 +16,7 @@ export const useRatingField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingFieldDisplay.ts index a64b44f5a3..d79be589a5 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRatingFieldDisplay.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { type FieldRatingValue } from 'twenty-shared/types'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -9,7 +9,7 @@ export const useRatingFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationField.ts index c396bce26d..a97059e0c6 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationField.ts @@ -10,8 +10,8 @@ import { recordFieldInputDraftValueComponentState } from '@/object-record/record import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useRelationField = () => { const { recordId, fieldDefinition, maxWidth } = useContext(FieldContext); @@ -25,12 +25,12 @@ export const useRelationField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ) as [FieldRelationValue, (value: FieldRelationValue) => void]; - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationFromManyFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationFromManyFieldDisplay.ts index c3b9dd84bf..d37178c46b 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationFromManyFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationFromManyFieldDisplay.ts @@ -8,7 +8,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { FIELD_EDIT_BUTTON_WIDTH } from '@/ui/field/display/constants/FieldEditButtonWidth'; import { FieldMetadataType } from '~/generated-metadata/graphql'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { isDefined } from 'twenty-shared/utils'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; @@ -35,7 +35,7 @@ export const useRelationFromManyFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationToOneFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationToOneFieldDisplay.ts index 4959d741f1..7956827c0d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationToOneFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRelationToOneFieldDisplay.ts @@ -12,7 +12,7 @@ import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldCont import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation'; import { getJoinColumnNameOrThrow } from '@/object-record/record-field/ui/utils/junction/getJoinColumnNameOrThrow'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { isDefined } from 'twenty-shared/utils'; export const useRelationToOneFieldDisplay = () => { @@ -36,7 +36,7 @@ export const useRelationToOneFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, @@ -46,7 +46,7 @@ export const useRelationToOneFieldDisplay = () => { fieldDefinition.metadata.settings, ); - const foreignKeyFieldValue = useRecordFieldValueV2( + const foreignKeyFieldValue = useRecordFieldValue( recordId, joinColumnName, { type: FieldMetadataType.UUID, metadata: { fieldName: joinColumnName } }, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextFieldDisplay.ts index b6db147231..7a8064f0b9 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextFieldDisplay.ts @@ -3,7 +3,7 @@ import { useContext } from 'react'; import { type FieldRichTextValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldRichText } from '@/object-record/record-field/ui/types/guards/isFieldRichText'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import type { PartialBlock } from '@blocknote/core'; import { isDefined, parseJson } from 'twenty-shared/utils'; import { FieldMetadataType } from '~/generated-metadata/graphql'; @@ -20,7 +20,7 @@ export const useRichTextFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextV2FieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextV2FieldDisplay.ts index 5e017107ba..ef36cde0e7 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextV2FieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useRichTextV2FieldDisplay.ts @@ -3,7 +3,7 @@ import { useContext } from 'react'; import { type FieldRichTextV2Value } from '@/object-record/record-field/ui/types/FieldMetadata'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; import { isFieldRichTextV2 } from '@/object-record/record-field/ui/types/guards/isFieldRichTextV2'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -18,7 +18,7 @@ export const useRichTextV2FieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectField.ts index de185646e3..019ecab654 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectField.ts @@ -5,8 +5,8 @@ import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states import { FieldMetadataType } from '~/generated-metadata/graphql'; import { recordFieldInputDraftValueComponentState } from '@/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { type FieldSelectValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guards/assertFieldMetadata'; @@ -20,7 +20,7 @@ export const useSelectField = () => { const { fieldName } = fieldDefinition.metadata; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); @@ -29,7 +29,7 @@ export const useSelectField = () => { const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectFieldDisplay.ts index 86b4daa383..14146fd919 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useSelectFieldDisplay.ts @@ -2,7 +2,7 @@ import { useContext } from 'react'; import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { type FieldSelectMetadata, @@ -14,7 +14,7 @@ export const useSelectFieldDisplay = () => { const { fieldName } = fieldDefinition.metadata; - const fieldValue = useRecordFieldValueV2( + const fieldValue = useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextField.ts index 6cac270173..22c7e668b5 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextField.ts @@ -8,8 +8,8 @@ import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guard import { isFieldText } from '@/object-record/record-field/ui/types/guards/isFieldText'; import { isFieldTextValue } from '@/object-record/record-field/ui/types/guards/isFieldTextValue'; import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldMetadataType } from '~/generated-metadata/graphql'; export const useTextField = () => { @@ -19,7 +19,7 @@ export const useTextField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); @@ -27,7 +27,7 @@ export const useTextField = () => { const { setDraftValue } = useRecordFieldInput(); - const draftValue = useRecoilComponentValueV2( + const draftValue = useAtomComponentStateValue( recordFieldInputDraftValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextFieldDisplay.ts index c9c89b17ee..4deb57269a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextFieldDisplay.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useTextFieldDisplay.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; -import { useRecordFieldValueV2 } from '@/object-record/record-store/hooks/useRecordFieldValueV2'; +import { useRecordFieldValue } from '@/object-record/record-store/hooks/useRecordFieldValue'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; export const useTextFieldDisplay = () => { @@ -10,7 +10,7 @@ export const useTextFieldDisplay = () => { const fieldName = fieldDefinition.metadata.fieldName; const fieldValue = - useRecordFieldValueV2( + useRecordFieldValue( recordId, fieldName, fieldDefinition, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUuidField.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUuidField.ts index 32b0990e3e..397dd78644 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUuidField.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/hooks/useUuidField.ts @@ -6,7 +6,7 @@ import { assertFieldMetadata } from '@/object-record/record-field/ui/types/guard import { isFieldTextValue } from '@/object-record/record-field/ui/types/guards/isFieldTextValue'; import { isFieldUuid } from '@/object-record/record-field/ui/types/guards/isFieldUuid'; import { recordStoreFamilySelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFamilySelectorV2'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; import { FieldMetadataType } from '~/generated-metadata/graphql'; export const useUuidField = () => { @@ -16,7 +16,7 @@ export const useUuidField = () => { const fieldName = fieldDefinition.metadata.fieldName; - const [fieldValue, setFieldValue] = useFamilySelectorStateV2( + const [fieldValue, setFieldValue] = useAtomFamilySelectorState( recordStoreFamilySelectorV2, { recordId, fieldName }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/EmailsFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/EmailsFieldInput.tsx index 8d004a09d1..c156dd8ec4 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/EmailsFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/EmailsFieldInput.tsx @@ -6,7 +6,7 @@ import { recordFieldInputIsFieldInErrorComponentState } from '@/object-record/re import { type FieldEmailsValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { emailsSchema } from '@/object-record/record-field/ui/types/guards/isFieldEmailsValue'; import { emailSchema } from '@/object-record/record-field/ui/validation-schemas/emailSchema'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useLingui } from '@lingui/react/macro'; import { useCallback, useContext, useMemo } from 'react'; import { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from 'twenty-shared/constants'; @@ -68,7 +68,7 @@ export const EmailsFieldInput = () => { index === 0 && emails.length > 1; const getShowSetAsPrimaryButton = (index: number) => index > 0; - const setIsFieldInError = useSetRecoilComponentStateV2( + const setIsFieldInError = useSetAtomComponentState( recordFieldInputIsFieldInErrorComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsx index fff34a70d0..317887033d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/FilesFieldInput.tsx @@ -12,9 +12,9 @@ import { type FieldFilesValue } from '@/object-record/record-field/ui/types/Fiel import { filesSchema } from '@/object-record/record-field/ui/types/guards/isFieldFilesValue'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { filePreviewStateV2 } from '@/ui/field/display/states/filePreviewStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useLingui } from '@lingui/react/macro'; import { useCallback, useContext, useMemo, useState } from 'react'; import { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from 'twenty-shared/constants'; @@ -28,8 +28,8 @@ export const FilesFieldInput = () => { const { t } = useLingui(); const [isUploading, setIsUploading] = useState(false); const { enqueueErrorSnackBar } = useSnackBar(); - const setFilePreview = useSetRecoilStateV2(filePreviewStateV2); - const isAttachmentPreviewEnabled = useRecoilValueV2( + const setFilePreview = useSetAtomState(filePreviewStateV2); + const isAttachmentPreviewEnabled = useAtomStateValue( isAttachmentPreviewEnabledStateV2, ); @@ -122,7 +122,7 @@ export const FilesFieldInput = () => { fieldDefinition, ]); - const setIsFieldInError = useSetRecoilComponentStateV2( + const setIsFieldInError = useSetAtomComponentState( recordFieldInputIsFieldInErrorComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx index e568aff5a7..593258fe70 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/LinksFieldInput.tsx @@ -6,7 +6,7 @@ import { getFieldLinkDefinedLinks } from '@/object-record/record-field/ui/meta-t import { recordFieldInputIsFieldInErrorComponentState } from '@/object-record/record-field/ui/states/recordFieldInputIsFieldInErrorComponentState'; import { type FieldLinksValue } from '@/object-record/record-field/ui/types/FieldMetadata'; import { linksSchema } from '@/object-record/record-field/ui/types/guards/isFieldLinksValue'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext, useMemo } from 'react'; import { MULTI_ITEM_FIELD_DEFAULT_MAX_VALUES } from 'twenty-shared/constants'; import { absoluteUrlSchema, isDefined } from 'twenty-shared/utils'; @@ -57,7 +57,7 @@ export const LinksFieldInput = () => { const getShowPrimaryIcon = (index: number) => index === 0 && links.length > 1; const getShowSetAsPrimaryButton = (index: number) => index > 0; - const setIsFieldInError = useSetRecoilComponentStateV2( + const setIsFieldInError = useSetAtomComponentState( recordFieldInputIsFieldInErrorComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationManyToOneFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationManyToOneFieldInput.tsx index cb9ffbe17f..40acfe42ad 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationManyToOneFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationManyToOneFieldInput.tsx @@ -12,7 +12,7 @@ import { SingleRecordPicker } from '@/object-record/record-picker/single-record- import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { IconForbid } from 'twenty-ui/display'; @@ -63,11 +63,11 @@ export const MorphRelationManyToOneFieldInput = () => { onCancel?.(); }; - const layoutDirection = useRecoilComponentValueV2( + const layoutDirection = useAtomComponentStateValue( recordFieldInputLayoutDirectionComponentState, ); - const isLoading = useRecoilComponentValueV2( + const isLoading = useAtomComponentStateValue( recordFieldInputLayoutDirectionLoadingComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationOneToManyFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationOneToManyFieldInput.tsx index 0c5537ac6e..700c33cd54 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationOneToManyFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MorphRelationOneToManyFieldInput.tsx @@ -7,7 +7,7 @@ import { recordFieldInputLayoutDirectionComponentState } from '@/object-record/r import { MultipleRecordPicker } from '@/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const MorphRelationOneToManyFieldInput = () => { const instanceId = useAvailableComponentInstanceIdOrThrow( @@ -23,7 +23,7 @@ export const MorphRelationOneToManyFieldInput = () => { onSubmit?.({ skipPersist: true }); }; - const layoutDirection = useRecoilComponentValueV2( + const layoutDirection = useAtomComponentStateValue( recordFieldInputLayoutDirectionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx index 2e6b867189..f22ff019a3 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldInput.tsx @@ -17,7 +17,7 @@ import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentTyp import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CustomError, isDefined } from 'twenty-shared/utils'; import { IconCheck, IconPlus } from 'twenty-ui/display'; import { LightIconButton } from 'twenty-ui/input'; @@ -77,7 +77,7 @@ export const MultiItemFieldInput = ({ RecordFieldComponentInstanceContext, ); - const currentFocusedItem = useRecoilValueV2(currentFocusedItemSelector); + const currentFocusedItem = useAtomStateValue(currentFocusedItemSelector); useListenClickOutside({ refs: [containerRef], diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldMenuItem.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldMenuItem.tsx index 9467f95ace..7b9dd8fa7f 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldMenuItem.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiItemFieldMenuItem.tsx @@ -4,7 +4,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; import { MenuItemWithOptionDropdown } from '@/ui/navigation/menu-item/components/MenuItemWithOptionDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import React, { useState } from 'react'; import { IconBookmark, @@ -44,7 +44,7 @@ export const MultiItemFieldMenuItem = ({ }: MultiItemFieldMenuItemProps) => { const [isHovered, setIsHovered] = useState(false); const { closeDropdown } = useCloseDropdown(); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/PhonesFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/PhonesFieldInput.tsx index a648d24733..9bc3ced547 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/PhonesFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/PhonesFieldInput.tsx @@ -3,7 +3,7 @@ import { usePhonesField } from '@/object-record/record-field/ui/meta-types/hooks import { PhonesFieldMenuItem } from '@/object-record/record-field/ui/meta-types/input/components/PhonesFieldMenuItem'; import { recordFieldInputIsFieldInErrorComponentState } from '@/object-record/record-field/ui/states/recordFieldInputIsFieldInErrorComponentState'; import { phoneSchema } from '@/object-record/record-field/ui/validation-schemas/phoneSchema'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { parsePhoneNumber, type E164Number } from 'libphonenumber-js'; import ReactPhoneNumberInput from 'react-phone-number-input'; @@ -128,7 +128,7 @@ export const PhonesFieldInput = () => { index === 0 && phones.length > 1; const getShowSetAsPrimaryButton = (index: number) => index > 0; - const setIsFieldInError = useSetRecoilComponentStateV2( + const setIsFieldInError = useSetAtomComponentState( recordFieldInputIsFieldInErrorComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx index 06c4758477..ba7228bd4a 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput.tsx @@ -13,8 +13,8 @@ import { singleRecordPickerSelectedIdComponentState } from '@/object-record/reco import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useLingui } from '@lingui/react/macro'; import { useContext } from 'react'; import { CustomError, isDefined } from 'twenty-shared/utils'; @@ -77,16 +77,16 @@ export const RelationManyToOneFieldInput = () => { recordId, }); - const layoutDirection = useRecoilComponentValueV2( + const layoutDirection = useAtomComponentStateValue( recordFieldInputLayoutDirectionComponentState, ); - const isLoading = useRecoilComponentValueV2( + const isLoading = useAtomComponentStateValue( recordFieldInputLayoutDirectionLoadingComponentState, instanceId, ); - const setSingleRecordPickerSelectedId = useSetRecoilComponentStateV2( + const setSingleRecordPickerSelectedId = useSetAtomComponentState( singleRecordPickerSelectedIdComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx index d268915ad2..34e491aed6 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/RelationOneToManyFieldInput.tsx @@ -33,8 +33,8 @@ import { recordStoreFamilyState } from '@/object-record/record-store/states/reco import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { buildRecordLabelPayload } from '@/object-record/utils/buildRecordLabelPayload'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { CustomError, isDefined } from 'twenty-shared/utils'; export const RelationOneToManyFieldInput = () => { @@ -158,12 +158,12 @@ export const RelationOneToManyFieldInput = () => { relationFieldDefinition.metadata.relationObjectMetadataNameSingular, }); - const layoutDirection = useRecoilComponentValueV2( + const layoutDirection = useAtomComponentStateValue( recordFieldInputLayoutDirectionComponentState, ); const multipleRecordPickerPickableMorphItemsCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( multipleRecordPickerPickableMorphItemsComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/BooleanFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/BooleanFieldInput.stories.tsx index cb403a0d7e..6797fa00a1 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/BooleanFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/BooleanFieldInput.stories.tsx @@ -3,7 +3,7 @@ import { useEffect } from 'react'; import { expect, userEvent, within } from 'storybook/test'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; @@ -23,7 +23,7 @@ const BooleanFieldValueSetterEffect = ({ value: boolean; recordId: string; }) => { - const setField = useSetFamilyRecoilStateV2(recordStoreFamilyState, recordId); + const setField = useSetAtomFamilyState(recordStoreFamilyState, recordId); useEffect(() => { setField({ id: recordId, Boolean: value, __typename: 'Person' }); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsx index c1dc7ad851..bff452b08d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/RelationManyToOneFieldInput.stories.tsx @@ -23,18 +23,17 @@ import { recordFieldInputLayoutDirectionLoadingComponentState } from '@/object-r import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { FieldMetadataType } from 'twenty-shared/types'; import { RelationManyToOneFieldInput } from '@/object-record/record-field/ui/meta-types/input/components/RelationManyToOneFieldInput'; import { getFieldInputEventContextProviderWithJestMocks } from './utils/getFieldInputEventContextProviderWithJestMocks'; const RelationWorkspaceSetterEffect = () => { - const setRecordFieldInputLayoutDirectionLoading = - useSetRecoilComponentStateV2( - recordFieldInputLayoutDirectionLoadingComponentState, - 'relation-to-one-field-input-123-Relation', - ); + const setRecordFieldInputLayoutDirectionLoading = useSetAtomComponentState( + recordFieldInputLayoutDirectionLoadingComponentState, + 'relation-to-one-field-input-123-Relation', + ); useEffect(() => { jotaiStore.set(currentWorkspaceState.atom, mockCurrentWorkspace); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts index 1d237fcdd2..1f417587fd 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/hooks/useAddNewRecordAndOpenRightDrawer.ts @@ -10,7 +10,7 @@ import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { viewableRecordIdState } from '@/object-record/record-right-drawer/states/viewableRecordIdState'; import { viewableRecordNameSingularState } from '@/object-record/record-right-drawer/states/viewableRecordNameSingularState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { buildRecordLabelPayload } from '@/object-record/utils/buildRecordLabelPayload'; import { getOperationName } from '@apollo/client/utilities'; import { computeMorphRelationFieldName, isDefined } from 'twenty-shared/utils'; @@ -33,8 +33,8 @@ export const useAddNewRecordAndOpenRightDrawer = ({ relationFieldMetadataItem, recordId, }: useAddNewRecordAndOpenRightDrawerProps) => { - const setViewableRecordId = useSetRecoilStateV2(viewableRecordIdState); - const setViewableRecordNameSingular = useSetRecoilStateV2( + const setViewableRecordId = useSetAtomState(viewableRecordIdState); + const setViewableRecordNameSingular = useSetAtomState( viewableRecordNameSingularState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/states/filesFieldUploadStateV2.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/states/filesFieldUploadStateV2.ts index a09679574e..bd96456e2d 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/states/filesFieldUploadStateV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/states/filesFieldUploadStateV2.ts @@ -1,4 +1,4 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; type FilesFieldUploadStateKey = { recordId: string; @@ -7,7 +7,7 @@ type FilesFieldUploadStateKey = { type FilesFieldUploadState = 'UPLOAD_WINDOW_OPEN' | 'UPLOADING_FILE' | null; -export const filesFieldUploadStateV2 = createFamilyStateV2< +export const filesFieldUploadStateV2 = createAtomFamilyState< FilesFieldUploadState, FilesFieldUploadStateKey >({ diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/states/lastShowPageRecordId.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/states/lastShowPageRecordId.ts index 0615d32dd9..91190dae0c 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/states/lastShowPageRecordId.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/states/lastShowPageRecordId.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const lastShowPageRecordIdState = createStateV2({ +export const lastShowPageRecordIdState = createAtomState({ key: 'lastShowPageRecordIdState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState.ts index ff5419a1e1..d898eda144 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputDraftValueComponentState.ts @@ -1,8 +1,8 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordFieldInputDraftValueComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordFieldInputDraftValueComponentState', defaultValue: undefined, componentInstanceContext: RecordFieldComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputIsFieldInErrorComponentState.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputIsFieldInErrorComponentState.ts index 86ee932b85..dffbefd387 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputIsFieldInErrorComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputIsFieldInErrorComponentState.ts @@ -1,8 +1,8 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordFieldInputIsFieldInErrorComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordFieldInputIsFieldInErrorComponentState', defaultValue: false, componentInstanceContext: RecordFieldComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionComponentState.ts index 6b5fb7aa13..91257a6ff1 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionComponentState.ts @@ -1,9 +1,9 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; import { type FieldInputLayoutDirection } from '@/object-record/record-field/ui/types/FieldInputLayoutDirection'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordFieldInputLayoutDirectionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordFieldInputLayoutDirectionComponentState', defaultValue: 'upward', componentInstanceContext: RecordFieldComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionLoadingComponentState.ts b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionLoadingComponentState.ts index f321e8b8c1..62535ff736 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionLoadingComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-field/ui/states/recordFieldInputLayoutDirectionLoadingComponentState.ts @@ -1,8 +1,8 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordFieldInputLayoutDirectionLoadingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordFieldInputLayoutDirectionLoadingComponentState', defaultValue: true, componentInstanceContext: RecordFieldComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useRemoveRecordFilterGroup.test.tsx b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useRemoveRecordFilterGroup.test.tsx index 5d2b9f57c6..84f3f115d1 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useRemoveRecordFilterGroup.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useRemoveRecordFilterGroup.test.tsx @@ -6,7 +6,7 @@ import { useUpsertRecordFilterGroup } from '@/object-record/record-filter-group/ import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { RecordFilterGroupLogicalOperator } from 'twenty-shared/types'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; @@ -28,7 +28,7 @@ describe('useRemoveRecordFilterGroup', () => { it('should remove an existing record filter group', () => { const { result } = renderHook( () => { - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, 'test', ); @@ -72,7 +72,7 @@ describe('useRemoveRecordFilterGroup', () => { it('should not modify record filter groups when trying to remove a non-existent record filter group', () => { const { result } = renderHook( () => { - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, 'test', ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useUpsertRecordFilterGroup.test.tsx b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useUpsertRecordFilterGroup.test.tsx index 5daf309b38..81bcf6a52e 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useUpsertRecordFilterGroup.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/__tests__/useUpsertRecordFilterGroup.test.tsx @@ -5,7 +5,7 @@ import { useUpsertRecordFilterGroup } from '@/object-record/record-filter-group/ import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { RecordFilterGroupLogicalOperator } from 'twenty-shared/types'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; @@ -27,7 +27,7 @@ describe('useUpsertRecordFilterGroup', () => { it('should add a new record filter group', () => { const { result } = renderHook( () => { - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, 'test', ); @@ -60,7 +60,7 @@ describe('useUpsertRecordFilterGroup', () => { it('should update an existing record filter group', () => { const { result } = renderHook( () => { - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, 'test', ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRecordFilterGroup.ts b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRecordFilterGroup.ts index 5cf50ab0ec..2a16553e56 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRecordFilterGroup.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRecordFilterGroup.ts @@ -1,11 +1,11 @@ import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/context/AdvancedFilterContext'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useContext } from 'react'; export const useRemoveRecordFilterGroup = () => { - const currentRecordFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentRecordFilterGroups = useAtomComponentStateCallbackState( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRootRecordFilterGroupIfEmpty.ts b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRootRecordFilterGroupIfEmpty.ts index dbe38cc5bd..4576446793 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRootRecordFilterGroupIfEmpty.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useRemoveRootRecordFilterGroupIfEmpty.ts @@ -1,16 +1,16 @@ import { useRemoveRecordFilterGroup } from '@/object-record/record-filter-group/hooks/useRemoveRecordFilterGroup'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { isDefined } from 'twenty-shared/utils'; export const useRemoveRootRecordFilterGroupIfEmpty = () => { - const currentRecordFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentRecordFilterGroups = useAtomComponentStateCallbackState( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentStateCallbackStateV2( + const currentRecordFilters = useAtomComponentStateCallbackState( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useUpsertRecordFilterGroup.ts b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useUpsertRecordFilterGroup.ts index b6be2ca495..0cc6044845 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useUpsertRecordFilterGroup.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter-group/hooks/useUpsertRecordFilterGroup.ts @@ -1,12 +1,12 @@ import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/context/AdvancedFilterContext'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useContext } from 'react'; export const useUpsertRecordFilterGroup = () => { - const currentRecordFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentRecordFilterGroups = useAtomComponentStateCallbackState( currentRecordFilterGroupsComponentState, ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState.ts index 3732ebcdaa..2318c9645d 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState.ts @@ -1,8 +1,8 @@ import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext'; import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const currentRecordFilterGroupsComponentState = createComponentStateV2< +export const currentRecordFilterGroupsComponentState = createAtomComponentState< RecordFilterGroup[] >({ key: 'currentRecordFilterGroupsComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useRemoveRecordFilter.test.tsx b/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useRemoveRecordFilter.test.tsx index 041d560104..931146d102 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useRemoveRecordFilter.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useRemoveRecordFilter.test.tsx @@ -6,7 +6,7 @@ import { useUpsertRecordFilter } from '@/object-record/record-filter/hooks/useUp import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewFilterOperand } from 'twenty-shared/types'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; @@ -29,7 +29,7 @@ describe('useRemoveRecordFilter', () => { it('should remove an existing record filter', () => { const { result } = renderHook( () => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'test', ); @@ -77,7 +77,7 @@ describe('useRemoveRecordFilter', () => { it('should not modify filters when trying to remove a non-existent filter', () => { const { result } = renderHook( () => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'test', ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useUpsertRecordFilter.test.tsx b/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useUpsertRecordFilter.test.tsx index 46e427a457..8f646ebe83 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useUpsertRecordFilter.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/__tests__/useUpsertRecordFilter.test.tsx @@ -5,7 +5,7 @@ import { useUpsertRecordFilter } from '@/object-record/record-filter/hooks/useUp import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewFilterOperand } from 'twenty-shared/types'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper'; @@ -28,7 +28,7 @@ describe('useUpsertRecordFilter', () => { it('should add a new filter when record filter id does not exist', () => { const { result } = renderHook( () => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'test', ); @@ -63,7 +63,7 @@ describe('useUpsertRecordFilter', () => { it('should update an existing filter when record filter id exists', () => { const { result } = renderHook( () => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'test', ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useCreateRecordFilterFromObjectFilterDropdownCurrentStates.ts b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useCreateRecordFilterFromObjectFilterDropdownCurrentStates.ts index e717751155..af2d2a7743 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useCreateRecordFilterFromObjectFilterDropdownCurrentStates.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useCreateRecordFilterFromObjectFilterDropdownCurrentStates.ts @@ -2,8 +2,8 @@ import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-recor import { selectedOperandInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/selectedOperandInDropdownComponentState'; import { subFieldNameUsedInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/subFieldNameUsedInDropdownComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { getFilterTypeFromFieldType, isDefined } from 'twenty-shared/utils'; @@ -12,17 +12,17 @@ import { v4 } from 'uuid'; export const useCreateRecordFilterFromObjectFilterDropdownCurrentStates = () => { const fieldMetadataItemUsedInDropdownCallbackState = - useRecoilComponentSelectorCallbackStateV2( + useAtomComponentSelectorCallbackState( fieldMetadataItemUsedInDropdownComponentSelector, ); const selectedOperandInDropdownCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( selectedOperandInDropdownComponentState, ); const subFieldNameUsedInDropdownCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( subFieldNameUsedInDropdownComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterValueDependencies.ts b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterValueDependencies.ts index d880dcc55a..5b1073c7db 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterValueDependencies.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterValueDependencies.ts @@ -2,14 +2,14 @@ import { useMemo } from 'react'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type RecordFilterValueDependencies } from 'twenty-shared/types'; export const useFilterValueDependencies = (): { filterValueDependencies: RecordFilterValueDependencies; } => { const { id: currentWorkspaceMemberId } = - useRecoilValueV2(currentWorkspaceMemberState) ?? {}; + useAtomStateValue(currentWorkspaceMemberState) ?? {}; const { userTimezone } = useUserTimezone(); diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterableFieldMetadataItems.ts b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterableFieldMetadataItems.ts index 9d82ab9bda..9a6e36f459 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterableFieldMetadataItems.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useFilterableFieldMetadataItems.ts @@ -1,10 +1,10 @@ import { availableFieldMetadataItemsForFilterFamilySelector } from '@/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; export const useFilterableFieldMetadataItems = ( objectMetadataItemId: string, ) => { - const filterableFieldMetadataItems = useFamilySelectorValueV2( + const filterableFieldMetadataItems = useAtomFamilySelectorValue( availableFieldMetadataItemsForFilterFamilySelector, { objectMetadataItemId, diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRelativeDateFilterWithUserTimezone.ts b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRelativeDateFilterWithUserTimezone.ts index f8e03e2586..78e3c2dfc1 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRelativeDateFilterWithUserTimezone.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useGetRelativeDateFilterWithUserTimezone.ts @@ -1,14 +1,14 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { detectCalendarStartDay } from '@/localization/utils/detection/detectCalendarStartDay'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CalendarStartDay } from 'twenty-shared/constants'; import { type FirstDayOfTheWeek } from 'twenty-shared/types'; import { type RelativeDateFilter } from 'twenty-shared/utils'; export const useGetRelativeDateFilterWithUserTimezone = () => { const { userTimezone } = useUserTimezone(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const getRelativeDateFilterWithUserTimezone = ( relativeDateFilter: RelativeDateFilter, diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useRemoveRecordFilter.ts b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useRemoveRecordFilter.ts index bf5b2633a1..b9e6af535f 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useRemoveRecordFilter.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useRemoveRecordFilter.ts @@ -1,13 +1,13 @@ import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/context/AdvancedFilterContext'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback, useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useRemoveRecordFilter = () => { - const currentRecordFilters = useRecoilComponentStateCallbackStateV2( + const currentRecordFilters = useAtomComponentStateCallbackState( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useUpsertRecordFilter.ts b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useUpsertRecordFilter.ts index 85e2f4f013..ad0c29fa16 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/hooks/useUpsertRecordFilter.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/hooks/useUpsertRecordFilter.ts @@ -1,12 +1,12 @@ import { AdvancedFilterContext } from '@/object-record/advanced-filter/states/context/AdvancedFilterContext'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback, useContext } from 'react'; export const useUpsertRecordFilter = () => { - const currentRecordFilters = useRecoilComponentStateCallbackStateV2( + const currentRecordFilters = useAtomComponentStateCallbackState( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-filter/states/anyFieldFilterValueComponentState.ts b/packages/twenty-front/src/modules/object-record/record-filter/states/anyFieldFilterValueComponentState.ts index 799e277fd3..fe22fa4a64 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/states/anyFieldFilterValueComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/states/anyFieldFilterValueComponentState.ts @@ -1,10 +1,9 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const anyFieldFilterValueComponentState = createComponentStateV2( - { +export const anyFieldFilterValueComponentState = + createAtomComponentState({ key: 'anyFieldFilterValueComponentState', defaultValue: '', componentInstanceContext: RecordFiltersComponentInstanceContext, - }, -); + }); diff --git a/packages/twenty-front/src/modules/object-record/record-filter/states/currentRecordFiltersComponentState.ts b/packages/twenty-front/src/modules/object-record/record-filter/states/currentRecordFiltersComponentState.ts index 247d164ba7..76efcb9b5f 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/states/currentRecordFiltersComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/states/currentRecordFiltersComponentState.ts @@ -1,8 +1,8 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const currentRecordFiltersComponentState = createComponentStateV2< +export const currentRecordFiltersComponentState = createAtomComponentState< RecordFilter[] >({ key: 'currentRecordFiltersComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-filter/states/hasAnySoftDeleteFilterOnView.ts b/packages/twenty-front/src/modules/object-record/record-filter/states/hasAnySoftDeleteFilterOnView.ts index fe0dec6aca..a2b411eae6 100644 --- a/packages/twenty-front/src/modules/object-record/record-filter/states/hasAnySoftDeleteFilterOnView.ts +++ b/packages/twenty-front/src/modules/object-record/record-filter/states/hasAnySoftDeleteFilterOnView.ts @@ -3,10 +3,10 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-fi import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { isRecordFilterAboutSoftDelete } from '@/object-record/record-filter/utils/isRecordFilterAboutSoftDelete'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const hasAnySoftDeleteFilterOnViewComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'hasAnySoftDeleteFilterOnViewComponentSelector', componentInstanceContext: RecordFiltersComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupMenuItemDraggable.tsx b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupMenuItemDraggable.tsx index 0cc186f180..40332d06f3 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupMenuItemDraggable.tsx +++ b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupMenuItemDraggable.tsx @@ -3,7 +3,7 @@ import { type RecordGroupDefinition, RecordGroupDefinitionType, } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; import { Tag } from 'twenty-ui/components'; @@ -25,7 +25,7 @@ export const RecordGroupMenuItemDraggable = ({ onVisibilityChange, isVisibleLimitReached = false, }: RecordGroupMenuItemDraggableProps) => { - const recordGroup = useFamilyRecoilValueV2( + const recordGroup = useAtomFamilyStateValue( recordGroupDefinitionFamilyState, recordGroupId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx index 4df4068ea4..04b331e932 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-group/components/RecordGroupReorderConfirmationModal.tsx @@ -1,7 +1,7 @@ import { RECORD_GROUP_REORDER_CONFIRMATION_MODAL_ID } from '@/object-record/record-group/constants/RecordGroupReorderConfirmationModalId'; import { recordIndexRecordGroupSortComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupSortComponentState'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { type ReactNode } from 'react'; import { createPortal } from 'react-dom'; @@ -13,7 +13,7 @@ type RecordGroupReorderConfirmationModalProps = { export const RecordGroupReorderConfirmationModal = ({ onConfirmClick, }: RecordGroupReorderConfirmationModalProps): ReactNode => { - const recordGroupSort = useRecoilComponentValueV2( + const recordGroupSort = useAtomComponentStateValue( recordIndexRecordGroupSortComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useCurrentRecordGroupDefinition.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useCurrentRecordGroupDefinition.ts index 52bc72c21d..958518e935 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useCurrentRecordGroupDefinition.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useCurrentRecordGroupDefinition.ts @@ -1,12 +1,12 @@ import { RecordGroupContext } from '@/object-record/record-group/states/context/RecordGroupContext'; import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useContext } from 'react'; export const useCurrentRecordGroupDefinition = () => { const context = useContext(RecordGroupContext); - const recordGroupDefinition = useFamilyRecoilValueV2( + const recordGroupDefinition = useAtomFamilyStateValue( recordGroupDefinitionFamilyState, context?.recordGroupId ?? '', ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupActions.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupActions.ts index 1d76f9dd3e..1d65ebca16 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupActions.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupActions.ts @@ -9,9 +9,9 @@ import { useRecordIndexIdFromCurrentContextStore } from '@/object-record/record- import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type ViewType } from '@/views/types/ViewType'; import { t } from '@lingui/core/macro'; import { isUndefined } from '@sniptt/guards'; @@ -49,18 +49,18 @@ export const useRecordGroupActions = ({ objectNameSingular, }); - const recordIndexGroupFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); const { handleVisibilityChange: handleRecordGroupVisibilityChange } = useRecordGroupVisibility(); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, viewType, ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupFilter.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupFilter.ts index 02cbeb3fab..6bfc93487b 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupFilter.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupFilter.ts @@ -1,13 +1,13 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { useCurrentRecordGroupDefinition } from '@/object-record/record-group/hooks/useCurrentRecordGroupDefinition'; import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useMemo } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useRecordGroupFilter = (fields: FieldMetadataItem[]) => { const currentRecordGroupDefinition = useCurrentRecordGroupDefinition(); - const groupFieldMetadata = useRecoilComponentValueV2( + const groupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.ts index 77819d1cf8..a5feb2eca3 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupReorderConfirmationModal.ts @@ -7,8 +7,8 @@ import { useCloseAnyOpenDropdown } from '@/ui/layout/dropdown/hooks/useCloseAnyO import { useGoBackToPreviousDropdownFocusId } from '@/ui/layout/dropdown/hooks/useGoBackToPreviousDropdownFocusId'; import { useSetActiveDropdownFocusIdAndMemorizePrevious } from '@/ui/layout/dropdown/hooks/useSetFocusedDropdownIdAndMemorizePrevious'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { type ViewType } from '@/views/types/ViewType'; import { type OnDragEndResponder } from '@hello-pangea/dnd'; import { useState } from 'react'; @@ -47,12 +47,12 @@ export const useRecordGroupReorderConfirmationModal = ({ toIndex: result.destination.index - 1, }); }; - const isDragableSortRecordGroup = useRecoilComponentSelectorValueV2( + const isDragableSortRecordGroup = useAtomComponentSelectorValue( recordIndexRecordGroupIsDraggableSortComponentSelector, recordIndexId, ); - const [, setRecordGroupSort] = useRecoilComponentStateV2( + const [, setRecordGroupSort] = useAtomComponentState( recordIndexRecordGroupSortComponentState, ); const { closeAnyOpenDropdown } = useCloseAnyOpenDropdown(); diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupVisibility.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupVisibility.ts index 1f9ba4e904..fa36abb604 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupVisibility.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useRecordGroupVisibility.ts @@ -3,7 +3,7 @@ import { useStore } from 'jotai'; import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; import { recordIndexShouldHideEmptyRecordGroupsComponentState } from '@/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useSaveCurrentViewGroups } from '@/views/hooks/useSaveCurrentViewGroups'; import { useUpdateCurrentView } from '@/views/hooks/useUpdateCurrentView'; import { recordGroupDefinitionToViewGroup } from '@/views/utils/recordGroupDefinitionToViewGroup'; @@ -13,7 +13,7 @@ export const useRecordGroupVisibility = () => { const store = useStore(); const recordIndexShouldHideEmptyRecordGroups = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordIndexShouldHideEmptyRecordGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useReorderRecordGroups.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useReorderRecordGroups.ts index 1d08be2533..84b03116ae 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useReorderRecordGroups.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useReorderRecordGroups.ts @@ -6,8 +6,8 @@ import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/s import { visibleRecordGroupIdsComponentFamilySelector } from '@/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector'; import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilySelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilySelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState'; import { useSaveCurrentViewGroups } from '@/views/hooks/useSaveCurrentViewGroups'; import { type ViewType } from '@/views/types/ViewType'; import { mapRecordGroupDefinitionsToViewGroups } from '@/views/utils/mapRecordGroupDefinitionsToViewGroups'; @@ -35,14 +35,14 @@ export const useReorderRecordGroups = ({ const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); const visibleRecordGroupIdsFamilySelector = - useRecoilComponentFamilySelectorCallbackStateV2( + useAtomComponentFamilySelectorCallbackState( visibleRecordGroupIdsComponentFamilySelector, recordIndexId, ); const { saveViewGroups } = useSaveCurrentViewGroups(); - const groupFieldMetadata = useRecoilComponentValueV2( + const groupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/hooks/useShouldHideRecordGroup.ts b/packages/twenty-front/src/modules/object-record/record-group/hooks/useShouldHideRecordGroup.ts index b19ea1f86b..5b42c6c1ce 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/hooks/useShouldHideRecordGroup.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/hooks/useShouldHideRecordGroup.ts @@ -1,14 +1,14 @@ import { emptyRecordGroupByIdComponentFamilyState } from '@/object-record/record-group/states/emptyRecordGroupByIdComponentFamilyState'; import { recordIndexShouldHideEmptyRecordGroupsComponentState } from '@/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useShouldHideRecordGroup = (recordGroupId: string): boolean => { - const shouldHideEmptyRecordGroups = useRecoilComponentValueV2( + const shouldHideEmptyRecordGroups = useAtomComponentStateValue( recordIndexShouldHideEmptyRecordGroupsComponentState, ); - const isRecordGroupEmpty = useRecoilComponentFamilyValueV2( + const isRecordGroupEmpty = useAtomComponentFamilyStateValue( emptyRecordGroupByIdComponentFamilyState, recordGroupId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/emptyRecordGroupByIdComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-group/states/emptyRecordGroupByIdComponentFamilyState.ts index d064e42233..4de5136d22 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/emptyRecordGroupByIdComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/emptyRecordGroupByIdComponentFamilyState.ts @@ -1,8 +1,8 @@ -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const emptyRecordGroupByIdComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'emptyRecordGroupByIdComponentFamilyState', defaultValue: false, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupDefinitionFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupDefinitionFamilyState.ts index a0548046a8..1d20f5f7f7 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupDefinitionFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupDefinitionFamilyState.ts @@ -1,7 +1,7 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -export const recordGroupDefinitionFamilyState = createFamilyStateV2< +export const recordGroupDefinitionFamilyState = createAtomFamilyState< RecordGroupDefinition | undefined, RecordGroupDefinition['id'] >({ diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupIdsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupIdsComponentState.ts index 8eee5054a3..eab8d6d250 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupIdsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupIdsComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; -export const recordGroupIdsComponentState = createComponentStateV2< +export const recordGroupIdsComponentState = createAtomComponentState< RecordGroupDefinition['id'][] >({ key: 'recordGroupIdsComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupPendingDragEndReorderStateV2.ts b/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupPendingDragEndReorderStateV2.ts index 51e8b72dcb..ddd028ad2f 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupPendingDragEndReorderStateV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/recordGroupPendingDragEndReorderStateV2.ts @@ -1,9 +1,9 @@ import { type OnDragEndResponder } from '@hello-pangea/dnd'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const recordGroupPendingDragEndReorderStateV2 = - createStateV2 | null>({ + createAtomState | null>({ key: 'recordGroupPendingDragEndReorderStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/availableRecordGroupIdsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/availableRecordGroupIdsComponentSelector.ts index ac2fc27188..9324a72949 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/availableRecordGroupIdsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/availableRecordGroupIdsComponentSelector.ts @@ -5,12 +5,12 @@ import { RecordGroupDefinitionType, } from '@/object-record/record-group/types/RecordGroupDefinition'; import { recordGroupSortedInsert } from '@/object-record/record-group/utils/recordGroupSortedInsert'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { isDefined } from 'twenty-shared/utils'; export const availableRecordGroupIdsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'availableRecordGroupIdsComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector.ts index 158c17dc1e..281d8031cd 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector.ts @@ -1,10 +1,10 @@ import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const hasRecordGroupsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'hasRecordGroupsComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hiddenRecordGroupIdsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hiddenRecordGroupIdsComponentSelector.ts index a0e6d8ecff..c20aedd745 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hiddenRecordGroupIdsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/hiddenRecordGroupIdsComponentSelector.ts @@ -1,33 +1,32 @@ import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { isDefined } from 'twenty-shared/utils'; -export const hiddenRecordGroupIdsComponentSelector = createComponentSelectorV2< - RecordGroupDefinition['id'][] ->({ - key: 'hiddenRecordGroupIdsComponentSelector', - componentInstanceContext: ViewComponentInstanceContext, - get: - ({ instanceId }) => - ({ get }) => { - const recordGroupIds = get(recordGroupIdsComponentState, { - instanceId, - }); +export const hiddenRecordGroupIdsComponentSelector = + createAtomComponentSelector({ + key: 'hiddenRecordGroupIdsComponentSelector', + componentInstanceContext: ViewComponentInstanceContext, + get: + ({ instanceId }) => + ({ get }) => { + const recordGroupIds = get(recordGroupIdsComponentState, { + instanceId, + }); - return recordGroupIds.filter((recordGroupId) => { - const recordGroupDefinition = get( - recordGroupDefinitionFamilyState, - recordGroupId, - ); + return recordGroupIds.filter((recordGroupId) => { + const recordGroupDefinition = get( + recordGroupDefinitionFamilyState, + recordGroupId, + ); - if (!isDefined(recordGroupDefinition)) { - return false; - } + if (!isDefined(recordGroupDefinition)) { + return false; + } - return !recordGroupDefinition.isVisible; - }); - }, -}); + return !recordGroupDefinition.isVisible; + }); + }, + }); diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupDefinitionsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupDefinitionsComponentSelector.ts index cffffdd045..3e37de61ac 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupDefinitionsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupDefinitionsComponentSelector.ts @@ -1,12 +1,12 @@ import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { isDefined } from 'twenty-shared/utils'; export const recordGroupDefinitionsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'recordGroupDefinitionsComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupFromGroupValueComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupFromGroupValueComponentFamilySelector.ts index 9caaa683b2..b62e90f9d2 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupFromGroupValueComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/recordGroupFromGroupValueComponentFamilySelector.ts @@ -1,13 +1,13 @@ import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { type Nullable } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const recordGroupFromGroupValueComponentFamilySelector = - createComponentFamilySelectorV2< + createAtomComponentFamilySelector< RecordGroupDefinition | undefined, { recordGroupValue: Nullable } >({ diff --git a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector.ts index 0513446b51..5adcd92ef4 100644 --- a/packages/twenty-front/src/modules/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-group/states/selectors/visibleRecordGroupIdsComponentFamilySelector.ts @@ -6,13 +6,13 @@ import { recordGroupSortedInsert } from '@/object-record/record-group/utils/reco import { recordIndexRecordGroupSortComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupSortComponentState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { recordIndexShouldHideEmptyRecordGroupsComponentState } from '@/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { type ViewType } from '@/views/types/ViewType'; import { isDefined } from 'twenty-shared/utils'; export const visibleRecordGroupIdsComponentFamilySelector = - createComponentFamilySelectorV2({ + createAtomComponentFamilySelector({ key: 'visibleRecordGroupIdsComponentFamilySelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx index 62f9754a45..c410e8863d 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx @@ -5,7 +5,7 @@ import { RecordBoardContainer } from '@/object-record/record-board/components/Re import { RecordIndexTableContainer } from '@/object-record/record-index/components/RecordIndexTableContainer'; import { RecordIndexViewBarEffect } from '@/object-record/record-index/components/RecordIndexViewBarEffect'; import { recordIndexViewTypeState } from '@/object-record/record-index/states/recordIndexViewTypeState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { InformationBannerWrapper } from '@/information-banner/components/InformationBannerWrapper'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; @@ -32,7 +32,7 @@ const StyledContainerWithPadding = styled.div` `; export const RecordIndexContainer = () => { - const recordIndexViewType = useRecoilValueV2(recordIndexViewTypeState); + const recordIndexViewType = useAtomStateValue(recordIndexViewTypeState); const { objectNamePlural, diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerContextStoreNumberOfSelectedRecordsEffect.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerContextStoreNumberOfSelectedRecordsEffect.tsx index 7f176307be..6d03a8fa17 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerContextStoreNumberOfSelectedRecordsEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainerContextStoreNumberOfSelectedRecordsEffect.tsx @@ -10,17 +10,17 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { useFindManyRecordIndexTableParams } from '@/object-record/record-index/hooks/useFindManyRecordIndexTableParams'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect } from 'react'; export const RecordIndexContainerContextStoreNumberOfSelectedRecordsEffect = () => { - const setContextStoreNumberOfSelectedRecords = useSetRecoilComponentStateV2( + const setContextStoreNumberOfSelectedRecords = useSetAtomComponentState( contextStoreNumberOfSelectedRecordsComponentState, ); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, ); @@ -38,15 +38,15 @@ export const RecordIndexContainerContextStoreNumberOfSelectedRecordsEffect = objectMetadataItem?.nameSingular ?? '', ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexFiltersToContextStoreEffect.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexFiltersToContextStoreEffect.tsx index 247998d7e5..702f8f8bf4 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexFiltersToContextStoreEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexFiltersToContextStoreEffect.tsx @@ -11,38 +11,38 @@ import { useRecordIndexContextOrThrow } from '@/object-record/record-index/conte import { hasUserSelectedAllRowsComponentState } from '@/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState'; import { selectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/selectedRowIdsComponentSelector'; import { unselectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/unselectedRowIdsComponentSelector'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export const RecordIndexFiltersToContextStoreEffect = () => { const { recordIndexId } = useRecordIndexContextOrThrow(); - const recordIndexFilters = useRecoilComponentValueV2( + const recordIndexFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, recordIndexId, ); - const recordIndexFilterGroups = useRecoilComponentValueV2( + const recordIndexFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, recordIndexId, ); - const setContextStoreTargetedRecords = useSetRecoilComponentStateV2( + const setContextStoreTargetedRecords = useSetAtomComponentState( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); - const hasUserSelectedAllRows = useRecoilComponentValueV2( + const hasUserSelectedAllRows = useAtomComponentStateValue( hasUserSelectedAllRowsComponentState, recordIndexId, ); - const selectedRowIds = useRecoilComponentSelectorValueV2( + const selectedRowIds = useAtomComponentSelectorValue( selectedRowIdsComponentSelector, recordIndexId, ); - const unselectedRowIds = useRecoilComponentSelectorValueV2( + const unselectedRowIds = useAtomComponentSelectorValue( unselectedRowIdsComponentSelector, recordIndexId, ); @@ -73,12 +73,12 @@ export const RecordIndexFiltersToContextStoreEffect = () => { unselectedRowIds, ]); - const setContextStoreFilters = useSetRecoilComponentStateV2( + const setContextStoreFilters = useSetAtomComponentState( contextStoreFiltersComponentState, recordIndexId, ); - const setContextStoreFilterGroups = useSetRecoilComponentStateV2( + const setContextStoreFilterGroups = useSetAtomComponentState( contextStoreFilterGroupsComponentState, recordIndexId, ); @@ -97,12 +97,12 @@ export const RecordIndexFiltersToContextStoreEffect = () => { setContextStoreFilters, ]); - const setContextStoreAnyFieldFilterValue = useSetRecoilComponentStateV2( + const setContextStoreAnyFieldFilterValue = useSetAtomComponentState( contextStoreAnyFieldFilterValueComponentState, recordIndexId, ); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregateQueryEffect.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregateQueryEffect.tsx index 1385c6ae85..8cbe20e0b3 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregateQueryEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregateQueryEffect.tsx @@ -9,8 +9,8 @@ import { useSetRecordIndexAggregateDisplayValueForRecordGroupValue } from '@/obj import { recordIndexAggregateDisplayLabelComponentState } from '@/object-record/record-index/states/recordIndexAggregateDisplayLabelComponentState'; import { turnRecordIndexGroupByAggregateQueryResultIntoRecordAggregateValueByGroupValue } from '@/object-record/record-index/utils/turnRecordIndexGroupByAggregateQueryResultIntoRecordAggregateValueByGroupValue'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useEffect } from 'react'; import { type Nullable } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -40,10 +40,9 @@ export const RecordIndexGroupAggregateQueryEffect = ({ recordIndexGroupAggregateOperation, }); - const recordIndexAggregateDisplayLabel = - useRecoilComponentStateCallbackStateV2( - recordIndexAggregateDisplayLabelComponentState, - ); + const recordIndexAggregateDisplayLabel = useAtomComponentStateCallbackState( + recordIndexAggregateDisplayLabelComponentState, + ); const { setRecordIndexAggregateDisplayLabel } = useSetRecordIndexAggregateDisplayLabel(); @@ -51,7 +50,7 @@ export const RecordIndexGroupAggregateQueryEffect = ({ const { setRecordIndexAggregateDisplayValueForRecordGroupValue } = useSetRecordIndexAggregateDisplayValueForRecordGroupValue(); - const recordGroupDefinitions = useRecoilComponentSelectorValueV2( + const recordGroupDefinitions = useAtomComponentSelectorValue( recordGroupDefinitionsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregatesDataLoader.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregatesDataLoader.tsx index 65733f3902..8410aca6f2 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregatesDataLoader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexGroupAggregatesDataLoader.tsx @@ -3,19 +3,19 @@ import { recordIndexGroupAggregateFieldMetadataItemComponentState } from '@/obje import { recordIndexGroupAggregateOperationComponentState } from '@/object-record/record-index/states/recordIndexGroupAggregateOperationComponentState'; import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const RecordIndexGroupAggregatesDataLoader = () => { - const recordIndexGroupFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); - const recordIndexGroupAggregateFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupAggregateFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupAggregateFieldMetadataItemComponentState, ); - const recordIndexGroupAggregateOperation = useRecoilComponentValueV2( + const recordIndexGroupAggregateOperation = useAtomComponentStateValue( recordIndexGroupAggregateOperationComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexLoadBaseOnContextStoreEffect.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexLoadBaseOnContextStoreEffect.tsx index e3fc3457a4..38a33077e7 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexLoadBaseOnContextStoreEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexLoadBaseOnContextStoreEffect.tsx @@ -1,15 +1,15 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { useLoadRecordIndexStates } from '@/object-record/record-index/hooks/useLoadRecordIndexStates'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { useEffect, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const RecordIndexLoadBaseOnContextStoreEffect = () => { const { loadRecordIndexStates } = useLoadRecordIndexStates(); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); @@ -17,7 +17,7 @@ export const RecordIndexLoadBaseOnContextStoreEffect = () => { undefined, ); - const view = useFamilySelectorValueV2(coreViewFromViewIdFamilySelector, { + const view = useAtomFamilySelectorValue(coreViewFromViewIdFamilySelector, { viewId: contextStoreCurrentViewId ?? '', }); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx index 8a5f01468f..e069f0d616 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageHeader.tsx @@ -6,7 +6,7 @@ import { useFilteredObjectMetadataItems } from '@/object-metadata/hooks/useFilte import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { PageHeaderToggleCommandMenuButton } from '@/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton'; import { PageHeader } from '@/ui/layout/page/components/PageHeader'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; @@ -32,7 +32,7 @@ export const RecordIndexPageHeader = () => { const { findObjectMetadataItemByNamePlural } = useFilteredObjectMetadataItems(); - const contextStoreNumberOfSelectedRecords = useRecoilComponentValueV2( + const contextStoreNumberOfSelectedRecords = useAtomComponentStateValue( contextStoreNumberOfSelectedRecordsComponentState, ); @@ -59,7 +59,7 @@ export const RecordIndexPageHeader = () => { label ); - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageKanbanAddMenuItem.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageKanbanAddMenuItem.tsx index facb0587e4..847449db42 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageKanbanAddMenuItem.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexPageKanbanAddMenuItem.tsx @@ -1,6 +1,6 @@ import { recordGroupDefinitionFamilyState } from '@/object-record/record-group/states/recordGroupDefinitionFamilyState'; import { RecordGroupDefinitionType } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; import { MenuItem } from 'twenty-ui/navigation'; @@ -19,7 +19,7 @@ export const RecordIndexPageKanbanAddMenuItem = ({ columnId, onItemClick, }: RecordIndexPageKanbanAddMenuItemProps) => { - const recordGroupDefinition = useFamilyRecoilValueV2( + const recordGroupDefinition = useAtomFamilyStateValue( recordGroupDefinitionFamilyState, columnId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsx index 93ecfa9935..6d3443a544 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexRemoveSortingModal.tsx @@ -2,13 +2,13 @@ import { RECORD_INDEX_REMOVE_SORTING_MODAL_ID } from '@/object-record/record-ind import { useRemoveRecordSort } from '@/object-record/record-sort/hooks/useRemoveRecordSort'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useLingui } from '@lingui/react/macro'; export const RecordIndexRemoveSortingModal = () => { const { t } = useLingui(); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsx b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsx index 2019578b8d..00ad5d8449 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexTableContainer.tsx @@ -5,7 +5,7 @@ import { RECORD_INDEX_REMOVE_SORTING_MODAL_ID } from '@/object-record/record-ind import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { RecordTableWithWrappers } from '@/object-record/record-table/components/RecordTableWithWrappers'; import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; type RecordIndexTableContainerProps = { recordTableId: string; @@ -17,7 +17,7 @@ export const RecordIndexTableContainer = ({ const { objectNameSingular, viewBarInstanceId } = useRecordIndexContextOrThrow(); - const isRecordIndexRemoveSortingModalOpened = useRecoilComponentValueV2( + const isRecordIndexRemoveSortingModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, RECORD_INDEX_REMOVE_SORTING_MODAL_ID, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts b/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts index 2e626ee37f..5aa93699d4 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/export/hooks/useRecordIndexLazyFetchRecords.ts @@ -16,8 +16,8 @@ import { type RecordField } from '@/object-record/record-field/types/RecordField import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; import { useFindManyRecordIndexTableParams } from '@/object-record/record-index/hooks/useFindManyRecordIndexTableParams'; import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewType } from '@/views/types/ViewType'; import { isDefined } from 'twenty-shared/utils'; @@ -59,7 +59,7 @@ export const useRecordIndexLazyFetchRecords = ({ viewBarId: recordIndexId, }); - const recordGroupFieldMetadata = useRecoilComponentValueV2( + const recordGroupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, recordIndexId, ); @@ -68,22 +68,22 @@ export const useRecordIndexLazyFetchRecords = ({ (column) => column.metadata.fieldName === recordGroupFieldMetadata?.name, ); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, recordIndexId, ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, recordIndexId, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, recordIndexId, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, recordIndexId, ); @@ -103,7 +103,7 @@ export const useRecordIndexLazyFetchRecords = ({ contextStoreAnyFieldFilterValue, }); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useFindManyRecordIndexTableParams.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useFindManyRecordIndexTableParams.ts index ebe26c2e11..c8c2b30476 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useFindManyRecordIndexTableParams.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useFindManyRecordIndexTableParams.ts @@ -8,7 +8,7 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte import { useCurrentRecordGroupDefinition } from '@/object-record/record-group/hooks/useCurrentRecordGroupDefinition'; import { useRecordGroupFilter } from '@/object-record/record-group/hooks/useRecordGroupFilter'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { combineFilters, computeRecordGqlOperationFilter, @@ -29,15 +29,15 @@ export const useFindManyRecordIndexTableParams = ( const currentRecordGroupDefinition = useCurrentRecordGroupDefinition(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); @@ -50,7 +50,7 @@ export const useFindManyRecordIndexTableParams = ( filterValueDependencies, }); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts index ad10635f2e..2be5aaeec1 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts @@ -1,6 +1,6 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { AppPath } from 'twenty-shared/types'; import { getAppPath } from 'twenty-shared/utils'; @@ -11,7 +11,7 @@ export const useHandleIndexIdentifierClick = ({ recordIndexId: string; objectMetadataItem: ObjectMetadataItem; }) => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleRecordGroupField.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleRecordGroupField.ts index 1040db1153..19a81871bd 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleRecordGroupField.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleRecordGroupField.ts @@ -3,7 +3,7 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { useSetRecordGroups } from '@/object-record/record-group/hooks/useSetRecordGroups'; import { useLoadRecordIndexStates } from '@/object-record/record-index/hooks/useLoadRecordIndexStates'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewAPIUpdate } from '@/views/hooks/internal/usePerformViewAPIUpdate'; import { useGetViewFromPrefetchState } from '@/views/hooks/useGetViewFromPrefetchState'; import { useRefreshCoreViewsByObjectMetadataId } from '@/views/hooks/useRefreshCoreViewsByObjectMetadataId'; @@ -17,7 +17,7 @@ import { type CoreView } from '~/generated-metadata/graphql'; import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull'; export const useHandleRecordGroupField = () => { - const currentViewIdCallbackState = useRecoilComponentStateCallbackStateV2( + const currentViewIdCallbackState = useAtomComponentStateCallbackState( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleColumnSort.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleColumnSort.ts index e9456f33ec..b4df123870 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleColumnSort.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleColumnSort.ts @@ -3,7 +3,7 @@ import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMeta import { useUpsertRecordSort } from '@/object-record/record-sort/hooks/useUpsertRecordSort'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { type RecordSort } from '@/object-record/record-sort/types/RecordSort'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -26,8 +26,9 @@ export const useHandleToggleColumnSort = ({ const { upsertRecordSort } = useUpsertRecordSort(); - const currentRecordSortsCallbackState = - useRecoilComponentStateCallbackStateV2(currentRecordSortsComponentState); + const currentRecordSortsCallbackState = useAtomComponentStateCallbackState( + currentRecordSortsComponentState, + ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleTrashColumnFilter.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleTrashColumnFilter.ts index e800e1c907..a15d4bb06b 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleTrashColumnFilter.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useHandleToggleTrashColumnFilter.ts @@ -6,7 +6,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata import { useUpsertRecordFilter } from '@/object-record/record-filter/hooks/useUpsertRecordFilter'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { isSoftDeleteFilterActiveComponentState } from '@/object-record/record-table/states/isSoftDeleteFilterActiveComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { t } from '@lingui/core/macro'; import { getFilterTypeFromFieldType, isDefined } from 'twenty-shared/utils'; @@ -30,7 +30,7 @@ export const useHandleToggleTrashColumnFilter = ({ useColumnDefinitionsFromObjectMetadata(objectMetadataItem); const isSoftDeleteFilterActiveComponentRecoilState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( isSoftDeleteFilterActiveComponentState, viewBarId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts index 388d1f5d16..169b394432 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts @@ -25,7 +25,7 @@ import { type ColumnDefinition } from '@/object-record/record-table/types/Column import { convertAggregateOperationToExtendedAggregateOperation } from '@/object-record/utils/convertAggregateOperationToExtendedAggregateOperation'; import { filterAvailableTableColumns } from '@/object-record/utils/filterAvailableTableColumns'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { hasInitializedCurrentRecordFieldsComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFieldsComponentFamilyState'; import { hasInitializedCurrentRecordFiltersComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState'; import { hasInitializedCurrentRecordSortsComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordSortsComponentFamilyState'; @@ -43,27 +43,27 @@ export const useLoadRecordIndexStates = () => { const store = useStore(); const contextStoreTargetedRecordsRuleAtom = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( contextStoreTargetedRecordsRuleComponentState, ); const recordIndexGroupFieldMetadataItemAtom = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordIndexGroupFieldMetadataItemComponentState, ); const recordIndexGroupAggregateOperationAtom = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordIndexGroupAggregateOperationComponentState, ); const recordIndexGroupAggregateFieldMetadataItemAtom = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordIndexGroupAggregateFieldMetadataItemComponentState, ); const recordIndexShouldHideEmptyRecordGroupsAtom = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordIndexShouldHideEmptyRecordGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts index 4a27330467..9da955b8d3 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useOpenRecordFromIndexView.ts @@ -8,7 +8,7 @@ import { useRecordIndexContextOrThrow } from '@/object-record/record-index/conte import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { canOpenObjectInSidePanel } from '@/object-record/utils/canOpenObjectInSidePanel'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -26,17 +26,17 @@ export const useOpenRecordFromIndexView = () => { const isMobile = useIsMobile(); - const currentRecordFilters = useRecoilComponentStateCallbackStateV2( + const currentRecordFilters = useAtomComponentStateCallbackState( currentRecordFiltersComponentState, recordIndexId, ); - const currentRecordSorts = useRecoilComponentStateCallbackStateV2( + const currentRecordSorts = useAtomComponentStateCallbackState( currentRecordSortsComponentState, recordIndexId, ); - const currentRecordFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentRecordFilterGroups = useAtomComponentStateCallbackState( currentRecordFilterGroupsComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexFieldMetadataDerivedStates.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexFieldMetadataDerivedStates.ts index 1be44b27a8..0c953cbc54 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexFieldMetadataDerivedStates.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexFieldMetadataDerivedStates.ts @@ -2,8 +2,8 @@ import { labelIdentifierFieldMetadataItemSelector } from '@/object-metadata/stat import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { formatFieldMetadataItemAsColumnDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsColumnDefinition'; import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const useRecordIndexFieldMetadataDerivedStates = ( @@ -19,7 +19,7 @@ export const useRecordIndexFieldMetadataDerivedStates = ( ]), ); - const currentRecordFields = useRecoilComponentValueV2( + const currentRecordFields = useAtomComponentStateValue( currentRecordFieldsComponentState, recordIndexId, ); @@ -48,7 +48,7 @@ export const useRecordIndexFieldMetadataDerivedStates = ( ) : {}; - const labelIdentifierFieldMetadataItem = useFamilySelectorValueV2( + const labelIdentifierFieldMetadataItem = useAtomFamilySelectorValue( labelIdentifierFieldMetadataItemSelector, { objectMetadataItemId: objectMetadataItem?.id ?? '', diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupCommonQueryVariables.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupCommonQueryVariables.ts index 4c01985271..11cab8d143 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupCommonQueryVariables.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupCommonQueryVariables.ts @@ -10,8 +10,8 @@ import { computeRecordGroupOptionsFilter } from '@/object-record/record-group/ut import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { combineFilters, computeRecordGqlOperationFilter, @@ -22,15 +22,15 @@ export const useRecordIndexGroupCommonQueryVariables = () => { const { objectMetadataItem } = useRecordIndexContextOrThrow(); const { objectMetadataItems } = useObjectMetadataItems(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); @@ -43,7 +43,7 @@ export const useRecordIndexGroupCommonQueryVariables = () => { fields: objectMetadataItem.fields, }); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, ); @@ -59,7 +59,7 @@ export const useRecordIndexGroupCommonQueryVariables = () => { objectMetadataItems, ); - const recordGroupFieldMetadata = useRecoilComponentValueV2( + const recordGroupFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); @@ -68,7 +68,7 @@ export const useRecordIndexGroupCommonQueryVariables = () => { additionalFieldMetadataId: recordGroupFieldMetadata?.id, }); - const recordGroupDefinitions = useRecoilComponentSelectorValueV2( + const recordGroupDefinitions = useAtomComponentSelectorValue( recordGroupDefinitionsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupsAggregatesGroupBy.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupsAggregatesGroupBy.ts index d19336bbfc..44e4755578 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupsAggregatesGroupBy.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexGroupsAggregatesGroupBy.ts @@ -11,7 +11,7 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte import { useAggregateGqlFieldsFromRecordIndexGroupAggregates } from '@/object-record/record-index/hooks/useAggregateGqlFieldsFromRecordIndexGroupAggregates'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; import { buildGroupByFieldObject } from '@/page-layout/widgets/graph/utils/buildGroupByFieldObject'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useQuery } from '@apollo/client'; import { type Nullable } from 'twenty-shared/types'; import { @@ -35,11 +35,11 @@ export const useRecordIndexGroupsAggregatesGroupBy = ({ }) => { const apolloCoreClient = useApolloCoreClient(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); @@ -67,7 +67,7 @@ export const useRecordIndexGroupsAggregatesGroupBy = ({ }) : EMPTY_QUERY; - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore.ts index 92775e9186..b92ff7c83d 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useRecordIndexIdFromCurrentContextStore.ts @@ -1,10 +1,10 @@ import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useRecordIndexIdFromCurrentContextStore = () => { - const contextStoreCurrentViewId = useRecoilComponentValueV2( + const contextStoreCurrentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayLabel.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayLabel.ts index 1d9ebc0aec..dc562d582d 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayLabel.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayLabel.ts @@ -2,14 +2,13 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataIte import { recordIndexAggregateDisplayLabelComponentState } from '@/object-record/record-index/states/recordIndexAggregateDisplayLabelComponentState'; import { getRecordAggregateDisplayLabel } from '@/object-record/record-index/utils/getRecordndexAggregateDisplayLabel'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; export const useSetRecordIndexAggregateDisplayLabel = () => { - const recordIndexAggregateDisplayLabel = - useRecoilComponentStateCallbackStateV2( - recordIndexAggregateDisplayLabelComponentState, - ); + const recordIndexAggregateDisplayLabel = useAtomComponentStateCallbackState( + recordIndexAggregateDisplayLabelComponentState, + ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayValueForRecordGroupValue.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayValueForRecordGroupValue.ts index a548a22bda..5babadc8d6 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayValueForRecordGroupValue.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useSetRecordIndexAggregateDisplayValueForRecordGroupValue.ts @@ -2,8 +2,8 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataIte import { transformAggregateRawValueIntoAggregateDisplayValue } from '@/object-record/record-aggregate/utils/transformAggregateRawValueIntoAggregateDisplayValue'; import { recordIndexAggregateDisplayValueForGroupValueComponentFamilyState } from '@/object-record/record-index/states/recordIndexAggregateDisplayValueForGroupValueComponentFamilyState'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { useStore } from 'jotai'; import { useCallback, useContext } from 'react'; @@ -12,10 +12,10 @@ import { dateLocaleState } from '~/localization/states/dateLocaleState'; export const useSetRecordIndexAggregateDisplayValueForRecordGroupValue = () => { const { dateFormat, timeFormat, timeZone } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); const recordIndexAggregateValueByGroupValueCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexAggregateDisplayValueForGroupValueComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayLabelComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayLabelComponentState.ts index b707a69c09..6d8c980782 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayLabelComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayLabelComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordIndexAggregateDisplayLabelComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexAggregateDisplayLabelForGroupValueComponentFamilyState', defaultValue: null, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayValueForGroupValueComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayValueForGroupValueComponentFamilyState.ts index 531d411f7f..d460160ed9 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayValueForGroupValueComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexAggregateDisplayValueForGroupValueComponentFamilyState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const recordIndexAggregateDisplayValueForGroupValueComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'recordIndexAggregateDisplayValueForGroupValueComponentFamilyState', defaultValue: null, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState.ts index 901cf9d3c3..e2cca98588 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarFieldMetadataIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const recordIndexCalendarFieldMetadataIdState = createStateV2< +export const recordIndexCalendarFieldMetadataIdState = createAtomState< string | null >({ key: 'recordIndexCalendarFieldMetadataIdState', diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarLayoutState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarLayoutState.ts index edb42c22e3..defc80d425 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarLayoutState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexCalendarLayoutState.ts @@ -1,9 +1,8 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { ViewCalendarLayout } from '~/generated-metadata/graphql'; -export const recordIndexCalendarLayoutState = createStateV2( - { +export const recordIndexCalendarLayoutState = + createAtomState({ key: 'recordIndexCalendarLayoutState', defaultValue: ViewCalendarLayout.MONTH, - }, -); + }); diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexEntityCountByGroupComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexEntityCountByGroupComponentFamilyState.ts index f3ff3e704d..16be113d02 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexEntityCountByGroupComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexEntityCountByGroupComponentFamilyState.ts @@ -1,12 +1,13 @@ import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexEntityCountByGroupComponentFamilyState = - createComponentFamilyStateV2( - { - key: 'recordIndexEntityCountByGroupComponentFamilyState', - defaultValue: undefined, - componentInstanceContext: ViewComponentInstanceContext, - }, - ); + createAtomComponentFamilyState< + number | undefined, + RecordGroupDefinition['id'] + >({ + key: 'recordIndexEntityCountByGroupComponentFamilyState', + defaultValue: undefined, + componentInstanceContext: ViewComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.ts index e2c7784f66..8a91603335 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexFieldDefinitionsState.ts @@ -1,8 +1,8 @@ import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { type ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const recordIndexFieldDefinitionsState = createStateV2< +export const recordIndexFieldDefinitionsState = createAtomState< ColumnDefinition[] >({ key: 'recordIndexFieldDefinitionsState', diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateFieldMetadataItemComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateFieldMetadataItemComponentState.ts index 44a5ab7a11..c47a3fe0b8 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateFieldMetadataItemComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateFieldMetadataItemComponentState.ts @@ -1,9 +1,9 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordIndexGroupAggregateFieldMetadataItemComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexGroupAggregateFieldMetadataItemComponentState', defaultValue: null, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateOperationComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateOperationComponentState.ts index 3d13b268d3..2b92fb0ddb 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateOperationComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupAggregateOperationComponentState.ts @@ -1,9 +1,9 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordIndexGroupAggregateOperationComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexGroupAggregateOperationComponentState', defaultValue: null, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState.ts index e1b584ff7e..67541cd8af 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexGroupFieldMetadataComponentState.ts @@ -1,9 +1,9 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexGroupFieldMetadataItemComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexGroupFieldMetadataItemComponentState', defaultValue: undefined, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexHasFetchedAllRecordsByGroupComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexHasFetchedAllRecordsByGroupComponentState.ts index 92833e534d..5756e03f9d 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexHasFetchedAllRecordsByGroupComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexHasFetchedAllRecordsByGroupComponentState.ts @@ -1,9 +1,9 @@ import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexHasFetchedAllRecordsByGroupComponentState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'recordIndexHasFetchedAllRecordsByGroupComponentState', componentInstanceContext: ViewComponentInstanceContext, defaultValue: false, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInState.ts index 054ed22633..9572637012 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInState.ts @@ -1,9 +1,8 @@ import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const recordIndexOpenRecordInState = createStateV2( - { +export const recordIndexOpenRecordInState = + createAtomState({ key: 'recordIndexOpenRecordInState', defaultValue: ViewOpenRecordInType.SIDE_PANEL, - }, -); + }); diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInStateV2.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInStateV2.ts index c266036786..e227b3abab 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInStateV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexOpenRecordInStateV2.ts @@ -1,8 +1,8 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; export const recordIndexOpenRecordInStateV2 = - createStateV2({ + createAtomState({ key: 'recordIndexOpenRecordInStateV2', defaultValue: ViewOpenRecordInType.SIDE_PANEL, }); diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupSortComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupSortComponentState.ts index 61fb1e4155..2b97fe0eeb 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupSortComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupSortComponentState.ts @@ -1,9 +1,9 @@ import { RecordGroupSort } from '@/object-record/record-group/types/RecordGroupSort'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexRecordGroupSortComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexRecordGroupSortComponentState', defaultValue: RecordGroupSort.Manual, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupsAreInInitialLoadingComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupsAreInInitialLoadingComponentState.ts index 0e465a159f..560f9ac567 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupsAreInInitialLoadingComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordGroupsAreInInitialLoadingComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordIndexRecordGroupsAreInInitialLoadingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexRecordGroupsAreInInitialLoadingComponentState', defaultValue: false, componentInstanceContext: ContextStoreComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState.ts index 3a826abbd9..c454c45e50 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState.ts @@ -1,9 +1,9 @@ import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexRecordIdsByGroupComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'recordIndexRecordIdsByGroupComponentFamilyState', defaultValue: [], componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState.ts index be0ef93ca3..78cb650759 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexShouldHideEmptyRecordGroupsComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexShouldHideEmptyRecordGroupsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordIndexShouldHideEmptyRecordGroupsComponentState', defaultValue: false, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.ts index cfb711c0fd..abb3a92815 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/recordIndexViewTypeState.ts @@ -1,7 +1,7 @@ import { type ViewType } from '@/views/types/ViewType'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const recordIndexViewTypeState = createStateV2({ +export const recordIndexViewTypeState = createAtomState({ key: 'recordIndexViewTypeState', defaultValue: undefined, }); diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsOfAllRecordGroupsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsOfAllRecordGroupsComponentSelector.ts index 3d71c74c0e..ea22007d45 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsOfAllRecordGroupsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsOfAllRecordGroupsComponentSelector.ts @@ -1,10 +1,10 @@ import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const allRecordIdsOfAllRecordGroupsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'allRecordIdsOfAllRecordGroupsComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsWithoutGroupsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsWithoutGroupsComponentSelector.ts index 44fd2af08a..c4daa11663 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsWithoutGroupsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/allRecordIdsWithoutGroupsComponentSelector.ts @@ -1,10 +1,10 @@ import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { NO_RECORD_GROUP_FAMILY_KEY } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const allRecordIdsWithoutGroupsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'allRecordIdsWithoutGroupsComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector.ts index b166d356c1..85cc1966f8 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector.ts @@ -1,13 +1,13 @@ import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const NO_RECORD_GROUP_FAMILY_KEY = 'record-group-default-id'; export const recordIndexAllRecordIdsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'recordIndexAllRecordIdsComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: @@ -28,7 +28,10 @@ export const recordIndexAllRecordIdsComponentSelector = (acc, recordGroupId) => { const rowIds = get( recordIndexRecordIdsByGroupComponentFamilyState, - { instanceId, familyKey: recordGroupId }, + { + instanceId, + familyKey: recordGroupId, + }, ); return [...acc, ...rowIds]; diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexHasRecordsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexHasRecordsComponentSelector.ts index 3e1c128939..c1888e80a2 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexHasRecordsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexHasRecordsComponentSelector.ts @@ -1,9 +1,9 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexHasRecordsComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'recordIndexHasRecordsComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexRecordGroupIsDraggableSortComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexRecordGroupIsDraggableSortComponentSelector.ts index 2d32060b31..a42ff57857 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexRecordGroupIsDraggableSortComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/selectors/recordIndexRecordGroupIsDraggableSortComponentSelector.ts @@ -1,10 +1,10 @@ import { RecordGroupSort } from '@/object-record/record-group/types/RecordGroupSort'; import { recordIndexRecordGroupSortComponentState } from '@/object-record/record-index/states/recordIndexRecordGroupSortComponentState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const recordIndexRecordGroupIsDraggableSortComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'recordIndexRecordGroupIsDraggableSortComponentSelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-index/states/shouldCompactRecordIndexLabelIdentifierComponentState.ts b/packages/twenty-front/src/modules/object-record/record-index/states/shouldCompactRecordIndexLabelIdentifierComponentState.ts index 10283833a8..3efec67fbe 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/states/shouldCompactRecordIndexLabelIdentifierComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/states/shouldCompactRecordIndexLabelIdentifierComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const shouldCompactRecordIndexLabelIdentifierComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'shouldCompactRecordIndexLabelIdentifierComponentState', componentInstanceContext: ContextStoreComponentInstanceContext, defaultValue: false, diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellEditMode.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellEditMode.tsx index ba7650ffac..483c59949d 100644 --- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellEditMode.tsx +++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellEditMode.tsx @@ -5,8 +5,8 @@ import { recordFieldInputLayoutDirectionLoadingComponentState } from '@/object-r import { RecordInlineCellContext } from '@/object-record/record-inline-cell/components/RecordInlineCellContext'; import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContainer'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { autoUpdate, @@ -42,12 +42,12 @@ export const RecordInlineCellEditMode = ({ RecordFieldComponentInstanceContext, ); - const setFieldInputLayoutDirection = useSetRecoilComponentStateV2( + const setFieldInputLayoutDirection = useSetAtomComponentState( recordFieldInputLayoutDirectionComponentState, recordFieldComponentInstanceId, ); - const setFieldInputLayoutDirectionLoading = useSetRecoilComponentStateV2( + const setFieldInputLayoutDirectionLoading = useSetAtomComponentState( recordFieldInputLayoutDirectionLoadingComponentState, recordFieldComponentInstanceId, ); @@ -63,7 +63,7 @@ export const RecordInlineCellEditMode = ({ }, }; - const isFieldInError = useRecoilComponentValueV2( + const isFieldInError = useAtomComponentStateValue( recordFieldInputIsFieldInErrorComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx index e8941df10d..a8ee634633 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-merge/components/MergeRecordsContainer.tsx @@ -5,7 +5,7 @@ import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDraw import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; import { useMergeRecordsSelectedRecords } from '@/object-record/record-merge/hooks/useMergeRecordsSelectedRecords'; @@ -52,7 +52,7 @@ export const MergeRecordsContainer = ({ const instanceId = useAvailableComponentInstanceIdOrThrow( CommandMenuPageComponentInstanceContext, ); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts index 311178c180..fd78f0c38b 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsActions.ts @@ -8,8 +8,8 @@ import { AppPath } from 'twenty-shared/types'; import { useNavigateApp } from '~/hooks/useNavigateApp'; import { isMergeInProgressState } from '@/object-record/record-merge/states/mergeInProgressState'; import { mergeSettingsState } from '@/object-record/record-merge/states/mergeSettingsState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; type UseMergeRecordsActionsProps = { objectNameSingular: string; @@ -18,7 +18,7 @@ type UseMergeRecordsActionsProps = { export const useMergeRecordsActions = ({ objectNameSingular, }: UseMergeRecordsActionsProps) => { - const mergeSettings = useRecoilValueV2(mergeSettingsState); + const mergeSettings = useAtomStateValue(mergeSettingsState); const { selectedRecords } = useMergeRecordsSelectedRecords(); @@ -26,7 +26,7 @@ export const useMergeRecordsActions = ({ objectNameSingular, }); - const setMergeInProgress = useSetRecoilStateV2(isMergeInProgressState); + const setMergeInProgress = useSetAtomState(isMergeInProgressState); const { t } = useLingui(); const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar(); diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts index ca92f4d350..7b6a24db61 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSelectedRecords.ts @@ -2,15 +2,15 @@ import { commandMenuNavigationMorphItemsByPageState } from '@/command-menu/state import { CommandMenuPageComponentInstanceContext } from '@/command-menu/states/contexts/CommandMenuPageComponentInstanceContext'; import { recordStoreRecordsSelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreRecordsSelectorV2'; import { useComponentInstanceStateContext } from '@/ui/utilities/state/component-state/hooks/useComponentInstanceStateContext'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useMergeRecordsSelectedRecords = () => { const mergeRecordsPageInstanceId = useComponentInstanceStateContext( CommandMenuPageComponentInstanceContext, )?.instanceId; - const commandMenuNavigationMorphItemsByPage = useRecoilValueV2( + const commandMenuNavigationMorphItemsByPage = useAtomStateValue( commandMenuNavigationMorphItemsByPageState, ); @@ -19,9 +19,11 @@ export const useMergeRecordsSelectedRecords = () => { .get(mergeRecordsPageInstanceId ?? '') ?.map((morphItem) => morphItem.recordId) ?? []; - const selectedRecords = useFamilySelectorValueV2( + const selectedRecords = useAtomFamilySelectorValue( recordStoreRecordsSelectorV2, - { recordIds: selectedRecordIds }, + { + recordIds: selectedRecordIds, + }, ); return { diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSettings.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSettings.ts index 2d72ea6af7..4b2c361fec 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSettings.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/useMergeRecordsSettings.ts @@ -1,10 +1,9 @@ import { type MergeManySettings } from '@/object-record/hooks/useMergeManyRecords'; import { mergeSettingsState } from '@/object-record/record-merge/states/mergeSettingsState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; export const useMergeRecordsSettings = () => { - const [mergeSettings, setMergeSettings] = - useRecoilStateV2(mergeSettingsState); + const [mergeSettings, setMergeSettings] = useAtomState(mergeSettingsState); const updateMergeSettings = (settings: MergeManySettings) => { setMergeSettings(settings); diff --git a/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.ts b/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.ts index 5c5c34b54b..48090e5470 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/hooks/usePerformMergePreview.ts @@ -6,7 +6,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { useEffect, useState } from 'react'; import { isMergeInProgressState } from '@/object-record/record-merge/states/mergeInProgressState'; import { mergeSettingsState } from '@/object-record/record-merge/states/mergeSettingsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; type UseMergePreviewProps = { objectNameSingular: string; @@ -20,8 +20,8 @@ export const usePerformMergePreview = ({ const [isGeneratingPreview, setIsGeneratingPreview] = useState(false); const [isInitialized, setIsInitialized] = useState(false); - const mergeSettings = useRecoilValueV2(mergeSettingsState); - const isMergeInProgress = useRecoilValueV2(isMergeInProgressState); + const mergeSettings = useAtomStateValue(mergeSettingsState); + const isMergeInProgress = useAtomStateValue(isMergeInProgressState); const { mergeManyRecords } = useMergeManyRecords({ objectNameSingular, diff --git a/packages/twenty-front/src/modules/object-record/record-merge/states/mergeInProgressState.ts b/packages/twenty-front/src/modules/object-record/record-merge/states/mergeInProgressState.ts index 8d42272466..1701fb5bb4 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/states/mergeInProgressState.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/states/mergeInProgressState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isMergeInProgressState = createStateV2({ +export const isMergeInProgressState = createAtomState({ key: 'isMergeInProgress', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/object-record/record-merge/states/mergeSettingsState.ts b/packages/twenty-front/src/modules/object-record/record-merge/states/mergeSettingsState.ts index 7d9d388e41..953214bd65 100644 --- a/packages/twenty-front/src/modules/object-record/record-merge/states/mergeSettingsState.ts +++ b/packages/twenty-front/src/modules/object-record/record-merge/states/mergeSettingsState.ts @@ -1,7 +1,7 @@ import { type MergeManySettings } from '@/object-record/hooks/useMergeManyRecords'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const mergeSettingsState = createStateV2({ +export const mergeSettingsState = createAtomState({ key: 'mergeSettingsState', defaultValue: { conflictPriorityIndex: 0, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/hooks/useRecordPickerGetSearchRecordAndObjectMetadataItemFromRecordId.ts b/packages/twenty-front/src/modules/object-record/record-picker/hooks/useRecordPickerGetSearchRecordAndObjectMetadataItemFromRecordId.ts index df4862c515..45c6098591 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/hooks/useRecordPickerGetSearchRecordAndObjectMetadataItemFromRecordId.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/hooks/useRecordPickerGetSearchRecordAndObjectMetadataItemFromRecordId.ts @@ -1,8 +1,8 @@ import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { searchRecordStoreFamilyState } from '@/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState'; import { multipleRecordPickerSinglePickableMorphItemComponentFamilySelector } from '@/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerSinglePickableMorphItemComponentFamilySelector'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; type UseRecordPickerGetRecordAndObjectMetadataItemFromRecordIdProps = { @@ -15,12 +15,12 @@ export const useRecordPickerGetSearchRecordAndObjectMetadataItemFromRecordId = }: UseRecordPickerGetRecordAndObjectMetadataItemFromRecordIdProps) => { const { objectMetadataItems } = useObjectMetadataItems(); - const pickableMorphItem = useRecoilComponentFamilySelectorValueV2( + const pickableMorphItem = useAtomComponentFamilySelectorValue( multipleRecordPickerSinglePickableMorphItemComponentFamilySelector, recordId, ); - const searchRecord = useFamilyRecoilValueV2( + const searchRecord = useAtomFamilyStateValue( searchRecordStoreFamilyState, recordId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx index 902893034e..1640eb5041 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPicker.tsx @@ -16,7 +16,7 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { Key } from 'ts-key-enum'; import { isDefined } from 'twenty-shared/utils'; import { t } from '@lingui/core/macro'; @@ -53,13 +53,13 @@ export const MultipleRecordPicker = ({ ); const multipleRecordPickerSearchFilterState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( multipleRecordPickerSearchFilterComponentState, componentInstanceId, ); const multipleRecordPickerPickableMorphItemsState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( multipleRecordPickerPickableMorphItemsComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerFetchMoreLoader.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerFetchMoreLoader.tsx index 8a27c6c752..efd9c8b100 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerFetchMoreLoader.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerFetchMoreLoader.tsx @@ -11,9 +11,9 @@ import { multipleRecordPickerShouldShowInitialLoadingComponentState } from '@/ob import { multipleRecordPickerShouldShowSkeletonComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowSkeletonComponentState'; import { multipleRecordPickerPaginationSelector } from '@/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPaginationSelector'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { useCallback } from 'react'; import { useInView } from 'react-intersection-observer'; @@ -38,35 +38,33 @@ export const MultipleRecordPickerFetchMoreLoader = () => { const [ multipleRecordPickerIsFetchingMore, setMultipleRecordPickerIsFetchingMore, - ] = useRecoilComponentStateV2( - multipleRecordPickerIsFetchingMoreComponentState, - ); + ] = useAtomComponentState(multipleRecordPickerIsFetchingMoreComponentState); const componentInstanceId = useAvailableComponentInstanceIdOrThrow( MultipleRecordPickerComponentInstanceContext, ); - const paginationState = useRecoilComponentSelectorValueV2( + const paginationState = useAtomComponentSelectorValue( multipleRecordPickerPaginationSelector, componentInstanceId, ); - const isLoading = useRecoilComponentValueV2( + const isLoading = useAtomComponentStateValue( multipleRecordPickerIsLoadingComponentState, componentInstanceId, ); - const searchFilter = useRecoilComponentValueV2( + const searchFilter = useAtomComponentStateValue( multipleRecordPickerSearchFilterComponentState, componentInstanceId, ); const multipleRecordPickerShouldShowInitialLoading = - useRecoilComponentValueV2( + useAtomComponentStateValue( multipleRecordPickerShouldShowInitialLoadingComponentState, ); - const multipleRecordPickerShouldShowSkeleton = useRecoilComponentValueV2( + const multipleRecordPickerShouldShowSkeleton = useAtomComponentStateValue( multipleRecordPickerShouldShowSkeletonComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerLoadingEffect.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerLoadingEffect.tsx index 68d89d37c0..74278b56de 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerLoadingEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerLoadingEffect.tsx @@ -1,24 +1,24 @@ import { multipleRecordPickerIsFetchingMoreComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsFetchingMoreComponentState'; import { multipleRecordPickerIsLoadingComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsLoadingComponentState'; import { multipleRecordPickerShouldShowSkeletonComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowSkeletonComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect, useState } from 'react'; import { useDebouncedCallback } from 'use-debounce'; export const MultipleRecordPickerLoadingEffect = () => { const [previousLoading, setPreviousLoading] = useState(false); - const loading = useRecoilComponentValueV2( + const loading = useAtomComponentStateValue( multipleRecordPickerIsLoadingComponentState, ); - const setMultipleRecordPickerShowSkeleton = useSetRecoilComponentStateV2( + const setMultipleRecordPickerShowSkeleton = useSetAtomComponentState( multipleRecordPickerShouldShowSkeletonComponentState, ); - const [multipleRecordPickerIsFetchingMore] = useRecoilComponentStateV2( + const [multipleRecordPickerIsFetchingMore] = useAtomComponentState( multipleRecordPickerIsFetchingMoreComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx index 24a46d3704..fd02609461 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItemContent.tsx @@ -10,9 +10,9 @@ import { type RecordPickerPickableMorphItem } from '@/object-record/record-picke import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { capitalize } from 'twenty-shared/utils'; import { Avatar } from 'twenty-ui/display'; import { MenuItemMultiSelectAvatar } from 'twenty-ui/navigation'; @@ -43,18 +43,17 @@ export const MultipleRecordPickerMenuItemContent = ({ const selectableListComponentInstanceId = getMultipleRecordPickerSelectableListId(componentInstanceId); - const isSelectedByKeyboard = useRecoilComponentFamilyValueV2( + const isSelectedByKeyboard = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, searchRecord.recordId, selectableListComponentInstanceId, ); - const isRecordSelectedWithObjectItem = - useRecoilComponentFamilySelectorValueV2( - multipleRecordPickerIsSelectedComponentFamilySelector, - searchRecord.recordId, - componentInstanceId, - ); + const isRecordSelectedWithObjectItem = useAtomComponentFamilySelectorValue( + multipleRecordPickerIsSelectedComponentFamilySelector, + searchRecord.recordId, + componentInstanceId, + ); const handleSelectChange = (isSelected: boolean) => { onChange({ @@ -69,7 +68,7 @@ export const MultipleRecordPickerMenuItemContent = ({ const displayText = searchRecord.label?.trim() || t`Untitled ${labelSingular}`; - const searchableObjectMetadataItems = useRecoilComponentValueV2( + const searchableObjectMetadataItems = useAtomComponentStateValue( multipleRecordPickerSearchableObjectMetadataItemsComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx index 7a35937b3a..97a0eb8328 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerMenuItems.tsx @@ -13,9 +13,9 @@ import { type RecordPickerPickableMorphItem } from '@/object-record/record-picke import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCallback } from 'react'; import { useStore } from 'jotai'; @@ -36,13 +36,13 @@ export const MultipleRecordPickerMenuItems = ({ const selectableListComponentInstanceId = getMultipleRecordPickerSelectableListId(componentInstanceId); - const pickableRecordIds = useRecoilComponentSelectorValueV2( + const pickableRecordIds = useAtomComponentSelectorValue( multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector, componentInstanceId, ); const multipleRecordPickerPickableMorphItems = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( multipleRecordPickerPickableMorphItemsComponentState, componentInstanceId, ); @@ -71,11 +71,11 @@ export const MultipleRecordPickerMenuItems = ({ ); const multipleRecordPickerShouldShowInitialLoading = - useRecoilComponentValueV2( + useAtomComponentStateValue( multipleRecordPickerShouldShowInitialLoadingComponentState, ); - const multipleRecordPickerShouldShowSkeleton = useRecoilComponentValueV2( + const multipleRecordPickerShouldShowSkeleton = useAtomComponentStateValue( multipleRecordPickerShouldShowSkeletonComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerSearchInput.tsx b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerSearchInput.tsx index bb33ce99f6..f2594501c2 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerSearchInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/components/MultipleRecordPickerSearchInput.tsx @@ -6,7 +6,7 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/re import { multipleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchFilterComponentState'; import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useDebouncedCallback } from 'use-debounce'; export const MultipleRecordPickerSearchInput = () => { @@ -15,7 +15,7 @@ export const MultipleRecordPickerSearchInput = () => { ); const [recordPickerSearchFilter, setRecordPickerSearchFilter] = - useRecoilComponentStateV2(multipleRecordPickerSearchFilterComponentState); + useAtomComponentState(multipleRecordPickerSearchFilterComponentState); const { performSearch } = useMultipleRecordPickerPerformSearch(); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsFetchingMoreComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsFetchingMoreComponentState.ts index e9b4c9e413..8723e0ddff 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsFetchingMoreComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsFetchingMoreComponentState.ts @@ -1,8 +1,8 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const multipleRecordPickerIsFetchingMoreComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerIsFetchingMoreComponentState', defaultValue: false, componentInstanceContext: MultipleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsLoadingComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsLoadingComponentState.ts index 8cbeb7b69b..0b23891277 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsLoadingComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerIsLoadingComponentState.ts @@ -1,8 +1,8 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const multipleRecordPickerIsLoadingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerIsLoadingComponentState', defaultValue: false, componentInstanceContext: MultipleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPaginationState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPaginationState.ts index 0d1f2c8e1b..b84afe9fcc 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPaginationState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPaginationState.ts @@ -1,5 +1,5 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export type MultipleRecordPickerPaginationState = { endCursor: string | null; @@ -7,7 +7,7 @@ export type MultipleRecordPickerPaginationState = { }; export const multipleRecordPickerPaginationState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerPaginationState', defaultValue: { endCursor: null, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState.ts index 72af95c093..fdf41ef8b7 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState.ts @@ -1,9 +1,9 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const multipleRecordPickerPickableMorphItemsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerPickableMorphItemsComponentState', defaultValue: [], componentInstanceContext: MultipleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchFilterComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchFilterComponentState.ts index df0ea42c8d..33a549c214 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchFilterComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchFilterComponentState.ts @@ -1,8 +1,8 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const multipleRecordPickerSearchFilterComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerSearchFilterComponentState', defaultValue: '', componentInstanceContext: MultipleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchableObjectMetadataItemsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchableObjectMetadataItemsComponentState.ts index 51c41c1ceb..74cc55d055 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchableObjectMetadataItemsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerSearchableObjectMetadataItemsComponentState.ts @@ -1,9 +1,9 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const multipleRecordPickerSearchableObjectMetadataItemsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerSearchableObjectMetadataItemsComponentState', defaultValue: [], componentInstanceContext: MultipleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowInitialLoadingComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowInitialLoadingComponentState.ts index beb7383d78..56e7da88a9 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowInitialLoadingComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowInitialLoadingComponentState.ts @@ -1,8 +1,8 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const multipleRecordPickerShouldShowInitialLoadingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerShouldShowInitialLoadingComponentState', defaultValue: false, componentInstanceContext: MultipleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowSkeletonComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowSkeletonComponentState.ts index f7a6c4a5c6..84ac1f9bdb 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowSkeletonComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerShouldShowSkeletonComponentState.ts @@ -1,8 +1,8 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const multipleRecordPickerShouldShowSkeletonComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'multipleRecordPickerShouldShowSkeletonComponentState', defaultValue: false, componentInstanceContext: MultipleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState.ts index 2c92cb8a44..08eb852923 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/searchRecordStoreComponentFamilyState.ts @@ -1,8 +1,8 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { type SearchRecord } from '~/generated/graphql'; -export const searchRecordStoreFamilyState = createFamilyStateV2< +export const searchRecordStoreFamilyState = createAtomFamilyState< (SearchRecord & { record?: ObjectRecord }) | undefined, string >({ diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerIsSelectedComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerIsSelectedComponentFamilySelector.ts index b68a2fd6a7..a2b401b194 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerIsSelectedComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerIsSelectedComponentFamilySelector.ts @@ -1,9 +1,9 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; import { multipleRecordPickerPickableMorphItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; export const multipleRecordPickerIsSelectedComponentFamilySelector = - createComponentFamilySelectorV2({ + createAtomComponentFamilySelector({ key: 'visibleRecordGroupIdsComponentFamilySelector', componentInstanceContext: MultipleRecordPickerComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPaginationSelector.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPaginationSelector.ts index 6748b76506..807bdbb2c3 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPaginationSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPaginationSelector.ts @@ -1,9 +1,9 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; import { multipleRecordPickerPaginationState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPaginationState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; -export const multipleRecordPickerPaginationSelector = createComponentSelectorV2( - { +export const multipleRecordPickerPaginationSelector = + createAtomComponentSelector({ key: 'multipleRecordPickerPaginationSelector', componentInstanceContext: MultipleRecordPickerComponentInstanceContext, get: @@ -11,5 +11,4 @@ export const multipleRecordPickerPaginationSelector = createComponentSelectorV2( ({ get }) => { return get(multipleRecordPickerPaginationState, componentStateKey); }, - }, -); + }); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableMorphItemsLengthComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableMorphItemsLengthComponentSelector.ts index 2018a9d448..ae688eab19 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableMorphItemsLengthComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableMorphItemsLengthComponentSelector.ts @@ -1,9 +1,9 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; import { multipleRecordPickerPickableMorphItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const multipleRecordPickerPickableMorphItemsLengthComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'multipleRecordPickerPickableMorphItemsLengthComponentSelector', componentInstanceContext: MultipleRecordPickerComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector.ts index a63a0dd7cb..62eed0f889 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector.ts @@ -1,9 +1,9 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; import { multipleRecordPickerPickableMorphItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'multipleRecordPickerPickableRecordIdsMatchingSearchComponentSelector', componentInstanceContext: MultipleRecordPickerComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerSinglePickableMorphItemComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerSinglePickableMorphItemComponentFamilySelector.ts index d7f6f0a7e8..b0c5b414de 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerSinglePickableMorphItemComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/multiple-record-picker/states/selectors/multipleRecordPickerSinglePickableMorphItemComponentFamilySelector.ts @@ -1,10 +1,10 @@ import { MultipleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/multiple-record-picker/states/contexts/MultipleRecordPickerComponentInstanceContext'; import { multipleRecordPickerPickableMorphItemsComponentState } from '@/object-record/record-picker/multiple-record-picker/states/multipleRecordPickerPickableMorphItemsComponentState'; import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; export const multipleRecordPickerSinglePickableMorphItemComponentFamilySelector = - createComponentFamilySelectorV2< + createAtomComponentFamilySelector< RecordPickerPickableMorphItem | undefined, string >({ diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsx index 67113c1bdc..fec6c91b22 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPicker.tsx @@ -9,7 +9,7 @@ import { singleRecordPickerSearchFilterComponentState } from '@/object-record/re import { type RecordPickerPickableMorphItem } from '@/object-record/record-picker/types/RecordPickerPickableMorphItem'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export const SINGLE_RECORD_PICKER_LISTENER_ID = 'single-record-select'; @@ -33,7 +33,7 @@ export const SingleRecordPicker = ({ }: SingleRecordPickerProps) => { const containerRef = useRef(null); - const setRecordPickerSearchFilter = useSetRecoilComponentStateV2( + const setRecordPickerSearchFilter = useSetAtomComponentState( singleRecordPickerSearchFilterComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerLoadingEffect.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerLoadingEffect.tsx index 5cba9b86c7..4ee0f128ac 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerLoadingEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerLoadingEffect.tsx @@ -1,5 +1,5 @@ import { singleRecordPickerShouldShowSkeletonComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowSkeletonComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect, useState } from 'react'; import { useDebouncedCallback } from 'use-debounce'; @@ -10,7 +10,7 @@ export const SingleRecordPickerLoadingEffect = ({ }) => { const [previousLoading, setPreviousLoading] = useState(false); - const setSingleRecordPickerShouldShowSkeleton = useSetRecoilComponentStateV2( + const setSingleRecordPickerShouldShowSkeleton = useSetAtomComponentState( singleRecordPickerShouldShowSkeletonComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx index ed51c9cd65..5c90cbb3fd 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItem.tsx @@ -9,9 +9,9 @@ import { type RecordPickerPickableMorphItem } from '@/object-record/record-picke import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { Avatar } from 'twenty-ui/display'; import { MenuItemSelectAvatar } from 'twenty-ui/navigation'; @@ -39,18 +39,18 @@ export const SingleRecordPickerMenuItem = ({ const selectableListComponentInstanceId = getSingleRecordPickerSelectableListId(recordPickerComponentInstanceId); - const isSelectedByKeyboard = useRecoilComponentFamilyValueV2( + const isSelectedByKeyboard = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, morphItem.recordId, selectableListComponentInstanceId, ); - const searchRecord = useFamilyRecoilValueV2( + const searchRecord = useAtomFamilyStateValue( searchRecordStoreFamilyState, morphItem.recordId, ); - const searchableObjectMetadataItems = useRecoilComponentValueV2( + const searchableObjectMetadataItems = useAtomComponentStateValue( singleRecordPickerSearchableObjectMetadataItemsComponentState, recordPickerComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx index 15d24a56ce..e7426bb52a 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItems.tsx @@ -18,9 +18,9 @@ import { SelectableListItem } from '@/ui/layout/selectable-list/components/Selec import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { type IconComponent } from 'twenty-ui/display'; import { MenuItemSelect } from 'twenty-ui/navigation'; @@ -53,7 +53,7 @@ export const SingleRecordPickerMenuItems = ({ selectableListComponentInstanceId, ); - const isSelectedSelectNoneButton = useRecoilComponentFamilyValueV2( + const isSelectedSelectNoneButton = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, selectableListComponentInstanceId, 'select-none', @@ -72,15 +72,15 @@ export const SingleRecordPickerMenuItems = ({ const selectableItemIds = pickableMorphItems.map( (morphItem) => morphItem.recordId, ); - const [selectedRecordId, setSelectedRecordId] = useRecoilComponentStateV2( + const [selectedRecordId, setSelectedRecordId] = useAtomComponentState( singleRecordPickerSelectedIdComponentState, ); - const singleRecordPickerShouldShowSkeleton = useRecoilComponentValueV2( + const singleRecordPickerShouldShowSkeleton = useAtomComponentStateValue( singleRecordPickerShouldShowSkeletonComponentState, ); - const singleRecordPickerShouldShowInitialLoading = useRecoilComponentValueV2( + const singleRecordPickerShouldShowInitialLoading = useAtomComponentStateValue( singleRecordPickerShouldShowInitialLoadingComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsx index 67bd208368..ec626f7d30 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/components/SingleRecordPickerMenuItemsWithSearch.tsx @@ -15,7 +15,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/DropdownMenuSearchInput'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; import { t } from '@lingui/core/macro'; import { IconPlus } from 'twenty-ui/display'; @@ -49,7 +49,7 @@ export const SingleRecordPickerMenuItemsWithSearch = ({ SingleRecordPickerComponentInstanceContext, ); - const recordPickerSearchFilter = useRecoilComponentValueV2( + const recordPickerSearchFilter = useAtomComponentStateValue( singleRecordPickerSearchFilterComponentState, recordPickerInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/__tests__/useSingleRecordPickerRecords.test.tsx b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/__tests__/useSingleRecordPickerRecords.test.tsx index 1b89de7e80..6d4570ce8d 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/__tests__/useSingleRecordPickerRecords.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/__tests__/useSingleRecordPickerRecords.test.tsx @@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil'; import { useSingleRecordPickerSearch } from '@/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerSearch'; import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext'; import { singleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; const instanceId = 'instanceId'; const Wrapper = ({ children }: { children: React.ReactNode }) => ( @@ -19,7 +19,7 @@ describe('useSingleRecordPickerRecords', () => { const { result } = renderHook( () => { const recordSelectSearchHook = useSingleRecordPickerSearch(instanceId); - const internallyStoredFilter = useRecoilComponentValueV2( + const internallyStoredFilter = useAtomComponentStateValue( singleRecordPickerSearchFilterComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.ts index ad74014f1d..c5df06e6e4 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerRecords.ts @@ -1,7 +1,7 @@ import { useSingleRecordPickerPerformSearch } from '@/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerPerformSearch'; import { singleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState'; import { singleRecordPickerSelectedIdComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useSingleRecordPickerRecords = ({ objectNameSingulars, @@ -10,11 +10,11 @@ export const useSingleRecordPickerRecords = ({ objectNameSingulars: string[]; excludedRecordIds?: string[]; }) => { - const recordPickerSearchFilter = useRecoilComponentValueV2( + const recordPickerSearchFilter = useAtomComponentStateValue( singleRecordPickerSearchFilterComponentState, ); - const selectedRecordId = useRecoilComponentValueV2( + const selectedRecordId = useAtomComponentStateValue( singleRecordPickerSelectedIdComponentState, ); const { pickableMorphItems, loading } = useSingleRecordPickerPerformSearch({ diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerSearch.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerSearch.ts index 2050499af1..90aed183db 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerSearch.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/hooks/useSingleRecordPickerSearch.ts @@ -2,7 +2,7 @@ import { SingleRecordPickerComponentInstanceContext } from '@/object-record/reco import { singleRecordPickerSearchFilterComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState'; import { singleRecordPickerSelectedIdComponentState } from '@/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useDebouncedCallback } from 'use-debounce'; export const useSingleRecordPickerSearch = ( @@ -14,12 +14,12 @@ export const useSingleRecordPickerSearch = ( recordPickerComponentInstanceIdFromProps, ); - const setRecordPickerSearchFilter = useSetRecoilComponentStateV2( + const setRecordPickerSearchFilter = useSetAtomComponentState( singleRecordPickerSearchFilterComponentState, recordPickerComponentInstanceId, ); - const setRecordPickerSelectedId = useSetRecoilComponentStateV2( + const setRecordPickerSelectedId = useSetAtomComponentState( singleRecordPickerSelectedIdComponentState, recordPickerComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState.ts index f1defa00d9..266a4a44f7 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchFilterComponentState.ts @@ -1,8 +1,8 @@ import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const singleRecordPickerSearchFilterComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'singleRecordPickerSearchFilterComponentState', defaultValue: '', componentInstanceContext: SingleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchQueryComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchQueryComponentState.ts index fa162a3941..a8b2bd1c12 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchQueryComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchQueryComponentState.ts @@ -1,9 +1,9 @@ import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext'; import { type RecordPickerSearchQuery } from '@/object-record/record-picker/single-record-picker/types/SingleRecordPickerSearchQuery'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const singleRecordPickerSearchQueryComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'singleRecordPickerSearchQueryComponentState', defaultValue: null, componentInstanceContext: SingleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchableObjectMetadataItemsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchableObjectMetadataItemsComponentState.ts index 2792cbb5c5..9e2260d6d2 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchableObjectMetadataItemsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSearchableObjectMetadataItemsComponentState.ts @@ -1,9 +1,9 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const singleRecordPickerSearchableObjectMetadataItemsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'singleRecordPickerSearchableObjectMetadataItemsComponentState', defaultValue: [], componentInstanceContext: SingleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState.ts index 368a1102af..159a103fe7 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerSelectedIdComponentState.ts @@ -1,8 +1,8 @@ import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const singleRecordPickerSelectedIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'singleRecordPickerSelectedIdComponentState', defaultValue: undefined, componentInstanceContext: SingleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowInitialLoadingComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowInitialLoadingComponentState.ts index 4fbf545d48..5539fa5433 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowInitialLoadingComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowInitialLoadingComponentState.ts @@ -1,8 +1,8 @@ import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const singleRecordPickerShouldShowInitialLoadingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'singleRecordPickerShouldShowInitialLoadingComponentState', defaultValue: false, componentInstanceContext: SingleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowSkeletonComponentState.ts b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowSkeletonComponentState.ts index 6bcb0ba2a8..daa3fdb931 100644 --- a/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowSkeletonComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-picker/single-record-picker/states/singleRecordPickerShouldShowSkeletonComponentState.ts @@ -1,8 +1,8 @@ import { SingleRecordPickerComponentInstanceContext } from '@/object-record/record-picker/single-record-picker/states/contexts/SingleRecordPickerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const singleRecordPickerShouldShowSkeletonComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'singleRecordPickerShouldShowSkeletonComponentState', defaultValue: false, componentInstanceContext: SingleRecordPickerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts index fd7495692b..27d06ef60e 100644 --- a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts +++ b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const viewableRecordIdState = createStateV2({ +export const viewableRecordIdState = createAtomState({ key: 'activities/viewable-record-id', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts index 648b666faf..8d1d844c2a 100644 --- a/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts +++ b/packages/twenty-front/src/modules/object-record/record-right-drawer/states/viewableRecordNameSingularState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; // TODO: deprecate this state once we remove IS_COMMAND_MENU_V2_ENABLED flag -export const viewableRecordNameSingularState = createStateV2({ +export const viewableRecordNameSingularState = createAtomState({ key: 'activities/viewable-record-name-singular', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx index 3f14b3fa27..a746189d98 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-show/components/PageLayoutRecordPageRenderer.tsx @@ -11,7 +11,7 @@ import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingCon import { type TargetRecordIdentifier } from '@/ui/layout/contexts/TargetRecordIdentifier'; import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter'; import styled from '@emotion/styled'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; import { PageLayoutType } from '~/generated-metadata/graphql'; @@ -43,7 +43,7 @@ export const PageLayoutRecordPageRenderer = ({ targetRecordIdentifier: TargetRecordIdentifier; isInRightDrawer: boolean; }) => { - const recordDeletedAt = useFamilySelectorValueV2( + const recordDeletedAt = useAtomFamilySelectorValue( recordStoreFamilySelectorV2, { recordId: targetRecordIdentifier.id, diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowContainerContextStoreTargetedRecordsEffect.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowContainerContextStoreTargetedRecordsEffect.tsx index d160a7186b..fabe4c175b 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowContainerContextStoreTargetedRecordsEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-show/components/RecordShowContainerContextStoreTargetedRecordsEffect.tsx @@ -1,6 +1,6 @@ import { contextStoreNumberOfSelectedRecordsComponentState } from '@/context-store/states/contextStoreNumberOfSelectedRecordsComponentState'; import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/states/contextStoreTargetedRecordsRuleComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect } from 'react'; export const RecordShowContainerContextStoreTargetedRecordsEffect = ({ @@ -8,11 +8,11 @@ export const RecordShowContainerContextStoreTargetedRecordsEffect = ({ }: { recordId: string; }) => { - const setContextStoreTargetedRecordsRule = useSetRecoilComponentStateV2( + const setContextStoreTargetedRecordsRule = useSetAtomComponentState( contextStoreTargetedRecordsRuleComponentState, ); - const setContextStoreNumberOfSelectedRecords = useSetRecoilComponentStateV2( + const setContextStoreNumberOfSelectedRecords = useSetAtomComponentState( contextStoreNumberOfSelectedRecordsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx b/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx index 9ee0b7443c..3c2a61ff6a 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx +++ b/packages/twenty-front/src/modules/object-record/record-show/components/SummaryCard.tsx @@ -14,8 +14,8 @@ import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/ import { ShowPageSummaryCard } from '@/ui/layout/show-page/components/ShowPageSummaryCard'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { FieldMetadataType, @@ -38,11 +38,14 @@ export const SummaryCard = ({ objectRecordId, }); - const recordCreatedAt = useFamilySelectorValueV2( + const recordCreatedAt = useAtomFamilySelectorValue( recordStoreFamilySelectorV2, - { recordId: objectRecordId, fieldName: 'createdAt' }, + { + recordId: objectRecordId, + fieldName: 'createdAt', + }, ) as string | null; - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); const isFilesFieldMigrated = useIsFeatureEnabled( @@ -57,7 +60,7 @@ export const SummaryCard = ({ const isMobile = useIsMobile() || isInRightDrawer; - const recordIdentifier = useFamilySelectorValueV2( + const recordIdentifier = useAtomFamilySelectorValue( recordStoreIdentifierFamilySelectorV2, { recordId: objectRecordId, diff --git a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerData.ts b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerData.ts index 1b51f553b9..c3fb23dc50 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerData.ts +++ b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerData.ts @@ -1,6 +1,6 @@ import { recordLoadingFamilyState } from '@/object-record/record-store/states/recordLoadingFamilyState'; import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; type UseRecordShowContainerDataProps = { objectRecordId: string; @@ -9,7 +9,7 @@ type UseRecordShowContainerDataProps = { export const useRecordShowContainerData = ({ objectRecordId, }: UseRecordShowContainerDataProps) => { - const recordLoading = useFamilyRecoilValueV2( + const recordLoading = useAtomFamilyStateValue( recordLoadingFamilyState, objectRecordId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts index b3167724ea..d20436f744 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts +++ b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts @@ -6,7 +6,7 @@ import { useParams, useSearchParams } from 'react-router-dom'; import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; import { lastShowPageRecordIdState } from '@/object-record/record-field/ui/states/lastShowPageRecordId'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useRecordIdsFromFindManyCacheRootQuery } from '@/object-record/record-show/hooks/useRecordIdsFromFindManyCacheRootQuery'; import { useQueryVariablesFromParentView } from '@/views/hooks/useQueryVariablesFromParentView'; import { AppPath } from 'twenty-shared/types'; @@ -27,9 +27,7 @@ export const useRecordShowPagePagination = ( const [searchParams] = useSearchParams(); const viewIdQueryParam = searchParams.get('viewId'); - const setLastShowPageRecordId = useSetRecoilStateV2( - lastShowPageRecordIdState, - ); + const setLastShowPageRecordId = useSetAtomState(lastShowPageRecordIdState); const objectNameSingular = propsObjectNameSingular || paramObjectNameSingular; const objectRecordId = propsObjectRecordId || paramObjectRecordId; diff --git a/packages/twenty-front/src/modules/object-record/record-sort/hooks/useRemoveRecordSort.ts b/packages/twenty-front/src/modules/object-record/record-sort/hooks/useRemoveRecordSort.ts index 21176c524a..5c64c94db3 100644 --- a/packages/twenty-front/src/modules/object-record/record-sort/hooks/useRemoveRecordSort.ts +++ b/packages/twenty-front/src/modules/object-record/record-sort/hooks/useRemoveRecordSort.ts @@ -1,11 +1,11 @@ import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { type RecordSort } from '@/object-record/record-sort/types/RecordSort'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; export const useRemoveRecordSort = () => { - const currentRecordSorts = useRecoilComponentStateCallbackStateV2( + const currentRecordSorts = useAtomComponentStateCallbackState( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-sort/hooks/useUpsertRecordSort.ts b/packages/twenty-front/src/modules/object-record/record-sort/hooks/useUpsertRecordSort.ts index 31752067c6..8e5ef30131 100644 --- a/packages/twenty-front/src/modules/object-record/record-sort/hooks/useUpsertRecordSort.ts +++ b/packages/twenty-front/src/modules/object-record/record-sort/hooks/useUpsertRecordSort.ts @@ -1,11 +1,11 @@ import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { type RecordSort } from '@/object-record/record-sort/types/RecordSort'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; export const useUpsertRecordSort = () => { - const currentRecordSorts = useRecoilComponentStateCallbackStateV2( + const currentRecordSorts = useAtomComponentStateCallbackState( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-sort/states/currentRecordSortsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-sort/states/currentRecordSortsComponentState.ts index 9ef5cda9b8..0d44e27710 100644 --- a/packages/twenty-front/src/modules/object-record/record-sort/states/currentRecordSortsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-sort/states/currentRecordSortsComponentState.ts @@ -1,8 +1,8 @@ import { RecordSortsComponentInstanceContext } from '@/object-record/record-sort/states/context/RecordSortsComponentInstanceContext'; import { type RecordSort } from '@/object-record/record-sort/types/RecordSort'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const currentRecordSortsComponentState = createComponentStateV2< +export const currentRecordSortsComponentState = createAtomComponentState< RecordSort[] >({ key: 'currentRecordSortsComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-store/hooks/__tests__/useUpsertRecordsInStore.test.tsx b/packages/twenty-front/src/modules/object-record/record-store/hooks/__tests__/useUpsertRecordsInStore.test.tsx index 7ab5ec6c00..97acb66ea7 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/hooks/__tests__/useUpsertRecordsInStore.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-store/hooks/__tests__/useUpsertRecordsInStore.test.tsx @@ -4,7 +4,7 @@ import { type ReactNode } from 'react'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; const Wrapper = ({ children }: { children: ReactNode }) => ( @@ -17,7 +17,10 @@ describe('useUpsertRecordsInStore', () => { const { result } = renderHook( () => { - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const record = useAtomFamilyStateValue( + recordStoreFamilyState, + recordId, + ); const { upsertRecordsInStore } = useUpsertRecordsInStore(); return { record, upsertRecordsInStore }; @@ -53,7 +56,10 @@ describe('useUpsertRecordsInStore', () => { const { result } = renderHook( () => { - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const record = useAtomFamilyStateValue( + recordStoreFamilyState, + recordId, + ); const { upsertRecordsInStore } = useUpsertRecordsInStore(); return { record, upsertRecordsInStore }; @@ -111,7 +117,10 @@ describe('useUpsertRecordsInStore', () => { const { result } = renderHook( () => { - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const record = useAtomFamilyStateValue( + recordStoreFamilyState, + recordId, + ); const { upsertRecordsInStore } = useUpsertRecordsInStore(); return { record, upsertRecordsInStore }; diff --git a/packages/twenty-front/src/modules/object-record/record-store/hooks/useRecordFieldValue.tsx b/packages/twenty-front/src/modules/object-record/record-store/hooks/useRecordFieldValue.ts similarity index 100% rename from packages/twenty-front/src/modules/object-record/record-store/hooks/useRecordFieldValue.tsx rename to packages/twenty-front/src/modules/object-record/record-store/hooks/useRecordFieldValue.ts diff --git a/packages/twenty-front/src/modules/object-record/record-store/hooks/useRecordFieldValueV2.ts b/packages/twenty-front/src/modules/object-record/record-store/hooks/useRecordFieldValueV2.ts deleted file mode 100644 index a4ec67219a..0000000000 --- a/packages/twenty-front/src/modules/object-record/record-store/hooks/useRecordFieldValueV2.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { useAtomValue } from 'jotai'; - -import { type FieldDefinition } from '@/object-record/record-field/ui/types/FieldDefinition'; -import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { recordStoreFieldValueSelectorV2 } from '@/object-record/record-store/states/selectors/recordStoreFieldValueSelectorV2'; - -export const useRecordFieldValueV2 = ( - recordId: string, - fieldName: string, - fieldDefinition: Pick, 'type' | 'metadata'>, -) => { - const fieldValue = recordStoreFieldValueSelectorV2({ - recordId, - fieldName, - fieldDefinition: { - type: fieldDefinition.type, - metadata: fieldDefinition.metadata, - }, - }); - - return useAtomValue(fieldValue) as T | undefined; -}; diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/recordLoadingFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-store/states/recordLoadingFamilyState.ts index 48441be1f3..d8f4195295 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/recordLoadingFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/recordLoadingFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const recordLoadingFamilyState = createFamilyStateV2({ +export const recordLoadingFamilyState = createAtomFamilyState({ key: 'recordLoadingFamilyState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyState.ts index 82b6fb4062..194337026a 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyState.ts @@ -1,7 +1,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const recordStoreFamilyState = createFamilyStateV2< +export const recordStoreFamilyState = createAtomFamilyState< ObjectRecord | null | undefined, string >({ diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyStateV2.ts b/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyStateV2.ts index cfc4debafc..59719a23b7 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyStateV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/recordStoreFamilyStateV2.ts @@ -1,7 +1,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const recordStoreFamilyStateV2 = createFamilyStateV2< +export const recordStoreFamilyStateV2 = createAtomFamilyState< ObjectRecord | null | undefined, string >({ diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFamilySelectorV2.ts b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFamilySelectorV2.ts index 789cd9d7f7..ac980137cc 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFamilySelectorV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFamilySelectorV2.ts @@ -1,8 +1,8 @@ import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { createWritableFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createWritableFamilySelectorV2'; +import { createAtomWritableFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomWritableFamilySelector'; -export const recordStoreFamilySelectorV2 = createWritableFamilySelectorV2< +export const recordStoreFamilySelectorV2 = createAtomWritableFamilySelector< unknown, { recordId: string; fieldName: string } >({ diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFieldValueSelectorV2.ts b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFieldValueSelectorV2.ts index c846f8346e..b9f8455620 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFieldValueSelectorV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreFieldValueSelectorV2.ts @@ -4,11 +4,11 @@ import { type FieldDefinition } from '@/object-record/record-field/ui/types/Fiel import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { isFieldMorphRelation } from '@/object-record/record-field/ui/types/guards/isFieldMorphRelation'; import { recordStoreFamilyStateV2 } from '@/object-record/record-store/states/recordStoreFamilyStateV2'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { RelationType, type ObjectRecord } from 'twenty-shared/types'; import { computeMorphRelationFieldName, isDefined } from 'twenty-shared/utils'; -const simpleFieldValueSelector = createFamilySelectorV2< +const simpleFieldValueSelector = createAtomFamilySelector< unknown, { recordId: string; fieldName: string } >({ diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifierFamilySelectorV2.ts b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifierFamilySelectorV2.ts index b34e4366af..5487d17854 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifierFamilySelectorV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifierFamilySelectorV2.ts @@ -2,7 +2,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { getObjectRecordIdentifier } from '@/object-metadata/utils/getObjectRecordIdentifier'; import { type ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { uncapitalize } from 'twenty-shared/utils'; type RecordStoreIdentifierFamilyKey = { @@ -11,7 +11,7 @@ type RecordStoreIdentifierFamilyKey = { isFilesFieldMigrated?: boolean; }; -export const recordStoreIdentifierFamilySelectorV2 = createFamilySelectorV2< +export const recordStoreIdentifierFamilySelectorV2 = createAtomFamilySelector< ObjectRecordIdentifier | null, RecordStoreIdentifierFamilyKey >({ diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifiersSelector.ts b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifiersSelector.ts index fd50ab1c3f..1b0532b764 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifiersSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreIdentifiersSelector.ts @@ -2,10 +2,10 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { getObjectRecordIdentifier } from '@/object-metadata/utils/getObjectRecordIdentifier'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { type ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { isDefined, uncapitalize } from 'twenty-shared/utils'; -export const recordStoreIdentifiersFamilySelector = createFamilySelectorV2< +export const recordStoreIdentifiersFamilySelector = createAtomFamilySelector< ObjectRecordIdentifier[], { recordIds: string[]; diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2.ts b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2.ts index e1c0aff684..65c4e435d5 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2.ts @@ -1,7 +1,7 @@ import { type FieldMetadataItemRelation } from '@/object-metadata/types/FieldMetadataItemRelation'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { type RelationType } from 'twenty-shared/types'; import { computeMorphRelationFieldName } from 'twenty-shared/utils'; @@ -16,30 +16,32 @@ type MorphValueWithObjectName = { }; export const recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2 = - createFamilySelectorV2({ - key: 'recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2', - get: - ({ recordId, morphRelations }: MorphOneToManyFamilyKey) => - ({ get }) => { - const morphValuesWithObjectName = morphRelations.map( - (morphRelation) => { - const fieldName = computeMorphRelationFieldName({ - fieldName: morphRelation.sourceFieldMetadata.name, - relationType: morphRelation.type as RelationType, - targetObjectMetadataNameSingular: - morphRelation.targetObjectMetadata.nameSingular, - targetObjectMetadataNamePlural: - morphRelation.targetObjectMetadata.namePlural, - }); - return { - objectNameSingular: - morphRelation.targetObjectMetadata.nameSingular, - value: (get(recordStoreFamilyState, recordId)?.[fieldName] || - []) as ObjectRecord[] | ObjectRecord, - }; - }, - ); + createAtomFamilySelector( + { + key: 'recordStoreMorphOneToManyValueWithObjectNameFamilySelectorV2', + get: + ({ recordId, morphRelations }: MorphOneToManyFamilyKey) => + ({ get }) => { + const morphValuesWithObjectName = morphRelations.map( + (morphRelation) => { + const fieldName = computeMorphRelationFieldName({ + fieldName: morphRelation.sourceFieldMetadata.name, + relationType: morphRelation.type as RelationType, + targetObjectMetadataNameSingular: + morphRelation.targetObjectMetadata.nameSingular, + targetObjectMetadataNamePlural: + morphRelation.targetObjectMetadata.namePlural, + }); + return { + objectNameSingular: + morphRelation.targetObjectMetadata.nameSingular, + value: (get(recordStoreFamilyState, recordId)?.[fieldName] || + []) as ObjectRecord[] | ObjectRecord, + }; + }, + ); - return morphValuesWithObjectName; - }, - }); + return morphValuesWithObjectName; + }, + }, + ); diff --git a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreRecordsSelectorV2.ts b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreRecordsSelectorV2.ts index e1f7e54953..3dcdee7947 100644 --- a/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreRecordsSelectorV2.ts +++ b/packages/twenty-front/src/modules/object-record/record-store/states/selectors/recordStoreRecordsSelectorV2.ts @@ -1,13 +1,13 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { isDefined } from 'twenty-shared/utils'; type RecordStoreRecordsFamilyKey = { recordIds: string[]; }; -export const recordStoreRecordsSelectorV2 = createFamilySelectorV2< +export const recordStoreRecordsSelectorV2 = createAtomFamilySelector< ObjectRecord[], RecordStoreRecordsFamilyKey >({ diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTable.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTable.tsx index 56e6bc417f..fe31143d5a 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTable.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTable.tsx @@ -14,8 +14,8 @@ import { useRecordTableContextOrThrow } from '@/object-record/record-table/conte import { useResetTableRowSelection } from '@/object-record/record-table/hooks/internal/useResetTableRowSelection'; import { isRecordTableInitialLoadingComponentState } from '@/object-record/record-table/states/isRecordTableInitialLoadingComponentState'; import { useClickOutsideListener } from '@/ui/utilities/pointer-event/hooks/useClickOutsideListener'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import isEmpty from 'lodash.isempty'; export const RecordTable = () => { @@ -36,17 +36,17 @@ export const RecordTable = () => { RECORD_TABLE_CLICK_OUTSIDE_LISTENER_ID, ); - const isRecordTableInitialLoading = useRecoilComponentValueV2( + const isRecordTableInitialLoading = useAtomComponentStateValue( isRecordTableInitialLoadingComponentState, recordTableId, ); - const recordTableHasRecords = useRecoilComponentSelectorValueV2( + const recordTableHasRecords = useAtomComponentSelectorValue( recordIndexHasRecordsComponentSelector, recordTableId, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnWidthEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnWidthEffect.tsx index cad1d1c9f6..98e30682d0 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnWidthEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableColumnWidthEffect.tsx @@ -14,24 +14,24 @@ import { computeVisibleRecordFieldsWidthOnTable } from '@/object-record/record-t import { getRecordTableColumnFieldWidthCSSVariableName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthCSSVariableName'; import { updateRecordTableCSSVariable } from '@/object-record/record-table/utils/updateRecordTableCSSVariable'; import { RECORD_TABLE_VIRTUALIZATION_BODY_PLACEHOLDER_WIDTH_CSS_VARIABLE_NAME } from '@/object-record/record-table/virtualization/components/RecordTableVirtualizedBodyPlaceholder'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const RecordTableColumnWidthEffect = () => { - const [resizedFieldMetadataItemId] = useRecoilComponentStateV2( + const [resizedFieldMetadataItemId] = useAtomComponentState( resizedFieldMetadataIdComponentState, ); const { visibleRecordFields } = useRecordTableContextOrThrow(); - const shouldCompactRecordTableFirstColumn = useRecoilComponentValueV2( + const shouldCompactRecordTableFirstColumn = useAtomComponentStateValue( shouldCompactRecordTableFirstColumnComponentState, ); - const recordTableWidth = useRecoilComponentValueV2( + const recordTableWidth = useAtomComponentStateValue( recordTableWidthComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContent.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContent.tsx index bd18c6bb70..cd41665547 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContent.tsx @@ -12,9 +12,9 @@ import { recordTableHoverPositionComponentState } from '@/object-record/record-t import { isSomeCellInEditModeComponentSelector } from '@/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector'; import { DragSelect } from '@/ui/utilities/drag-select/components/DragSelect'; import { RECORD_INDEX_DRAG_SELECT_BOUNDARY_CLASS } from '@/ui/utilities/drag-select/constants/RecordIndecDragSelectBoundaryClass'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { useCallback, useRef, useState } from 'react'; import { useStore } from 'jotai'; @@ -55,7 +55,7 @@ export const RecordTableContent = ({ handleDragSelectionEnd(); }; - const isRowSelectedFamilyState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowSelectedFamilyState = useAtomComponentFamilyStateCallbackState( isRowSelectedComponentFamilyState, recordTableId, ); @@ -73,12 +73,12 @@ export const RecordTableContent = ({ const { visibleRecordFields } = useRecordTableContextOrThrow(); - const setRecordTableHoverPosition = useSetRecoilComponentStateV2( + const setRecordTableHoverPosition = useSetAtomComponentState( recordTableHoverPositionComponentState, recordTableId, ); - const isSomeCellInEditMode = useRecoilComponentSelectorCallbackStateV2( + const isSomeCellInEditMode = useAtomComponentSelectorCallbackState( isSomeCellInEditModeComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContextProvider.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContextProvider.tsx index c647f553bb..31e15b3063 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContextProvider.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableContextProvider.tsx @@ -9,8 +9,8 @@ import { visibleRecordFieldsComponentSelector } from '@/object-record/record-fie import { recordIndexOpenRecordInState } from '@/object-record/record-index/states/recordIndexOpenRecordInState'; import { RECORD_TABLE_CELL_INPUT_ID_PREFIX } from '@/object-record/record-table/constants/RecordTableCellInputIdPrefix'; import { RECORD_TABLE_COLUMN_MIN_WIDTH } from '@/object-record/record-table/constants/RecordTableColumnMinWidth'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; type RecordTableContextProviderProps = { @@ -36,12 +36,12 @@ export const RecordTableContextProvider = ({ objectMetadataItem.id, ); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, recordTableId, ); - const recordIndexOpenRecordIn = useRecoilValueV2( + const recordIndexOpenRecordIn = useAtomStateValue( recordIndexOpenRecordInState, ); const triggerEvent = diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableEmpty.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableEmpty.tsx index d0611c9033..8f1a8a943b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableEmpty.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableEmpty.tsx @@ -15,8 +15,8 @@ import { resizeFieldOffsetComponentState } from '@/object-record/record-table/st import { shouldCompactRecordTableFirstColumnComponentState } from '@/object-record/record-table/states/shouldCompactRecordTableFirstColumnComponentState'; import { computeVisibleRecordFieldsWidthOnTable } from '@/object-record/record-table/utils/computeVisibleRecordFieldsWidthOnTable'; import { RecordTableVirtualizedDataChangedEffect } from '@/object-record/record-table/virtualization/components/RecordTableVirtualizedDataChangedEffect'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -33,21 +33,21 @@ export interface RecordTableEmptyProps { export const RecordTableEmpty = ({ tableBodyRef }: RecordTableEmptyProps) => { const { visibleRecordFields } = useRecordTableContextOrThrow(); - const recordTableWidth = useRecoilComponentValueV2( + const recordTableWidth = useAtomComponentStateValue( recordTableWidthComponentState, ); - const resizedFieldMetadataId = useRecoilComponentValueV2( + const resizedFieldMetadataId = useAtomComponentStateValue( resizedFieldMetadataIdComponentState, ); - const resizeFieldOffset = useRecoilComponentValueV2( + const resizeFieldOffset = useAtomComponentStateValue( resizeFieldOffsetComponentState, ); const isResizing = isDefined(resizedFieldMetadataId); - const shouldCompactRecordTableFirstColumn = useRecoilComponentValueV2( + const shouldCompactRecordTableFirstColumn = useAtomComponentStateValue( shouldCompactRecordTableFirstColumnComponentState, ); @@ -77,7 +77,7 @@ export const RecordTableEmpty = ({ tableBodyRef }: RecordTableEmptyProps) => { emptyTableContainerComputedWidth, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupAddNew.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupAddNew.tsx index 1ac33619c1..d342dfe7b7 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupAddNew.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupAddNew.tsx @@ -6,8 +6,8 @@ import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useC import { RecordTableActionRow } from '@/object-record/record-table/record-table-row/components/RecordTableActionRow'; import { useLoadRecordsToVirtualRows } from '@/object-record/record-table/virtualization/hooks/useLoadRecordsToVirtualRows'; import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -26,11 +26,11 @@ export const RecordTableNoRecordGroupAddNew = () => { const hasObjectUpdatePermissions = objectPermissions.canUpdateObjectRecords; - const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2( + const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue( hasAnySoftDeleteFilterOnViewComponentSelector, ); - const totalNumberOfRecordsToVirtualize = useRecoilComponentValueV2( + const totalNumberOfRecordsToVirtualize = useAtomComponentStateValue( totalNumberOfRecordsToVirtualizeComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupBodyContextProvider.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupBodyContextProvider.tsx index b989635633..705ae80a83 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupBodyContextProvider.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupBodyContextProvider.tsx @@ -11,7 +11,7 @@ import { useTriggerActionMenuDropdown } from '@/object-record/record-table/recor import { hasUserSelectedAllRowsComponentState } from '@/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState'; import { type MoveFocusDirection } from '@/object-record/record-table/types/MoveFocusDirection'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type ReactNode } from 'react'; type RecordTableNoRecordGroupBodyContextProviderProps = { @@ -58,7 +58,7 @@ export const RecordTableNoRecordGroupBodyContextProvider = ({ triggerActionMenuDropdown(event, recordId); }; - const hasUserSelectedAllRows = useRecoilComponentValueV2( + const hasUserSelectedAllRows = useAtomComponentStateValue( hasUserSelectedAllRowsComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupRows.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupRows.tsx index d4a8e4cd76..a679ca1d2c 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupRows.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableNoRecordGroupRows.tsx @@ -4,13 +4,14 @@ import { RecordTableVirtualizedBodyPlaceholder } from '@/object-record/record-ta import { RecordTableVirtualizedDebugHelper } from '@/object-record/record-table/virtualization/components/RecordTableVirtualizedDebugHelper'; import { NUMBER_OF_VIRTUALIZED_ROWS } from '@/object-record/record-table/virtualization/constants/NumberOfVirtualizedRows'; import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { getContiguousIncrementalValues } from 'twenty-shared/utils'; export const RecordTableNoRecordGroupRows = () => { const totalNumberOfRecordsToVirtualize = - useRecoilComponentValueV2(totalNumberOfRecordsToVirtualizeComponentState) ?? - 0; + useAtomComponentStateValue( + totalNumberOfRecordsToVirtualizeComponentState, + ) ?? 0; const numberOfRows = Math.min( totalNumberOfRecordsToVirtualize, diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableRecordGroupRows.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableRecordGroupRows.tsx index 9da3ff0669..d0a2ef1586 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableRecordGroupRows.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableRecordGroupRows.tsx @@ -8,8 +8,8 @@ import { RecordTableRow } from '@/object-record/record-table/record-table-row/co import { RecordTableRecordGroupSectionAddNew } from '@/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionAddNew'; import { RecordTableRecordGroupSectionLoadMore } from '@/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionLoadMore'; import { isRecordGroupTableSectionToggledComponentState } from '@/object-record/record-table/record-table-section/states/isRecordGroupTableSectionToggledComponentState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { useMemo } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -18,16 +18,16 @@ export const RecordTableRecordGroupRows = () => { const shouldHide = useShouldHideRecordGroup(currentRecordGroupId); - const allRecordIds = useRecoilComponentSelectorValueV2( + const allRecordIds = useAtomComponentSelectorValue( recordIndexAllRecordIdsComponentSelector, ); - const recordIdsByGroup = useRecoilComponentFamilyValueV2( + const recordIdsByGroup = useAtomComponentFamilyStateValue( recordIndexRecordIdsByGroupComponentFamilyState, currentRecordGroupId, ); - const isRecordGroupTableSectionToggled = useRecoilComponentFamilyValueV2( + const isRecordGroupTableSectionToggled = useAtomComponentFamilyStateValue( isRecordGroupTableSectionToggledComponentState, currentRecordGroupId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollAndZIndexEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollAndZIndexEffect.tsx index d8f079bc00..c14edcd115 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollAndZIndexEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollAndZIndexEffect.tsx @@ -7,8 +7,8 @@ import { shouldCompactRecordTableFirstColumnComponentState } from '@/object-reco import { updateRecordTableCSSVariable } from '@/object-record/record-table/utils/updateRecordTableCSSVariable'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -20,21 +20,18 @@ export const RecordTableScrollAndZIndexEffect = () => { const [ isRecordTableScrolledHorizontally, setIsRecordTableScrolledHorizontally, - ] = useRecoilComponentStateV2( - isRecordTableScrolledHorizontallyComponentState, - ); + ] = useAtomComponentState(isRecordTableScrolledHorizontallyComponentState); - const setShouldCompactRecordTableFirstColumn = useSetRecoilComponentStateV2( + const setShouldCompactRecordTableFirstColumn = useSetAtomComponentState( shouldCompactRecordTableFirstColumnComponentState, ); - const setShouldCompactRecordIndexLabelIdentifier = - useSetRecoilComponentStateV2( - shouldCompactRecordIndexLabelIdentifierComponentState, - ); + const setShouldCompactRecordIndexLabelIdentifier = useSetAtomComponentState( + shouldCompactRecordIndexLabelIdentifierComponentState, + ); const [isRecordTableScrolledVertically, setIsRecordTableScrolledVertically] = - useRecoilComponentStateV2(isRecordTableScrolledVerticallyComponentState); + useAtomComponentState(isRecordTableScrolledVerticallyComponentState); useEffect(() => { if (!isDefined(scrollWrapperHTMLElement)) { diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedCellEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedCellEffect.tsx index 2d409a7142..b0d05bc937 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedCellEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedCellEffect.tsx @@ -2,19 +2,19 @@ import { RECORD_TABLE_ROW_HEIGHT } from '@/object-record/record-table/constants/ import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { isRecordTableCellFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableCellFocusActiveComponentState'; import { recordTableFocusPositionComponentState } from '@/object-record/record-table/states/recordTableFocusPositionComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const RecordTableScrollToFocusedCellEffect = () => { const { recordTableId } = useRecordTableContextOrThrow(); - const isRecordTableCellFocusActive = useRecoilComponentValueV2( + const isRecordTableCellFocusActive = useAtomComponentStateValue( isRecordTableCellFocusActiveComponentState, recordTableId, ); - const focusPosition = useRecoilComponentValueV2( + const focusPosition = useAtomComponentStateValue( recordTableFocusPositionComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedRowEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedRowEffect.tsx index 2fce856306..023117ceed 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedRowEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableScrollToFocusedRowEffect.tsx @@ -3,25 +3,25 @@ import { RECORD_TABLE_ROW_HEIGHT } from '@/object-record/record-table/constants/ import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { focusedRecordTableRowIndexComponentState } from '@/object-record/record-table/states/focusedRecordTableRowIndexComponentState'; import { isRecordTableRowFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableRowFocusActiveComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const RecordTableScrollToFocusedRowEffect = () => { const { recordTableId } = useRecordTableContextOrThrow(); - const focusedRowIndex = useRecoilComponentValueV2( + const focusedRowIndex = useAtomComponentStateValue( focusedRecordTableRowIndexComponentState, recordTableId, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, recordTableId, ); - const allRecordIds = useRecoilComponentSelectorValueV2( + const allRecordIds = useAtomComponentSelectorValue( recordIndexAllRecordIdsComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWidthEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWidthEffect.tsx index 486fd10953..be2df30da7 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWidthEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/RecordTableWidthEffect.tsx @@ -1,18 +1,18 @@ import { recordTableWidthComponentState } from '@/object-record/record-table/states/recordTableWidthComponentState'; import { tableWidthResizeIsActiveState } from '@/object-record/record-table/states/tableWidthResizeIsActivedState'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const RecordTableWidthEffect = () => { - const setRecordTableWidth = useSetRecoilComponentStateV2( + const setRecordTableWidth = useSetAtomComponentState( recordTableWidthComponentState, ); - const tableWidthResizeIsActive = useRecoilValueV2( + const tableWidthResizeIsActive = useAtomStateValue( tableWidthResizeIsActiveState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/components/__stories__/perf/RecordTableCell.perf.stories.tsx b/packages/twenty-front/src/modules/object-record/record-table/components/__stories__/perf/RecordTableCell.perf.stories.tsx index 51db5ba7cd..a5280f3eb5 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/components/__stories__/perf/RecordTableCell.perf.stories.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/components/__stories__/perf/RecordTableCell.perf.stories.tsx @@ -6,7 +6,7 @@ import { getBasePathToShowPage } from '@/object-metadata/utils/getBasePathToShow import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { RecordTableComponentInstance } from '@/object-record/record-table/components/RecordTableComponentInstance'; import { RecordTableCellContext } from '@/object-record/record-table/contexts/RecordTableCellContext'; import { ChipGeneratorsDecorator } from '~/testing/decorators/ChipGeneratorsDecorator'; @@ -14,8 +14,8 @@ import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorato import { getProfilingStory } from '~/testing/profiling/utils/getProfilingStory'; import { labelIdentifierFieldMetadataItemSelector } from '@/object-metadata/states/labelIdentifierFieldMetadataItemSelector'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { formatFieldMetadataItemAsColumnDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsColumnDefinition'; import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; @@ -29,30 +29,30 @@ import { RecordTableContextProvider } from '@/object-record/record-table/context import { RecordTableRowContextProvider } from '@/object-record/record-table/contexts/RecordTableRowContext'; import { RecordTableRowDraggableContextProvider } from '@/object-record/record-table/contexts/RecordTableRowDraggableContext'; import { RecordTableCellFieldContextWrapper } from '@/object-record/record-table/record-table-cell/components/RecordTableCellFieldContextWrapper'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { ComponentDecorator } from 'twenty-ui/testing'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; const RelationFieldValueSetterEffect = () => { - const setEntity = useSetFamilyRecoilStateV2( + const setEntity = useSetAtomFamilyState( recordStoreFamilyState, mockPerformance.recordId, ); - const setRelationEntity = useSetFamilyRecoilStateV2( + const setRelationEntity = useSetAtomFamilyState( recordStoreFamilyState, mockPerformance.relationRecordId, ); - const setCurrentRecordFields = useSetRecoilComponentStateV2( + const setCurrentRecordFields = useSetAtomComponentState( currentRecordFieldsComponentState, 'recordTableId', ); - const [, setObjectMetadataItems] = useRecoilStateV2(objectMetadataItemsState); + const [, setObjectMetadataItems] = useAtomState(objectMetadataItemsState); useEffect(() => { setEntity(mockPerformance.entityValue); @@ -87,12 +87,12 @@ const meta: Meta = { MemoryRouterDecorator, ChipGeneratorsDecorator, (Story) => { - const currentRecordFields = useRecoilComponentValueV2( + const currentRecordFields = useAtomComponentStateValue( currentRecordFieldsComponentState, 'recordTableId', ); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, 'recordTableId', ); @@ -130,7 +130,7 @@ const meta: Meta = { ]), ); - const labelIdentifierFieldMetadataItem = useFamilySelectorValueV2( + const labelIdentifierFieldMetadataItem = useAtomFamilySelectorValue( labelIdentifierFieldMetadataItemSelector, { objectMetadataItemId: mockPerformance.objectMetadataItem.id, diff --git a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyHandler.tsx b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyHandler.tsx index 2beb538b73..c5d8392c07 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyHandler.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyHandler.tsx @@ -1,8 +1,8 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { RecordTableEmptyState } from '@/object-record/record-table/empty-state/components/RecordTableEmptyState'; import { isRecordTableInitialLoadingComponentState } from '@/object-record/record-table/states/isRecordTableInitialLoadingComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; type RecordTableEmptyHandlerProps = { recordTableId: string; @@ -13,12 +13,12 @@ export const RecordTableEmptyHandler = ({ recordTableId, children, }: RecordTableEmptyHandlerProps) => { - const isRecordTableInitialLoading = useRecoilComponentValueV2( + const isRecordTableInitialLoading = useAtomComponentStateValue( isRecordTableInitialLoadingComponentState, recordTableId, ); - const allRecordIds = useRecoilComponentSelectorValueV2( + const allRecordIds = useAtomComponentSelectorValue( recordIndexAllRecordIdsComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyState.tsx b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyState.tsx index 5bdfd35ff8..8120a961c1 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyState.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyState.tsx @@ -7,7 +7,7 @@ import { RecordTableEmptyStateReadOnly } from '@/object-record/record-table/empt import { RecordTableEmptyStateRemote } from '@/object-record/record-table/empty-state/components/RecordTableEmptyStateRemote'; import { RecordTableEmptyStateSoftDelete } from '@/object-record/record-table/empty-state/components/RecordTableEmptyStateSoftDelete'; import { isSoftDeleteFilterActiveComponentState } from '@/object-record/record-table/states/isSoftDeleteFilterActiveComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const RecordTableEmptyState = () => { const { recordTableId, objectNameSingular, objectMetadataItem } = @@ -18,7 +18,7 @@ export const RecordTableEmptyState = () => { const isRemote = objectMetadataItem.isRemote; - const isSoftDeleteActive = useRecoilComponentValueV2( + const isSoftDeleteActive = useAtomComponentStateValue( isSoftDeleteFilterActiveComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateDisplay.tsx b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateDisplay.tsx index 38e0d42acc..8bf547d328 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateDisplay.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateDisplay.tsx @@ -3,7 +3,7 @@ import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObje import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/record-filter/states/hasAnySoftDeleteFilterOnView'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; import { type IconComponent } from 'twenty-ui/display'; @@ -61,7 +61,7 @@ export const RecordTableEmptyStateDisplay = ( objectMetadataItem, }); - const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2( + const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue( hasAnySoftDeleteFilterOnViewComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateSoftDelete.tsx b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateSoftDelete.tsx index 72d21233f7..11869c21d7 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateSoftDelete.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/empty-state/components/RecordTableEmptyStateSoftDelete.tsx @@ -4,7 +4,7 @@ import { useRemoveRecordFilter } from '@/object-record/record-filter/hooks/useRe import { useHandleToggleTrashColumnFilter } from '@/object-record/record-index/hooks/useHandleToggleTrashColumnFilter'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { RecordTableEmptyStateDisplay } from '@/object-record/record-table/empty-state/components/RecordTableEmptyStateDisplay'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { useLingui } from '@lingui/react/macro'; @@ -17,7 +17,7 @@ export const RecordTableEmptyStateSoftDelete = () => { const { objectMetadataItem, objectNameSingular, recordTableId } = useRecordTableContextOrThrow(); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useCloseCurrentTableCellInEditMode.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useCloseCurrentTableCellInEditMode.ts index ca38d5f7b0..9291227df1 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useCloseCurrentTableCellInEditMode.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useCloseCurrentTableCellInEditMode.ts @@ -5,15 +5,14 @@ import { recordTableCellEditModePositionComponentState } from '@/object-record/r import { useGoBackToPreviousDropdownFocusId } from '@/ui/layout/dropdown/hooks/useGoBackToPreviousDropdownFocusId'; import { useRemoveLastFocusItemFromFocusStackByComponentType } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackByComponentType'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; export const useCloseCurrentTableCellInEditMode = (recordTableId?: string) => { const store = useStore(); - const currentTableCellInEditModePosition = - useRecoilComponentStateCallbackStateV2( - recordTableCellEditModePositionComponentState, - recordTableId, - ); + const currentTableCellInEditModePosition = useAtomComponentStateCallbackState( + recordTableCellEditModePositionComponentState, + recordTableId, + ); const { goBackToPreviousDropdownFocusId } = useGoBackToPreviousDropdownFocusId(); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useHandleContainerMouseEnter.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useHandleContainerMouseEnter.ts index 40dd23f1c2..2ac44d94d4 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useHandleContainerMouseEnter.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useHandleContainerMouseEnter.ts @@ -4,7 +4,7 @@ import { useStore } from 'jotai'; import { useMoveHoverToCurrentCell } from '@/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell'; import { isSomeCellInEditModeComponentSelector } from '@/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; export type HandleContainerMouseEnterArgs = { cellPosition: TableCellPosition; @@ -17,11 +17,10 @@ export const useHandleContainerMouseEnter = ({ }) => { const { moveHoverToCurrentCell } = useMoveHoverToCurrentCell(recordTableId); - const isSomeCellInEditModeSelector = - useRecoilComponentSelectorCallbackStateV2( - isSomeCellInEditModeComponentSelector, - recordTableId, - ); + const isSomeCellInEditModeSelector = useAtomComponentSelectorCallbackState( + isSomeCellInEditModeComponentSelector, + recordTableId, + ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useLeaveTableFocus.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useLeaveTableFocus.ts index 4ad1b122b4..b0de8b23ad 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useLeaveTableFocus.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useLeaveTableFocus.ts @@ -7,7 +7,7 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-tabl import { recordTableFocusPositionComponentState } from '@/object-record/record-table/states/recordTableFocusPositionComponentState'; import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export const useLeaveTableFocus = (recordTableId?: string) => { const recordTableIdFromContext = useAvailableComponentInstanceIdOrThrow( @@ -17,12 +17,12 @@ export const useLeaveTableFocus = (recordTableId?: string) => { const { resetTableRowSelection } = useResetTableRowSelection(); - const setRecordTableHoverPosition = useSetRecoilComponentStateV2( + const setRecordTableHoverPosition = useSetAtomComponentState( recordTableHoverPositionComponentState, recordTableIdFromContext, ); - const setRecordTableFocusPosition = useSetRecoilComponentStateV2( + const setRecordTableFocusPosition = useSetAtomComponentState( recordTableFocusPositionComponentState, recordTableIdFromContext, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useResetTableRowSelection.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useResetTableRowSelection.ts index 138c49b527..94b45fd82f 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useResetTableRowSelection.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useResetTableRowSelection.ts @@ -10,9 +10,9 @@ import { lastSelectedRowIndexComponentState } from '@/object-record/record-table import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; export const useResetTableRowSelection = (recordTableId?: string) => { const recordTableIdFromContext = useAvailableComponentInstanceIdOrThrow( @@ -20,23 +20,23 @@ export const useResetTableRowSelection = (recordTableId?: string) => { recordTableId, ); - const recordIndexAllRecordIds = useRecoilComponentSelectorCallbackStateV2( + const recordIndexAllRecordIds = useAtomComponentSelectorCallbackState( recordIndexAllRecordIdsComponentSelector, recordTableIdFromContext, ); - const isRowSelectedFamilyState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowSelectedFamilyState = useAtomComponentFamilyStateCallbackState( isRowSelectedComponentFamilyState, recordTableIdFromContext, ); - const hasUserSelectedAllRows = useRecoilComponentStateCallbackStateV2( + const hasUserSelectedAllRows = useAtomComponentStateCallbackState( hasUserSelectedAllRowsComponentState, recordTableIdFromContext, ); const lastSelectedRowIndexComponentCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( lastSelectedRowIndexComponentState, recordTableIdFromContext, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts index d80d93890f..bb0ba20d17 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSelectAllRows.ts @@ -5,28 +5,28 @@ import { useResetTableRowSelection } from '@/object-record/record-table/hooks/in import { hasUserSelectedAllRowsComponentState } from '@/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { allRowsSelectedStatusComponentSelector } from '@/object-record/record-table/states/selectors/allRowsSelectedStatusComponentSelector'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; export const useSelectAllRows = (recordTableId?: string) => { - const hasUserSelectedAllRows = useRecoilComponentStateCallbackStateV2( + const hasUserSelectedAllRows = useAtomComponentStateCallbackState( hasUserSelectedAllRowsComponentState, recordTableId, ); - const allRowsSelectedStatus = useRecoilComponentSelectorCallbackStateV2( + const allRowsSelectedStatus = useAtomComponentSelectorCallbackState( allRowsSelectedStatusComponentSelector, recordTableId, ); - const isRowSelectedFamilyState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowSelectedFamilyState = useAtomComponentFamilyStateCallbackState( isRowSelectedComponentFamilyState, recordTableId, ); - const recordIndexAllRecordIds = useRecoilComponentSelectorCallbackStateV2( + const recordIndexAllRecordIds = useAtomComponentSelectorCallbackState( recordIndexAllRecordIdsComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetAllRowSelectedState.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetAllRowSelectedState.ts index 14110bcf89..5d77f1060b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetAllRowSelectedState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetAllRowSelectedState.ts @@ -1,9 +1,9 @@ import { hasUserSelectedAllRowsComponentState } from '@/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; export const useSetHasUserSelectedAllRows = (recordTableId?: string) => { - const hasUserSelectedAllRows = useRecoilComponentStateCallbackStateV2( + const hasUserSelectedAllRows = useAtomComponentStateCallbackState( hasUserSelectedAllRowsComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetRecordTableData.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetRecordTableData.ts index 06e9a3e5eb..860e8b2d6a 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetRecordTableData.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/internal/useSetRecordTableData.ts @@ -18,10 +18,10 @@ import { recordTableHoverPositionComponentState } from '@/object-record/record-t import { recordIdByRealIndexComponentState } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isDefined } from 'twenty-shared/utils'; import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; @@ -33,37 +33,36 @@ export const useSetRecordTableData = ({ recordTableId, }: useSetRecordTableDataProps) => { const recordIndexRecordIdsByGroupFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); - const recordIndexAllRecordIdsSelector = - useRecoilComponentSelectorCallbackStateV2( - recordIndexAllRecordIdsComponentSelector, - recordTableId, - ); + const recordIndexAllRecordIdsSelector = useAtomComponentSelectorCallbackState( + recordIndexAllRecordIdsComponentSelector, + recordTableId, + ); - const isRowSelectedFamilyState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowSelectedFamilyState = useAtomComponentFamilyStateCallbackState( isRowSelectedComponentFamilyState, recordTableId, ); - const hasUserSelectedAllRows = useRecoilComponentStateCallbackStateV2( + const hasUserSelectedAllRows = useAtomComponentStateCallbackState( hasUserSelectedAllRowsComponentState, recordTableId, ); - const isRecordTableInitialLoading = useRecoilComponentStateCallbackStateV2( + const isRecordTableInitialLoading = useAtomComponentStateCallbackState( isRecordTableInitialLoadingComponentState, recordTableId, ); - const recordIdByRealIndex = useRecoilComponentStateCallbackStateV2( + const recordIdByRealIndex = useAtomComponentStateCallbackState( recordIdByRealIndexComponentState, recordTableId, ); - const setRecordTableHoverPosition = useSetRecoilComponentStateV2( + const setRecordTableHoverPosition = useSetAtomComponentState( recordTableHoverPositionComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useActiveRecordTableRow.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useActiveRecordTableRow.ts index cc441f8a12..6282866964 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useActiveRecordTableRow.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useActiveRecordTableRow.ts @@ -3,17 +3,17 @@ import { useStore } from 'jotai'; import { activeRecordTableRowIndexComponentState } from '@/object-record/record-table/states/activeRecordTableRowIndexComponentState'; import { isRecordTableRowActiveComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowActiveComponentFamilyState'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { isDefined } from 'twenty-shared/utils'; export const useActiveRecordTableRow = (recordTableId?: string) => { - const isRowActiveState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowActiveState = useAtomComponentFamilyStateCallbackState( isRecordTableRowActiveComponentFamilyState, recordTableId, ); - const activeRowIndexState = useRecoilComponentStateCallbackStateV2( + const activeRowIndexState = useAtomComponentStateCallbackState( activeRecordTableRowIndexComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useBuildRecordInputFromFilters.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useBuildRecordInputFromFilters.ts index 173f525134..5f5c5c6584 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useBuildRecordInputFromFilters.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useBuildRecordInputFromFilters.ts @@ -4,19 +4,19 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte import { buildRecordInputFromFilter } from '@/object-record/record-table/utils/buildRecordInputFromFilter'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useBuildRecordInputFromFilters = ({ objectMetadataItem, }: { objectMetadataItem: ObjectMetadataItem; }) => { - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const buildRecordInputFromFilters = (): Partial => { return buildRecordInputFromFilter({ diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts index e70fd6f58d..fc178ca206 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useCreateNewIndexRecord.ts @@ -15,9 +15,9 @@ import { RecordTitleCellContainerType } from '@/object-record/record-title-cell/ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { canOpenObjectInSidePanel } from '@/object-record/utils/canOpenObjectInSidePanel'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useStore } from 'jotai'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; import { useCallback } from 'react'; @@ -33,17 +33,17 @@ type UseCreateNewIndexRecordProps = { export const useCreateNewIndexRecord = ({ objectMetadataItem, }: UseCreateNewIndexRecordProps) => { - const recordGroupDefinitions = useRecoilComponentSelectorValueV2( + const recordGroupDefinitions = useAtomComponentSelectorValue( recordGroupDefinitionsComponentSelector, ); const store = useStore(); const recordIndexRecordIdsByGroupCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); - const recordIndexGroupFieldMetadataItem = useRecoilComponentValueV2( + const recordIndexGroupFieldMetadataItem = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts index 23976368bb..496fb454d6 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useFocusedRecordTableRow.ts @@ -13,8 +13,8 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePush import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { isDefined } from 'twenty-shared/utils'; export const useFocusedRecordTableRow = (recordTableId?: string) => { @@ -23,28 +23,28 @@ export const useFocusedRecordTableRow = (recordTableId?: string) => { recordTableId, ); - const isRowFocusedState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowFocusedState = useAtomComponentFamilyStateCallbackState( isRecordTableRowFocusedComponentFamilyState, recordTableIdFromContext, ); const store = useStore(); - const focusedRowIndex = useRecoilComponentStateCallbackStateV2( + const focusedRowIndex = useAtomComponentStateCallbackState( focusedRecordTableRowIndexComponentState, recordTableIdFromContext, ); - const isRowFocusActive = useRecoilComponentStateCallbackStateV2( + const isRowFocusActive = useAtomComponentStateCallbackState( isRecordTableRowFocusActiveComponentState, recordTableIdFromContext, ); - const focusedCellPosition = useRecoilComponentStateCallbackStateV2( + const focusedCellPosition = useAtomComponentStateCallbackState( recordTableFocusPositionComponentState, recordTableIdFromContext, ); - const isRecordTableCellFocusActive = useRecoilComponentStateCallbackStateV2( + const isRecordTableCellFocusActive = useAtomComponentStateCallbackState( isRecordTableCellFocusActiveComponentState, recordTableIdFromContext, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableLastColumnWidthToFill.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableLastColumnWidthToFill.ts index eb4908fab7..a28cfb5013 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableLastColumnWidthToFill.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableLastColumnWidthToFill.ts @@ -2,16 +2,16 @@ import { useRecordTableContextOrThrow } from '@/object-record/record-table/conte import { recordTableWidthComponentState } from '@/object-record/record-table/states/recordTableWidthComponentState'; import { shouldCompactRecordTableFirstColumnComponentState } from '@/object-record/record-table/states/shouldCompactRecordTableFirstColumnComponentState'; import { computeLastRecordTableColumnWidth } from '@/object-record/record-table/utils/computeLastRecordTableColumnWidth'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useRecordTableLastColumnWidthToFill = () => { const { visibleRecordFields } = useRecordTableContextOrThrow(); - const recordTableWidth = useRecoilComponentValueV2( + const recordTableWidth = useAtomComponentStateValue( recordTableWidthComponentState, ); - const shouldCompactRecordTableFirstColumn = useRecoilComponentValueV2( + const shouldCompactRecordTableFirstColumn = useAtomComponentStateValue( shouldCompactRecordTableFirstColumnComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedCell.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedCell.ts index 479d1f7827..09d241cfca 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedCell.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedCell.ts @@ -6,20 +6,20 @@ import { currentRecordFieldsComponentState } from '@/object-record/record-field/ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { useFocusRecordTableCell } from '@/object-record/record-table/record-table-cell/hooks/useFocusRecordTableCell'; import { recordTableFocusPositionComponentState } from '@/object-record/record-table/states/recordTableFocusPositionComponentState'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { isDefined } from 'twenty-shared/utils'; export const useRecordTableMoveFocusedCell = (recordTableId?: string) => { const { focusRecordTableCell } = useFocusRecordTableCell(recordTableId); - const focusPosition = useRecoilComponentStateCallbackStateV2( + const focusPosition = useAtomComponentStateCallbackState( recordTableFocusPositionComponentState, recordTableId, ); - const recordIndexAllRecordIds = useRecoilComponentSelectorCallbackStateV2( + const recordIndexAllRecordIds = useAtomComponentSelectorCallbackState( recordIndexAllRecordIdsComponentSelector, recordTableId, ); @@ -65,7 +65,7 @@ export const useRecordTableMoveFocusedCell = (recordTableId?: string) => { }); }, [recordIndexAllRecordIds, focusRecordTableCell, focusPosition, store]); - const currentRecordFields = useRecoilComponentStateCallbackStateV2( + const currentRecordFields = useAtomComponentStateCallbackState( currentRecordFieldsComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedRow.ts b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedRow.ts index 939f57cec3..397e909493 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedRow.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/hooks/useRecordTableMoveFocusedRow.ts @@ -2,8 +2,8 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record import { useFocusedRecordTableRow } from '@/object-record/record-table/hooks/useFocusedRecordTableRow'; import { focusedRecordTableRowIndexComponentState } from '@/object-record/record-table/states/focusedRecordTableRowIndexComponentState'; import { type MoveFocusDirection } from '@/object-record/record-table/types/MoveFocusDirection'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -11,12 +11,12 @@ import { isDefined } from 'twenty-shared/utils'; export const useRecordTableMoveFocusedRow = (recordTableId?: string) => { const { focusRecordTableRow } = useFocusedRecordTableRow(recordTableId); - const focusedRowIndex = useRecoilComponentStateCallbackStateV2( + const focusedRowIndex = useAtomComponentStateCallbackState( focusedRecordTableRowIndexComponentState, recordTableId, ); - const recordIndexAllRecordIds = useRecoilComponentSelectorCallbackStateV2( + const recordIndexAllRecordIds = useAtomComponentSelectorCallbackState( recordIndexAllRecordIdsComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx index 12d6a66a46..1e644fa6a9 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyEscapeHotkeyEffect.tsx @@ -4,12 +4,12 @@ import { useResetTableRowSelection } from '@/object-record/record-table/hooks/in import { isAtLeastOneTableRowSelectedSelector } from '@/object-record/record-table/record-table-row/states/isAtLeastOneTableRowSelectedSelector'; import { PageFocusId } from '@/types/PageFocusId'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; export const RecordTableBodyEscapeHotkeyEffect = () => { const { resetTableRowSelection } = useResetTableRowSelection(); - const isAtLeastOneRecordSelected = useRecoilComponentSelectorValueV2( + const isAtLeastOneRecordSelected = useAtomComponentSelectorValue( isAtLeastOneTableRowSelectedSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx index 579bb1415e..2f6412acdb 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyFocusClickOutsideEffect.tsx @@ -8,7 +8,7 @@ import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constan import { currentFocusedItemSelector } from '@/ui/utilities/focus/states/currentFocusedItemSelector'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; type RecordTableBodyFocusClickOutsideEffectProps = { tableBodyRef: React.RefObject; }; @@ -20,7 +20,7 @@ export const RecordTableBodyFocusClickOutsideEffect = ({ const leaveTableFocus = useLeaveTableFocus(recordTableId); - const currentFocusedItem = useRecoilValueV2(currentFocusedItemSelector); + const currentFocusedItem = useAtomStateValue(currentFocusedItemSelector); const componentType = currentFocusedItem?.componentInstance.componentType; diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyNoRecordGroupDragDropContextProvider.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyNoRecordGroupDragDropContextProvider.tsx index 31fabb6a32..df40ceadfd 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyNoRecordGroupDragDropContextProvider.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyNoRecordGroupDragDropContextProvider.tsx @@ -7,7 +7,7 @@ import { type ReactNode, useCallback } from 'react'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { useEndRecordDrag } from '@/object-record/record-drag/hooks/useEndRecordDrag'; @@ -23,7 +23,7 @@ export const RecordTableBodyNoRecordGroupDragDropContextProvider = ({ const { recordIndexId } = useRecordIndexContextOrThrow(); const { recordTableId } = useRecordTableContextOrThrow(); - const selectedRowIds = useRecoilComponentSelectorCallbackStateV2( + const selectedRowIds = useAtomComponentSelectorCallbackState( selectedRowIdsComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyRecordGroupDragDropContextProvider.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyRecordGroupDragDropContextProvider.tsx index 5640290c10..ceffbd806b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyRecordGroupDragDropContextProvider.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyRecordGroupDragDropContextProvider.tsx @@ -4,7 +4,7 @@ import { useStartRecordDrag } from '@/object-record/record-drag/hooks/useStartRe import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { selectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/selectedRowIdsComponentSelector'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { useStore } from 'jotai'; import { DragDropContext, @@ -21,7 +21,7 @@ export const RecordTableBodyRecordGroupDragDropContextProvider = ({ const { recordIndexId } = useRecordIndexContextOrThrow(); const { recordTableId } = useRecordTableContextOrThrow(); - const selectedRowIds = useRecoilComponentSelectorCallbackStateV2( + const selectedRowIds = useAtomComponentSelectorCallbackState( selectedRowIdsComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyVirtualizedDraggableClone.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyVirtualizedDraggableClone.tsx index 1fc9763d3b..2d80936210 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyVirtualizedDraggableClone.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableBodyVirtualizedDraggableClone.tsx @@ -26,7 +26,7 @@ import { useIsTableRowSecondaryDragged } from '@/object-record/record-table/reco import { getRecordTableColumnFieldWidthClassName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthClassName'; import { getRecordTableColumnFieldWidthCSSVariableName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthCSSVariableName'; import { recordIdByRealIndexComponentFamilySelector } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { @@ -147,7 +147,7 @@ export const RecordTableBodyVirtualizedDraggableClone = ({ const theme = useTheme(); - const recordId = useRecoilComponentFamilySelectorValueV2( + const recordId = useAtomComponentFamilySelectorValue( recordIdByRealIndexComponentFamilySelector, realIndex, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableNoRecordGroupBody.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableNoRecordGroupBody.tsx index 1b6672e57d..afae3713ce 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableNoRecordGroupBody.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableNoRecordGroupBody.tsx @@ -11,15 +11,15 @@ import { isRecordTableInitialLoadingComponentState } from '@/object-record/recor import { RecordTableVirtualizedDataChangedEffect } from '@/object-record/record-table/virtualization/components/RecordTableVirtualizedDataChangedEffect'; import { RecordTableVirtualizedSSESubscribeEffect } from '@/object-record/record-table/virtualization/components/RecordTableVirtualizedSSESubscribeEffect'; import { RecordTableVirtualizedRowTreadmillEffect } from '@/object-record/record-table/virtualization/components/RecordTableVirtualizedRowTreadmillEffect'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const RecordTableNoRecordGroupBody = () => { - const recordTableHasRecords = useRecoilComponentSelectorValueV2( + const recordTableHasRecords = useAtomComponentSelectorValue( recordIndexHasRecordsComponentSelector, ); - const isRecordTableInitialLoading = useRecoilComponentValueV2( + const isRecordTableInitialLoading = useAtomComponentStateValue( isRecordTableInitialLoadingComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffect.tsx index 9994d21d28..2d5373148e 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffect.tsx @@ -1,7 +1,7 @@ import { useEffect } from 'react'; import { lastShowPageRecordIdState } from '@/object-record/record-field/ui/states/lastShowPageRecordId'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useCurrentRecordGroupId } from '@/object-record/record-group/hooks/useCurrentRecordGroupId'; import { useRecordIndexTableQuery } from '@/object-record/record-index/hooks/useRecordIndexTableQuery'; import { recordIndexHasFetchedAllRecordsByGroupComponentState } from '@/object-record/record-index/states/recordIndexHasFetchedAllRecordsByGroupComponentState'; @@ -11,8 +11,8 @@ import { useRecordTableContextOrThrow } from '@/object-record/record-table/conte import { useSetRecordTableData } from '@/object-record/record-table/hooks/internal/useSetRecordTableData'; import { isRecordTableInitialLoadingComponentState } from '@/object-record/record-table/states/isRecordTableInitialLoadingComponentState'; import { useScrollToPosition } from '@/ui/utilities/scroll/hooks/useScrollToPosition'; -import { useSetRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentFamilyStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isNonEmptyString } from '@sniptt/guards'; export const RecordTableRecordGroupBodyEffect = () => { @@ -23,7 +23,7 @@ export const RecordTableRecordGroupBodyEffect = () => { recordTableId, }); - const setIsRecordTableInitialLoading = useSetRecoilComponentStateV2( + const setIsRecordTableInitialLoading = useSetAtomComponentState( isRecordTableInitialLoadingComponentState, ); @@ -33,12 +33,12 @@ export const RecordTableRecordGroupBodyEffect = () => { useRecordIndexTableQuery(objectNameSingular); const setHasRecordFetchedAllRecordsComponents = - useSetRecoilComponentFamilyStateV2( + useSetAtomComponentFamilyState( recordIndexHasFetchedAllRecordsByGroupComponentState, recordGroupId, ); - const lastShowPageRecordId = useRecoilValueV2(lastShowPageRecordIdState); + const lastShowPageRecordId = useAtomStateValue(lastShowPageRecordIdState); const { scrollToPosition } = useScrollToPosition(); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffects.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffects.tsx index eb7f4cddf3..ff0455f019 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffects.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffects.tsx @@ -1,10 +1,10 @@ import { RecordGroupContext } from '@/object-record/record-group/states/context/RecordGroupContext'; import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; import { RecordTableRecordGroupBodyEffect } from '@/object-record/record-table/record-table-body/components/RecordTableRecordGroupBodyEffect'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const RecordTableRecordGroupBodyEffects = () => { - const recordGroupIds = useRecoilComponentValueV2( + const recordGroupIds = useAtomComponentStateValue( recordGroupIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupsBody.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupsBody.tsx index 8092776da4..07d52c3e65 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupsBody.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-body/components/RecordTableRecordGroupsBody.tsx @@ -10,21 +10,21 @@ import { RecordTableBodyRecordGroupDroppable } from '@/object-record/record-tabl import { RecordTableCellPortals } from '@/object-record/record-table/record-table-cell/components/RecordTableCellPortals'; import { RecordTableRecordGroupSection } from '@/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection'; import { isRecordTableInitialLoadingComponentState } from '@/object-record/record-table/states/isRecordTableInitialLoadingComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { ViewType } from '@/views/types/ViewType'; export const RecordTableRecordGroupsBody = () => { - const allRecordIds = useRecoilComponentSelectorValueV2( + const allRecordIds = useAtomComponentSelectorValue( recordIndexAllRecordIdsComponentSelector, ); - const isRecordTableInitialLoading = useRecoilComponentValueV2( + const isRecordTableInitialLoading = useAtomComponentStateValue( isRecordTableInitialLoadingComponentState, ); - const visibleRecordGroupIds = useRecoilComponentFamilySelectorValueV2( + const visibleRecordGroupIds = useAtomComponentFamilySelectorValue( visibleRecordGroupIdsComponentFamilySelector, ViewType.Table, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditMode.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditMode.tsx index 543db097b3..3552e7c4d8 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditMode.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditMode.tsx @@ -7,8 +7,8 @@ import { RecordTableCellContext } from '@/object-record/record-table/contexts/Re import { useFocusRecordTableCell } from '@/object-record/record-table/record-table-cell/hooks/useFocusRecordTableCell'; import { OverlayContainer } from '@/ui/layout/overlay/components/OverlayContainer'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { autoUpdate, @@ -45,19 +45,19 @@ export type RecordTableCellEditModeProps = { export const RecordTableCellEditMode = ({ children, }: RecordTableCellEditModeProps) => { - const isFieldInError = useRecoilComponentValueV2( + const isFieldInError = useAtomComponentStateValue( recordFieldInputIsFieldInErrorComponentState, ); const recordFieldComponentInstanceId = useAvailableComponentInstanceIdOrThrow( RecordFieldComponentInstanceContext, ); - const setFieldInputLayoutDirection = useSetRecoilComponentStateV2( + const setFieldInputLayoutDirection = useSetAtomComponentState( recordFieldInputLayoutDirectionComponentState, recordFieldComponentInstanceId, ); - const setFieldInputLayoutDirectionLoading = useSetRecoilComponentStateV2( + const setFieldInputLayoutDirectionLoading = useSetAtomComponentState( recordFieldInputLayoutDirectionLoadingComponentState, recordFieldComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditModePortal.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditModePortal.tsx index f61c9167ec..1fa1852281 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditModePortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellEditModePortal.tsx @@ -1,6 +1,6 @@ import { RecordTableCellPortalWrapper } from '@/object-record/record-table/record-table-cell/components/RecordTableCellPortalWrapper'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { hasRecordGroupsComponentSelector } from '@/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector'; import { TABLE_Z_INDEX } from '@/object-record/record-table/constants/TableZIndex'; @@ -14,15 +14,15 @@ import { recordTableFocusPositionComponentState } from '@/object-record/record-t import { isDefined } from 'twenty-shared/utils'; export const RecordTableCellEditModePortal = () => { - const focusedCellPosition = useRecoilComponentValueV2( + const focusedCellPosition = useAtomComponentStateValue( recordTableFocusPositionComponentState, ); - const currentTableCellInEditModePosition = useRecoilComponentValueV2( + const currentTableCellInEditModePosition = useAtomComponentStateValue( recordTableCellEditModePositionComponentState, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldContextLabelIdentifier.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldContextLabelIdentifier.tsx index cc96039e87..030418dfe0 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldContextLabelIdentifier.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFieldContextLabelIdentifier.tsx @@ -7,7 +7,7 @@ import { RecordUpdateContext } from '@/object-record/record-table/contexts/Entit import { RecordTableCellContext } from '@/object-record/record-table/contexts/RecordTableCellContext'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { useRecordTableRowContextOrThrow } from '@/object-record/record-table/contexts/RecordTableRowContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext, type ReactNode } from 'react'; type RecordTableCellFieldContextLabelIdentifierProps = { @@ -33,7 +33,7 @@ export const RecordTableCellFieldContextLabelIdentifier = ({ objectMetadataItem.id, ); - const shouldCompactRecordIndexLabelIdentifier = useRecoilComponentValueV2( + const shouldCompactRecordIndexLabelIdentifier = useAtomComponentStateValue( shouldCompactRecordIndexLabelIdentifierComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx index 5c4cfdb69b..ac8d22a9f8 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFirstRowFirstColumn.tsx @@ -4,8 +4,8 @@ import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/r import { recordTableFocusPositionComponentState } from '@/object-record/record-table/states/recordTableFocusPositionComponentState'; import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState'; import { getRecordTableColumnFieldWidthClassName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthClassName'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { type DraggableProvidedDragHandleProps } from '@hello-pangea/dnd'; import { cx } from '@linaria/core'; @@ -33,11 +33,11 @@ export const RecordTableCellFirstRowFirstColumn = ({ } & (Partial | null)) => { const { theme } = useContext(ThemeContext); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordTableHoverPositionComponentState, ); - const focusPosition = useRecoilComponentValueV2( + const focusPosition = useAtomComponentStateValue( recordTableFocusPositionComponentState, ); @@ -47,7 +47,7 @@ export const RecordTableCellFirstRowFirstColumn = ({ const isHoveredPortalOnThisCell = hoverPosition?.column === 0 && hoverPosition.row === 0; - const [isRecordTableScrolledVertically] = useRecoilComponentStateV2( + const [isRecordTableScrolledVertically] = useAtomComponentState( isRecordTableScrolledVerticallyComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortal.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortal.tsx index bb9f047de9..4fa10a9e1d 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortal.tsx @@ -1,6 +1,6 @@ import { RecordTableCellPortalWrapper } from '@/object-record/record-table/record-table-cell/components/RecordTableCellPortalWrapper'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { hasRecordGroupsComponentSelector } from '@/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector'; import { TABLE_Z_INDEX } from '@/object-record/record-table/constants/TableZIndex'; @@ -13,23 +13,23 @@ import { recordTableHoverPositionComponentState } from '@/object-record/record-t import { isDefined } from 'twenty-shared/utils'; export const RecordTableCellFocusedPortal = () => { - const focusPosition = useRecoilComponentValueV2( + const focusPosition = useAtomComponentStateValue( recordTableFocusPositionComponentState, ); - const isRecordTableScrolledVertically = useRecoilComponentValueV2( + const isRecordTableScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const isRecordTableScrolledHorizontally = useRecoilComponentValueV2( + const isRecordTableScrolledHorizontally = useAtomComponentStateValue( isRecordTableScrolledHorizontallyComponentState, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordTableHoverPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortalContent.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortalContent.tsx index abe827fa57..84d010e560 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortalContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellFocusedPortalContent.tsx @@ -7,8 +7,8 @@ import { RecordTableCellDisplayMode } from '@/object-record/record-table/record- import { isRecordTableRowActiveComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowActiveComponentFamilyState'; import { recordTableFocusPositionComponentState } from '@/object-record/record-table/states/recordTableFocusPositionComponentState'; import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; import { BORDER_COMMON } from 'twenty-ui/theme'; @@ -35,16 +35,16 @@ export const RecordTableCellFocusedPortalContent = () => { const { rowIndex } = useRecordTableRowContextOrThrow(); const { onMoveHoverToCurrentCell } = useRecordTableBodyContextOrThrow(); - const focusPosition = useRecoilComponentValueV2( + const focusPosition = useAtomComponentStateValue( recordTableFocusPositionComponentState, ); - const isRowActive = useRecoilComponentFamilyValueV2( + const isRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, rowIndex, ); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordTableHoverPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortal.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortal.tsx index 0644dfe9be..2f72671d3b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortal.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortal.tsx @@ -1,7 +1,7 @@ import { RecordTableCellPortalWrapper } from '@/object-record/record-table/record-table-cell/components/RecordTableCellPortalWrapper'; import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { hasRecordGroupsComponentSelector } from '@/object-record/record-group/states/selectors/hasRecordGroupsComponentSelector'; import { TABLE_Z_INDEX } from '@/object-record/record-table/constants/TableZIndex'; @@ -12,19 +12,19 @@ import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/r import { isDefined } from 'twenty-shared/utils'; export const RecordTableCellHoveredPortal = () => { - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordTableHoverPositionComponentState, ); - const isRecordTableScrolledVertically = useRecoilComponentValueV2( + const isRecordTableScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const isRecordTableScrolledHorizontally = useRecoilComponentValueV2( + const isRecordTableScrolledHorizontally = useAtomComponentStateValue( isRecordTableScrolledHorizontallyComponentState, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortalContent.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortalContent.tsx index f893fa0d3c..66dcfa5bae 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortalContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortalContent.tsx @@ -10,8 +10,8 @@ import { RecordTableCellFieldInput } from '@/object-record/record-table/record-t import { isRecordTableRowActiveComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowActiveComponentFamilyState'; import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { useContext } from 'react'; import { BORDER_COMMON } from 'twenty-ui/theme'; @@ -45,7 +45,7 @@ const StyledRecordTableCellHoveredPortalContent = styled.div<{ `; export const RecordTableCellHoveredPortalContent = () => { - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordTableHoverPositionComponentState, ); @@ -66,7 +66,7 @@ export const RecordTableCellHoveredPortalContent = () => { const { rowIndex } = useRecordTableRowContextOrThrow(); - const isRowActive = useRecoilComponentFamilyValueV2( + const isRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, rowIndex, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortalContexts.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortalContexts.tsx index 314f5fe6c3..699c8b342b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortalContexts.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortalContexts.tsx @@ -7,7 +7,7 @@ import { RecordTableCellContext } from '@/object-record/record-table/contexts/Re import { RecordTableRowContextProvider } from '@/object-record/record-table/contexts/RecordTableRowContext'; import { RecordTableCellFieldContextWrapper } from '@/object-record/record-table/record-table-cell/components/RecordTableCellFieldContextWrapper'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const RecordTableCellPortalContexts = ({ @@ -17,13 +17,13 @@ export const RecordTableCellPortalContexts = ({ position: TableCellPosition; children: React.ReactNode; }) => { - const allRecordIds = useRecoilComponentSelectorValueV2( + const allRecordIds = useAtomComponentSelectorValue( recordIndexAllRecordIdsComponentSelector, ); const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortals.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortals.tsx index e59c92dc2b..68f48e99ce 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortals.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellPortals.tsx @@ -5,13 +5,13 @@ import { RecordTableCellFocusedPortal } from '@/object-record/record-table/recor import { RecordTableCellHoveredPortal } from '@/object-record/record-table/record-table-cell/components/RecordTableCellHoveredPortal'; import { useCurrentlyFocusedRecordTableCellFocusId } from '@/object-record/record-table/record-table-cell/hooks/useCurrentlyFocusedRecordTableCellFocusId'; import { isRecordTableCellFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableCellFocusActiveComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const RecordTableCellPortals = () => { const { recordTableId } = useRecordTableContextOrThrow(); - const isRecordTableFocusActive = useRecoilComponentValueV2( + const isRecordTableFocusActive = useAtomComponentStateValue( isRecordTableCellFocusActiveComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellInGroup.test.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellInGroup.test.tsx index 151e194418..abd2302920 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellInGroup.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellInGroup.test.tsx @@ -20,7 +20,7 @@ import { import { useCloseRecordTableCellInGroup } from '@/object-record/record-table/record-table-cell/hooks/internal/useCloseRecordTableCellInGroup'; import { recordTableCellEditModePositionComponentState } from '@/object-record/record-table/states/recordTableCellEditModePositionComponentState'; import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -78,7 +78,7 @@ describe('useCloseRecordTableCellInGroup', () => { it('should work as expected', async () => { const { result } = renderHook( () => { - const currentTableCellInEditModePosition = useRecoilComponentValueV2( + const currentTableCellInEditModePosition = useAtomComponentStateValue( recordTableCellEditModePositionComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellNoGroup.test.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellNoGroup.test.tsx index 11c2889431..cc4fdfc8f3 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellNoGroup.test.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/internal/__tests__/useCloseRecordTableCellNoGroup.test.tsx @@ -20,7 +20,7 @@ import { import { useCloseRecordTableCellNoGroup } from '@/object-record/record-table/record-table-cell/hooks/internal/useCloseRecordTableCellNoGroup'; import { recordTableCellEditModePositionComponentState } from '@/object-record/record-table/states/recordTableCellEditModePositionComponentState'; import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -79,7 +79,7 @@ describe('useCloseRecordTableCellNoGroup', () => { it('should work as expected', async () => { const { result } = renderHook( () => { - const currentTableCellInEditModePosition = useRecoilComponentValueV2( + const currentTableCellInEditModePosition = useAtomComponentStateValue( recordTableCellEditModePositionComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useCurrentlyFocusedRecordTableCellFocusId.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useCurrentlyFocusedRecordTableCellFocusId.ts index 74904bef37..5192692ffe 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useCurrentlyFocusedRecordTableCellFocusId.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useCurrentlyFocusedRecordTableCellFocusId.ts @@ -1,13 +1,13 @@ import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { getRecordTableCellFocusId } from '@/object-record/record-table/record-table-cell/utils/getRecordTableCellFocusId'; import { recordTableFocusPositionComponentState } from '@/object-record/record-table/states/recordTableFocusPositionComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useCurrentlyFocusedRecordTableCellFocusId = () => { const { recordTableId } = useRecordTableContextOrThrow(); - const focusPosition = useRecoilComponentValueV2( + const focusPosition = useAtomComponentStateValue( recordTableFocusPositionComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useFocusRecordTableCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useFocusRecordTableCell.ts index db81a8c54c..4fbbe04619 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useFocusRecordTableCell.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useFocusRecordTableCell.ts @@ -6,7 +6,7 @@ import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; import { useStore } from 'jotai'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; @@ -19,7 +19,7 @@ export const useFocusRecordTableCell = (recordTableId?: string) => { ); const store = useStore(); - const focusPosition = useRecoilComponentStateCallbackStateV2( + const focusPosition = useAtomComponentStateCallbackState( recordTableFocusPositionComponentState, recordTableIdFromProps, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts index 26a7dc9116..5c2a69603d 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useMoveHoverToCurrentCell.ts @@ -5,16 +5,16 @@ import { useStore } from 'jotai'; import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState'; import { isSomeCellInEditModeComponentSelector } from '@/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export const useMoveHoverToCurrentCell = (recordTableId: string) => { - const setHoverPosition = useSetRecoilComponentStateV2( + const setHoverPosition = useSetAtomComponentState( recordTableHoverPositionComponentState, recordTableId, ); - const isSomeCellInEditMode = useRecoilComponentSelectorCallbackStateV2( + const isSomeCellInEditMode = useAtomComponentSelectorCallbackState( isSomeCellInEditModeComponentSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCell.ts index 3925560272..4e8e322ece 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCell.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useOpenRecordTableCell.ts @@ -24,7 +24,7 @@ import { useFocusedRecordTableRow } from '@/object-record/record-table/hooks/use import { useFocusRecordTableCell } from '@/object-record/record-table/record-table-cell/hooks/useFocusRecordTableCell'; import { isRecordTableRowFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableRowFocusActiveComponentState'; import { clickOutsideListenerIsActivatedComponentState } from '@/ui/utilities/pointer-event/states/clickOutsideListenerIsActivatedComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType'; @@ -42,7 +42,7 @@ export const useOpenRecordTableCell = (recordTableId: string) => { const { scopeInstanceId } = useRecordFieldsScopeContextOrThrow(); const store = useStore(); - const setCurrentTableCellInEditModePosition = useSetRecoilComponentStateV2( + const setCurrentTableCellInEditModePosition = useSetAtomComponentState( recordTableCellEditModePositionComponentState, recordTableId, ); @@ -66,7 +66,7 @@ export const useOpenRecordTableCell = (recordTableId: string) => { const { unfocusRecordTableRow } = useFocusedRecordTableRow(recordTableId); - const setIsRowFocusActive = useSetRecoilComponentStateV2( + const setIsRowFocusActive = useSetAtomComponentState( isRecordTableRowFocusActiveComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useSetIsRecordTableCellFocusActive.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useSetIsRecordTableCellFocusActive.ts index 16f5e133e9..000883ddcc 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useSetIsRecordTableCellFocusActive.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useSetIsRecordTableCellFocusActive.ts @@ -4,16 +4,16 @@ import { useStore } from 'jotai'; import { isRecordTableCellFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableCellFocusActiveComponentState'; import { recordTableFocusPositionComponentState } from '@/object-record/record-table/states/recordTableFocusPositionComponentState'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; export const useSetIsRecordTableCellFocusActive = (recordTableId?: string) => { const store = useStore(); - const isRecordTableCellFocusActive = useRecoilComponentStateCallbackStateV2( + const isRecordTableCellFocusActive = useAtomComponentStateCallbackState( isRecordTableCellFocusActiveComponentState, recordTableId, ); - const recordTableFocusPosition = useRecoilComponentStateCallbackStateV2( + const recordTableFocusPosition = useAtomComponentStateCallbackState( recordTableFocusPositionComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts index 1fe70f0e9f..361aa83255 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useTriggerActionMenuDropdown.ts @@ -8,8 +8,8 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; export const useTriggerActionMenuDropdown = ({ recordTableId, @@ -20,7 +20,7 @@ export const useTriggerActionMenuDropdown = ({ ActionMenuComponentInstanceContext, ); - const isRowSelectedFamilyState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowSelectedFamilyState = useAtomComponentFamilyStateCallbackState( isRowSelectedComponentFamilyState, recordTableId, ); @@ -29,7 +29,7 @@ export const useTriggerActionMenuDropdown = ({ getActionMenuDropdownIdFromActionMenuId(actionMenuInstanceId); const recordIndexActionMenuDropdownPositionCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( recordIndexActionMenuDropdownPositionComponentState, actionMenuDropdownId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useUnfocusRecordTableCell.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useUnfocusRecordTableCell.ts index cce95485aa..da961955d0 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useUnfocusRecordTableCell.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/hooks/useUnfocusRecordTableCell.ts @@ -6,7 +6,7 @@ import { recordTableFocusPositionComponentState } from '@/object-record/record-t import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; import { useStore } from 'jotai'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { isDefined } from 'twenty-shared/utils'; import { useSetIsRecordTableCellFocusActive } from './useSetIsRecordTableCellFocusActive'; @@ -17,7 +17,7 @@ export const useUnfocusRecordTableCell = (recordTableId?: string) => { ); const store = useStore(); - const focusPosition = useRecoilComponentStateCallbackStateV2( + const focusPosition = useAtomComponentStateCallbackState( recordTableFocusPositionComponentState, recordTableIdFromProps, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx index b5bec75593..dc1a11a5a4 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValueCell.tsx @@ -5,9 +5,9 @@ import { RecordTableColumnAggregateFooterCellContext } from '@/object-record/rec import { RecordTableColumnAggregateFooterValue } from '@/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterValue'; import { hasAggregateOperationForViewFieldFamilySelector } from '@/object-record/record-table/record-table-footer/states/hasAggregateOperationForViewFieldFamilySelector'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useContext, useState } from 'react'; @@ -58,7 +58,7 @@ export const RecordTableColumnAggregateFooterValueCell = ({ }) => { const [isHovered, setIsHovered] = useState(false); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); @@ -68,12 +68,12 @@ export const RecordTableColumnAggregateFooterValueCell = ({ RecordTableColumnAggregateFooterCellContext, ); - const hasAggregateOperationForViewField = useFamilySelectorValueV2( + const hasAggregateOperationForViewField = useAtomFamilySelectorValue( hasAggregateOperationForViewFieldFamilySelector, { viewFieldId }, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx index 14be085972..b38c182b29 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx @@ -14,9 +14,9 @@ import { RecordTableColumnAggregateFooterCellContext } from '@/object-record/rec import { viewFieldAggregateOperationState } from '@/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; import { convertAggregateOperationToExtendedAggregateOperation } from '@/object-record/utils/convertAggregateOperationToExtendedAggregateOperation'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { useContext } from 'react'; import { FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION } from 'twenty-shared/constants'; @@ -35,15 +35,15 @@ export const useAggregateRecordsForRecordTableColumnFooter = ( const { objectMetadataItem } = useRecordTableContextOrThrow(); const { recordGroupFilter } = useRecordGroupFilter(objectMetadataItem.fields); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); const { filterValueDependencies } = useFilterValueDependencies(); @@ -66,7 +66,7 @@ export const useAggregateRecordsForRecordTableColumnFooter = ( // see problem with view id not being set early enoughby Effect component in context store, // This happens here when switching from a view to another. const aggregateOperationForViewFieldWithProbableImpossibleValues = - useFamilyRecoilValueV2(viewFieldAggregateOperationState, { viewFieldId }); + useAtomFamilyStateValue(viewFieldAggregateOperationState, { viewFieldId }); const isAggregateOperationImpossibleForDateField = isDefined(fieldMetadataItem) && @@ -96,7 +96,7 @@ export const useAggregateRecordsForRecordTableColumnFooter = ( } : {}; - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useViewFieldAggregateOperation.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useViewFieldAggregateOperation.tsx index cb511b2ab7..2bb366eaf7 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useViewFieldAggregateOperation.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useViewFieldAggregateOperation.tsx @@ -3,7 +3,7 @@ import { RecordTableColumnAggregateFooterDropdownContext } from '@/object-record import { viewFieldAggregateOperationState } from '@/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; import { convertExtendedAggregateOperationToAggregateOperation } from '@/object-record/utils/convertExtendedAggregateOperationToAggregateOperation'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { usePerformViewFieldAPIPersist } from '@/views/hooks/internal/usePerformViewFieldAPIPersist'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { useRefreshCoreViewsByObjectMetadataId } from '@/views/hooks/useRefreshCoreViewsByObjectMetadataId'; @@ -52,7 +52,7 @@ export const useViewFieldAggregateOperation = () => { refreshCoreViewsByObjectMetadataId(objectMetadataItem.id); }; - const currentViewFieldAggregateOperation = useFamilyRecoilValueV2( + const currentViewFieldAggregateOperation = useAtomFamilyStateValue( viewFieldAggregateOperationState, { viewFieldId: currentViewField?.id ?? '' }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/hasAggregateOperationForViewFieldFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/hasAggregateOperationForViewFieldFamilySelector.ts index 8f9e165f55..ae7ac75ebf 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/hasAggregateOperationForViewFieldFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/hasAggregateOperationForViewFieldFamilySelector.ts @@ -1,9 +1,9 @@ import { viewFieldAggregateOperationState } from '@/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { isDefined } from 'twenty-shared/utils'; export const hasAggregateOperationForViewFieldFamilySelector = - createFamilySelectorV2({ + createAtomFamilySelector({ key: 'hasAggregateOperationForViewField', get: ({ viewFieldId }) => diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState.ts index 91ec2dfa47..fd56f5d784 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState.ts @@ -1,7 +1,7 @@ import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const viewFieldAggregateOperationState = createFamilyStateV2< +export const viewFieldAggregateOperationState = createAtomFamilyState< ExtendedAggregateOperations | null | undefined, { viewFieldId: string } >({ diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx index 14df6cfb86..6ba7d873ce 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHead.tsx @@ -5,8 +5,8 @@ import { fieldMetadataItemByIdSelector } from '@/object-metadata/states/fieldMet import { isFieldMetadataItemLabelIdentifierSelector } from '@/object-metadata/states/isFieldMetadataItemLabelIdentifierSelector'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; import { shouldCompactRecordTableFirstColumnComponentState } from '@/object-record/record-table/states/shouldCompactRecordTableFirstColumnComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useIcons } from 'twenty-ui/display'; import { MOBILE_VIEWPORT } from 'twenty-ui/theme'; @@ -54,7 +54,7 @@ export const RecordTableColumnHead = ({ }: RecordTableColumnHeadProps) => { const theme = useTheme(); - const correspondingFieldMetadataItem = useFamilySelectorValueV2( + const correspondingFieldMetadataItem = useAtomFamilySelectorValue( fieldMetadataItemByIdSelector, { fieldMetadataItemId: recordField.fieldMetadataItemId }, ); @@ -64,12 +64,12 @@ export const RecordTableColumnHead = ({ correspondingFieldMetadataItem.foundFieldMetadataItem?.icon, ); - const isLabelIdentifier = useFamilySelectorValueV2( + const isLabelIdentifier = useAtomFamilySelectorValue( isFieldMetadataItemLabelIdentifierSelector, { fieldMetadataItemId: recordField.fieldMetadataItemId }, ); - const shouldCompactRecordTableFirstColumn = useRecoilComponentValueV2( + const shouldCompactRecordTableFirstColumn = useAtomComponentStateValue( shouldCompactRecordTableFirstColumnComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHeadDropdownMenu.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHeadDropdownMenu.tsx index 0ee1767b96..81d87d4944 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHeadDropdownMenu.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableColumnHeadDropdownMenu.tsx @@ -14,7 +14,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useToggleScrollWrapper } from '@/ui/utilities/scroll/hooks/useToggleScrollWrapper'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { IconArrowLeft, IconArrowRight, @@ -44,7 +44,7 @@ export const RecordTableColumnHeadDropdownMenu = ({ const { visibleRecordFields } = useRecordTableContextOrThrow(); - const isLabelIdentifier = useFamilySelectorValueV2( + const isLabelIdentifier = useAtomFamilySelectorValue( isFieldMetadataItemLabelIdentifierSelector, { fieldMetadataItemId: recordField.fieldMetadataItemId }, ); @@ -124,7 +124,7 @@ export const RecordTableColumnHeadDropdownMenu = ({ openRecordFilterChipFromTableHeader(recordField.fieldMetadataItemId); }; - const { isFilterable, isSortable } = useFamilySelectorValueV2( + const { isFilterable, isSortable } = useAtomFamilySelectorValue( isFieldMetadataItemFilterableAndSortableSelector, { fieldMetadataItemId: recordField.fieldMetadataItemId }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx index 8a67c55e6a..ddca7ebf69 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderAddColumnButton.tsx @@ -13,9 +13,9 @@ import { isRecordTableRowFocusActiveComponentState } from '@/object-record/recor import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState'; import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import { cx } from '@linaria/core'; import { IconPlus } from 'twenty-ui/display'; @@ -62,28 +62,28 @@ const StyledDropdownContainer = styled.div` export const RecordTableHeaderAddColumnButton = () => { const theme = useTheme(); - const isFirstRowActive = useRecoilComponentFamilyValueV2( + const isFirstRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, 0, ); - const isFirstRowFocused = useRecoilComponentFamilyValueV2( + const isFirstRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, 0, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); const isFirstRowActiveOrFocused = isFirstRowActive || (isFirstRowFocused && isRowFocusActive); - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCell.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCell.tsx index 2314d0be86..23372b4182 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCell.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCell.tsx @@ -11,9 +11,9 @@ import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/rec import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; import { resizedFieldMetadataIdComponentState } from '@/object-record/record-table/states/resizedFieldMetadataIdComponentState'; import { getRecordTableColumnFieldWidthClassName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthClassName'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { cx } from '@linaria/core'; import { isDefined } from 'twenty-shared/utils'; @@ -28,32 +28,32 @@ export const RecordTableHeaderCell = ({ }: RecordTableHeaderCellProps) => { const { objectMetadataItem } = useRecordTableContextOrThrow(); - const isFirstRowActive = useRecoilComponentFamilyValueV2( + const isFirstRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, 0, ); - const isFirstRowFocused = useRecoilComponentFamilyValueV2( + const isFirstRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, 0, ); - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); const isFirstRowActiveOrFocused = isFirstRowActive || (isFirstRowFocused && isRowFocusActive); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); - const resizedFieldMetadataItemId = useRecoilComponentValueV2( + const resizedFieldMetadataItemId = useAtomComponentStateValue( resizedFieldMetadataIdComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsx index 5ca3ff81a0..2594984a42 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderCheckboxColumn.tsx @@ -15,9 +15,9 @@ import { isRecordTableRowFocusActiveComponentState } from '@/object-record/recor import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState'; import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; import { allRowsSelectedStatusComponentSelector } from '@/object-record/record-table/states/selectors/allRowsSelectedStatusComponentSelector'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { cx } from '@linaria/core'; import { Checkbox } from 'twenty-ui/input'; @@ -49,7 +49,7 @@ const StyledColumnHeaderCell = styled.div` `; export const RecordTableHeaderCheckboxColumn = () => { - const allRowsSelectedStatus = useRecoilComponentSelectorValueV2( + const allRowsSelectedStatus = useAtomComponentSelectorValue( allRowsSelectedStatusComponentSelector, ); @@ -63,12 +63,12 @@ export const RecordTableHeaderCheckboxColumn = () => { const { recordTableId } = useRecordTableContextOrThrow(); - const isRecordTableInitialLoading = useRecoilComponentValueV2( + const isRecordTableInitialLoading = useAtomComponentStateValue( isRecordTableInitialLoadingComponentState, recordTableId, ); - const allRecordIds = useRecoilComponentSelectorValueV2( + const allRecordIds = useAtomComponentSelectorValue( recordIndexAllRecordIdsComponentSelector, recordTableId, ); @@ -84,28 +84,28 @@ export const RecordTableHeaderCheckboxColumn = () => { } }; - const isFirstRowActive = useRecoilComponentFamilyValueV2( + const isFirstRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, 0, ); - const isFirstRowFocused = useRecoilComponentFamilyValueV2( + const isFirstRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, 0, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); const isFirstRowActiveOrFocused = isFirstRowActive || (isFirstRowFocused && isRowFocusActive); - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx index f5c388c1ba..526d34c142 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderDragDropColumn.tsx @@ -6,9 +6,9 @@ import { isRecordTableRowActiveComponentFamilyState } from '@/object-record/reco import { isRecordTableRowFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableRowFocusActiveComponentState'; import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState'; import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { cx } from '@linaria/core'; import { useContext } from 'react'; @@ -36,20 +36,20 @@ const StyledDragDropHeaderCell = styled.div<{ export const RecordTableHeaderDragDropColumn = () => { const { theme } = useContext(ThemeContext); - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); - const isFirstRowActive = useRecoilComponentFamilyValueV2( + const isFirstRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, 0, ); - const isFirstRowFocused = useRecoilComponentFamilyValueV2( + const isFirstRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, 0, ); @@ -57,7 +57,7 @@ export const RecordTableHeaderDragDropColumn = () => { const isFirstRowActiveOrFocused = isFirstRowActive || (isFirstRowFocused && isRowFocusActive); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstCell.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstCell.tsx index b007c58977..13fa9466bb 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstCell.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstCell.tsx @@ -16,9 +16,9 @@ import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/rec import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; import { resizedFieldMetadataIdComponentState } from '@/object-record/record-table/states/resizedFieldMetadataIdComponentState'; import { getRecordTableColumnFieldWidthClassName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthClassName'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { cx } from '@linaria/core'; import { useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -36,34 +36,34 @@ export const RecordTableHeaderFirstCell = () => { const [iconIsVisible, setIconIsVisible] = useState(false); - const isFirstRowActive = useRecoilComponentFamilyValueV2( + const isFirstRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, 0, ); - const isFirstRowFocused = useRecoilComponentFamilyValueV2( + const isFirstRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, 0, ); const recordField = getVisibleFieldWithLowestPosition(visibleRecordFields); - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); const isFirstRowActiveOrFocused = isFirstRowActive || (isFirstRowFocused && isRowFocusActive); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); - const resizedFieldMetadataItemId = useRecoilComponentValueV2( + const resizedFieldMetadataItemId = useAtomComponentStateValue( resizedFieldMetadataIdComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstScrollableCell.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstScrollableCell.tsx index 9377f70a29..0ea7dbfcb0 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstScrollableCell.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderFirstScrollableCell.tsx @@ -15,9 +15,9 @@ import { isRecordTableScrolledHorizontallyComponentState } from '@/object-record import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; import { resizedFieldMetadataIdComponentState } from '@/object-record/record-table/states/resizedFieldMetadataIdComponentState'; import { getRecordTableColumnFieldWidthClassName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthClassName'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { cx } from '@linaria/core'; import { filterOutByProperty, isDefined } from 'twenty-shared/utils'; @@ -25,12 +25,12 @@ export const RecordTableHeaderFirstScrollableCell = () => { const { objectMetadataItem, visibleRecordFields } = useRecordTableContextOrThrow(); - const isFirstRowActive = useRecoilComponentFamilyValueV2( + const isFirstRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, 0, ); - const isFirstRowFocused = useRecoilComponentFamilyValueV2( + const isFirstRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, 0, ); @@ -44,22 +44,22 @@ export const RecordTableHeaderFirstScrollableCell = () => { ), )[0] as RecordField | undefined; - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); const isFirstRowActiveOrFocused = isFirstRowActive || (isFirstRowFocused && isRowFocusActive); - const isRecordTableScrolledVertically = useRecoilComponentValueV2( + const isRecordTableScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const isRecordTableScrolledHorizontally = useRecoilComponentValueV2( + const isRecordTableScrolledHorizontally = useAtomComponentStateValue( isRecordTableScrolledHorizontallyComponentState, ); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); @@ -89,14 +89,14 @@ export const RecordTableHeaderFirstScrollableCell = () => { const zIndex = hasRecordGroups ? zIndexWithGroups : zIndexWithoutGroups; - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); const shouldDisplayBorderBottom = hasRecordGroups || !isFirstRowActiveOrFocused || isScrolledVertically; - const resizedFieldMetadataItemId = useRecoilComponentValueV2( + const resizedFieldMetadataItemId = useAtomComponentStateValue( resizedFieldMetadataIdComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLabelIdentifierCellPlusButton.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLabelIdentifierCellPlusButton.tsx index 36888b4518..b3278c107a 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLabelIdentifierCellPlusButton.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLabelIdentifierCellPlusButton.tsx @@ -2,7 +2,7 @@ import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObje import { hasAnySoftDeleteFilterOnViewComponentSelector } from '@/object-record/record-filter/states/hasAnySoftDeleteFilterOnView'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useCreateNewIndexRecord'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import styled from '@emotion/styled'; import { IconPlus } from 'twenty-ui/display'; import { LightIconButton } from 'twenty-ui/input'; @@ -33,7 +33,7 @@ export const RecordTableHeaderLabelIdentifierCellPlusButton = () => { objectMetadataItem, }); - const hasAnySoftDeleteFilterOnView = useRecoilComponentSelectorValueV2( + const hasAnySoftDeleteFilterOnView = useAtomComponentSelectorValue( hasAnySoftDeleteFilterOnViewComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLastEmptyColumn.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLastEmptyColumn.tsx index ebd01b798f..12677f879b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLastEmptyColumn.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderLastEmptyColumn.tsx @@ -5,9 +5,9 @@ import { isRecordTableRowActiveComponentFamilyState } from '@/object-record/reco import { isRecordTableRowFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableRowFocusActiveComponentState'; import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState'; import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { cx } from '@linaria/core'; @@ -30,28 +30,28 @@ const StyledLastColumnHeader = styled.div<{ `; export const RecordTableHeaderLastEmptyColumn = () => { - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); - const isFirstRowActive = useRecoilComponentFamilyValueV2( + const isFirstRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, 0, ); - const isFirstRowFocused = useRecoilComponentFamilyValueV2( + const isFirstRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, 0, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); const isFirstRowActiveOrFocused = isFirstRowActive || (isFirstRowFocused && isRowFocusActive); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderPlusButtonContent.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderPlusButtonContent.tsx index b462721e40..84496badc4 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderPlusButtonContent.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderPlusButtonContent.tsx @@ -12,7 +12,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useLingui } from '@lingui/react/macro'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; @@ -42,7 +42,7 @@ export const RecordTableHeaderPlusButtonContent = () => { ); const location = useLocation(); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderResizeHandler.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderResizeHandler.tsx index b89532bdf6..f0d5782816 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderResizeHandler.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/components/RecordTableHeaderResizeHandler.tsx @@ -2,7 +2,7 @@ import { type RecordField } from '@/object-record/record-field/types/RecordField import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { resizedFieldMetadataIdComponentState } from '@/object-record/record-table/states/resizedFieldMetadataIdComponentState'; import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import styled from '@emotion/styled'; import { useIsMobile } from 'twenty-ui/utilities'; @@ -54,7 +54,7 @@ export const RecordTableHeaderResizeHandler = ({ const columnResizeDisabled = isMobile; const [resizedFieldMetadataItemId, setResizedFieldMetadataItemId] = - useRecoilComponentStateV2(resizedFieldMetadataIdComponentState); + useAtomComponentState(resizedFieldMetadataIdComponentState); const isResizing = recordField?.fieldMetadataItemId === resizedFieldMetadataItemId; diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useOpenRecordFilterChipFromTableHeader.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useOpenRecordFilterChipFromTableHeader.ts index 84b36578a0..0c8e1e69bf 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useOpenRecordFilterChipFromTableHeader.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useOpenRecordFilterChipFromTableHeader.ts @@ -3,7 +3,7 @@ import { useFilterableFieldMetadataItemsInRecordIndexContext } from '@/object-re import { useUpsertRecordFilter } from '@/object-record/record-filter/hooks/useUpsertRecordFilter'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { getEditableChipDropdownId } from '@/views/editable-chip/utils/getEditableChipDropdownId'; import { useSetEditableFilterChipDropdownStates } from '@/views/hooks/useSetEditableFilterChipDropdownStates'; import { isDefined } from 'twenty-shared/utils'; @@ -12,7 +12,7 @@ export const useOpenRecordFilterChipFromTableHeader = () => { const { filterableFieldMetadataItems } = useFilterableFieldMetadataItemsInRecordIndexContext(); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useResizeTableHeader.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useResizeTableHeader.ts index 92bd7e522b..4bfcc1aead 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useResizeTableHeader.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-header/hooks/useResizeTableHeader.ts @@ -16,10 +16,10 @@ import { updateRecordTableCSSVariable } from '@/object-record/record-table/utils import { useDragSelect } from '@/ui/utilities/drag-select/hooks/useDragSelect'; import { useTrackPointer } from '@/ui/utilities/pointer-event/hooks/useTrackPointer'; import { type PointerEventListener } from '@/ui/utilities/pointer-event/types/PointerEventListener'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useSaveRecordFields } from '@/views/hooks/useSaveRecordFields'; import { useStore } from 'jotai'; import { useCallback, useState } from 'react'; @@ -32,12 +32,12 @@ import { export const useResizeTableHeader = () => { const { recordTableId, visibleRecordFields } = useRecordTableContextOrThrow(); - const resizeFieldOffset = useRecoilComponentStateCallbackStateV2( + const resizeFieldOffset = useAtomComponentStateCallbackState( resizeFieldOffsetComponentState, recordTableId, ); - const setResizeFieldOffset = useSetRecoilComponentStateV2( + const setResizeFieldOffset = useSetAtomComponentState( resizeFieldOffsetComponentState, recordTableId, ); @@ -47,7 +47,7 @@ export const useResizeTableHeader = () => { >(null); const [resizedFieldMetadataItemId, setResizedFieldMetadataItemId] = - useRecoilComponentStateV2(resizedFieldMetadataIdComponentState); + useAtomComponentState(resizedFieldMetadataIdComponentState); const recordField = visibleRecordFields.find( findByProperty('fieldMetadataItemId', resizedFieldMetadataItemId), @@ -59,12 +59,12 @@ export const useResizeTableHeader = () => { const { updateRecordField } = useUpdateRecordField(); - const recordTableWidth = useRecoilComponentValueV2( + const recordTableWidth = useAtomComponentStateValue( recordTableWidthComponentState, recordTableId, ); - const shouldCompactRecordTableFirstColumn = useRecoilComponentValueV2( + const shouldCompactRecordTableFirstColumn = useAtomComponentStateValue( shouldCompactRecordTableFirstColumnComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx index 0c5d1cfcec..27bbd89834 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableDraggableTrFirstRowOfGroup.tsx @@ -8,7 +8,7 @@ import { RecordTableTr } from '@/object-record/record-table/record-table-row/com import { useIsTableRowSecondaryDragged } from '@/object-record/record-table/record-table-row/hooks/useIsRecordSecondaryDragged'; import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; type RecordTableDraggableTrFirstRowOfGroupProps = { className?: string; @@ -33,7 +33,7 @@ export const RecordTableDraggableTrFirstRowOfGroup = ({ const { isSecondaryDragged } = useIsTableRowSecondaryDragged(recordId); - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFieldsCells.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFieldsCells.tsx index 521716dfed..4857d972a6 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFieldsCells.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFieldsCells.tsx @@ -7,7 +7,7 @@ import { RecordTableCellFirstRowFirstColumn } from '@/object-record/record-table import { RecordTableCellStyleWrapper } from '@/object-record/record-table/record-table-cell/components/RecordTableCellStyleWrapper'; import { RecordTableCellWrapper } from '@/object-record/record-table/record-table-cell/components/RecordTableCellWrapper'; import { getRecordTableColumnFieldWidthClassName } from '@/object-record/record-table/utils/getRecordTableColumnFieldWidthClassName'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { isDefined, isNonEmptyArray } from 'twenty-shared/utils'; export const RecordTableFieldsCells = () => { @@ -17,7 +17,7 @@ export const RecordTableFieldsCells = () => { const { visibleRecordFields } = useRecordTableContextOrThrow(); - const hasRecordGroups = useRecoilComponentSelectorValueV2( + const hasRecordGroups = useAtomComponentSelectorValue( hasRecordGroupsComponentSelector, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFirstRowOfGroup.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFirstRowOfGroup.tsx index 4e443b1784..4386ade896 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFirstRowOfGroup.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableFirstRowOfGroup.tsx @@ -1,6 +1,6 @@ import { RecordTableRowDiv } from '@/object-record/record-table/record-table-row/components/RecordTableRowDiv'; import { isRecordTableScrolledVerticallyComponentState } from '@/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isActive } from '@tiptap/core'; import { forwardRef, type ReactNode } from 'react'; @@ -33,7 +33,7 @@ export const RecordTableFirstRowOfGroup = forwardRef< }, ref, ) => { - const isScrolledVertically = useRecoilComponentValueV2( + const isScrolledVertically = useAtomComponentStateValue( isRecordTableScrolledVerticallyComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRow.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRow.tsx index 9c778a4c33..efdd244ed6 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRow.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRow.tsx @@ -11,8 +11,8 @@ import { RecordTableRowHotkeyEffect } from '@/object-record/record-table/record- import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { isRecordTableRowFocusActiveComponentState } from '@/object-record/record-table/states/isRecordTableRowFocusActiveComponentState'; import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; type RecordTableRowProps = { recordId: string; @@ -29,11 +29,11 @@ export const RecordTableRow = ({ }: RecordTableRowProps) => { const { recordTableId } = useRecordTableContextOrThrow(); - const isFocused = useRecoilComponentFamilyValueV2( + const isFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, rowIndexForFocus, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragCounterChip.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragCounterChip.tsx index 844f688aa2..9f8b249695 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragCounterChip.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragCounterChip.tsx @@ -1,5 +1,5 @@ import { originalDragSelectionComponentState } from '@/object-record/record-drag/states/originalDragSelectionComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { NotificationCounter } from 'twenty-ui/navigation'; @@ -11,7 +11,7 @@ const StyledNotificationCounter = styled(NotificationCounter)` `; export const RecordTableRowMultiDragCounterChip = () => { - const originalDragSelection = useRecoilComponentValueV2( + const originalDragSelection = useAtomComponentStateValue( originalDragSelectionComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragPreview.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragPreview.tsx index 80cab7c066..1c6c780987 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragPreview.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableRowMultiDragPreview.tsx @@ -1,12 +1,12 @@ import { isRecordIdPrimaryDragMultipleComponentFamilyState } from '@/object-record/record-drag/states/isRecordIdPrimaryDragMultipleComponentFamilyState'; import { useRecordTableRowContextOrThrow } from '@/object-record/record-table/contexts/RecordTableRowContext'; import { RecordTableRowMultiDragCounterChip } from '@/object-record/record-table/record-table-row/components/RecordTableRowMultiDragCounterChip'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; export const RecordTableRowMultiDragPreview = () => { const { recordId } = useRecordTableRowContextOrThrow(); - const isRecordIdPrimaryDragMultiple = useRecoilComponentFamilyValueV2( + const isRecordIdPrimaryDragMultiple = useAtomComponentFamilyStateValue( isRecordIdPrimaryDragMultipleComponentFamilyState, { recordId }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableTr.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableTr.tsx index 2b2cb70f41..c63ec91c61 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableTr.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/components/RecordTableTr.tsx @@ -11,9 +11,9 @@ import { isRecordTableRowFocusActiveComponentState } from '@/object-record/recor import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState'; import { recordIdByRealIndexComponentFamilySelector } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { forwardRef, type ReactNode } from 'react'; type RecordTableTrProps = { @@ -41,41 +41,41 @@ export const RecordTableTr = forwardRef( ) => { const { objectMetadataItem } = useRecordTableContextOrThrow(); - const currentRowSelected = useRecoilComponentFamilyValueV2( + const currentRowSelected = useAtomComponentFamilyStateValue( isRowSelectedComponentFamilyState, recordId, ); - const isActive = useRecoilComponentFamilyValueV2( + const isActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, focusIndex, ); - const isNextRowActive = useRecoilComponentFamilyValueV2( + const isNextRowActive = useAtomComponentFamilyStateValue( isRecordTableRowActiveComponentFamilyState, focusIndex + 1, ); - const nextRecordId = useRecoilComponentFamilySelectorValueV2( + const nextRecordId = useAtomComponentFamilySelectorValue( recordIdByRealIndexComponentFamilySelector, focusIndex + 1, ); - const isNextRecordIdFirstOfGroup = useRecoilComponentFamilySelectorValueV2( + const isNextRecordIdFirstOfGroup = useAtomComponentFamilySelectorValue( isRecordIdFirstOfGroupComponentFamilySelector, nextRecordId ?? '', ); - const isFocused = useRecoilComponentFamilyValueV2( + const isFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, focusIndex, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, ); - const isNextRowFocused = useRecoilComponentFamilyValueV2( + const isNextRowFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, focusIndex + 1, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useIsRecordSecondaryDragged.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useIsRecordSecondaryDragged.ts index a9b2e352be..dcde8188ad 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useIsRecordSecondaryDragged.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useIsRecordSecondaryDragged.ts @@ -1,9 +1,9 @@ import { isRecordIdSecondaryDragMultipleComponentFamilyState } from '@/object-record/record-drag/states/isRecordIdSecondaryDragMultipleComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { type Nullable } from 'twenty-shared/types'; export const useIsTableRowSecondaryDragged = (recordId: Nullable) => { - const isSecondaryDragged = useRecoilComponentFamilyValueV2( + const isSecondaryDragged = useAtomComponentFamilyStateValue( isRecordIdSecondaryDragMultipleComponentFamilyState, { recordId: recordId ?? '' }, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts index 484417f8f9..8b995b8d1f 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useRecordTableRowHotkeys.ts @@ -13,8 +13,8 @@ import { isRecordTableRowFocusActiveComponentState } from '@/object-record/recor import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { Key } from 'ts-key-enum'; export const useRecordTableRowHotkeys = (focusId: string) => { @@ -27,7 +27,7 @@ export const useRecordTableRowHotkeys = (focusId: string) => { const { activateRecordTableRow } = useActiveRecordTableRow(); - const setIsRowFocusActive = useSetRecoilComponentStateV2( + const setIsRowFocusActive = useSetAtomComponentState( isRecordTableRowFocusActiveComponentState, ); @@ -86,7 +86,7 @@ export const useRecordTableRowHotkeys = (focusId: string) => { const { unfocusRecordTableRow } = useFocusedRecordTableRow(recordTableId); - const isAtLeastOneRecordSelected = useRecoilComponentSelectorValueV2( + const isAtLeastOneRecordSelected = useAtomComponentSelectorValue( isAtLeastOneTableRowSelectedSelector, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useSetCurrentRowSelected.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useSetCurrentRowSelected.ts index ec1d53a42d..3343793bc3 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useSetCurrentRowSelected.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/hooks/useSetCurrentRowSelected.ts @@ -5,24 +5,24 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record import { useRecordTableRowContextOrThrow } from '@/object-record/record-table/contexts/RecordTableRowContext'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { lastSelectedRowIndexComponentState } from '@/object-record/record-table/record-table-row/states/lastSelectedRowIndexComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { isDefined } from 'twenty-shared/utils'; export const useSetCurrentRowSelected = () => { const { recordId, rowIndex } = useRecordTableRowContextOrThrow(); - const isRowSelectedFamilyState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowSelectedFamilyState = useAtomComponentFamilyStateCallbackState( isRowSelectedComponentFamilyState, ); - const recordIndexAllRecordIds = useRecoilComponentSelectorCallbackStateV2( + const recordIndexAllRecordIds = useAtomComponentSelectorCallbackState( recordIndexAllRecordIdsComponentSelector, ); const lastSelectedRowIndexComponentCallbackState = - useRecoilComponentStateCallbackStateV2(lastSelectedRowIndexComponentState); + useAtomComponentStateCallbackState(lastSelectedRowIndexComponentState); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState.ts index 807912a443..9c3999d5a1 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const hasUserSelectedAllRowsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'hasUserSelectedAllRowsFamilyState', defaultValue: false, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isAtLeastOneTableRowSelectedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isAtLeastOneTableRowSelectedSelector.ts index 351421bb49..68638e3235 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isAtLeastOneTableRowSelectedSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isAtLeastOneTableRowSelectedSelector.ts @@ -1,10 +1,10 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const isAtLeastOneTableRowSelectedSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'isAtLeastOneTableRowSelectedSelector', componentInstanceContext: RecordTableComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRecordIdFirstOfGroupComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRecordIdFirstOfGroupComponentFamilySelector.ts index 8552f99117..a8c3d81536 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRecordIdFirstOfGroupComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRecordIdFirstOfGroupComponentFamilySelector.ts @@ -1,12 +1,12 @@ import { recordGroupIdsComponentState } from '@/object-record/record-group/states/recordGroupIdsComponentState'; import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { recordIndexRecordIdsByGroupComponentFamilyState } from '@/object-record/record-index/states/recordIndexRecordIdsByGroupComponentFamilyState'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { isDefined } from 'twenty-shared/utils'; export const isRecordIdFirstOfGroupComponentFamilySelector = - createComponentFamilySelectorV2({ + createAtomComponentFamilySelector({ key: 'isRecordIdFirstOfGroupComponentFamilySelector', componentInstanceContext: ViewComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState.ts index eb67af95bb..ccf5cdc944 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState.ts @@ -1,7 +1,7 @@ -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -export const isRowSelectedComponentFamilyState = createComponentFamilyStateV2< +export const isRowSelectedComponentFamilyState = createAtomComponentFamilyState< boolean, string >({ diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/lastSelectedRowIndexComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/lastSelectedRowIndexComponentState.ts index f38282725f..79da91a563 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/lastSelectedRowIndexComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/lastSelectedRowIndexComponentState.ts @@ -1,7 +1,7 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const lastSelectedRowIndexComponentState = createComponentStateV2< +export const lastSelectedRowIndexComponentState = createAtomComponentState< number | null | undefined >({ key: 'record-table/last-selected-row-index', diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx index 961a097374..1e95e404d8 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSection.tsx @@ -23,11 +23,11 @@ import { RECORD_TABLE_LABEL_IDENTIFIER_COLUMN_WIDTH_ON_MOBILE } from '@/object-r import { recordIndexAggregateDisplayLabelComponentState } from '@/object-record/record-index/states/recordIndexAggregateDisplayLabelComponentState'; import { recordIndexAggregateDisplayValueForGroupValueComponentFamilyState } from '@/object-record/record-index/states/recordIndexAggregateDisplayValueForGroupValueComponentFamilyState'; import { isRecordGroupTableSectionToggledComponentState } from '@/object-record/record-table/record-table-section/states/isRecordGroupTableSectionToggledComponentState'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { filterOutByProperty, findByProperty, @@ -123,24 +123,24 @@ export const RecordTableRecordGroupSection = () => { const { objectMetadataItem } = useRecordTableContextOrThrow(); - const recordGroup = useFamilyRecoilValueV2( + const recordGroup = useAtomFamilyStateValue( recordGroupDefinitionFamilyState, currentRecordGroupId, ); const recordIndexAggregateDisplayValueForGroupValue = - useRecoilComponentFamilyValueV2( + useAtomComponentFamilyStateValue( recordIndexAggregateDisplayValueForGroupValueComponentFamilyState, { groupValue: recordGroup?.value ?? '' }, ); - const recordIndexAggregateDisplayLabel = useRecoilComponentValueV2( + const recordIndexAggregateDisplayLabel = useAtomComponentStateValue( recordIndexAggregateDisplayLabelComponentState, ); const { labelIdentifierFieldMetadataItem } = useRecordIndexContextOrThrow(); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); @@ -158,7 +158,7 @@ export const RecordTableRecordGroupSection = () => { const [ isRecordGroupTableSectionToggled, setIsRecordGroupTableSectionToggled, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( isRecordGroupTableSectionToggledComponentState, currentRecordGroupId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionAddNew.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionAddNew.tsx index 15be7b5859..b425bf4155 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionAddNew.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionAddNew.tsx @@ -5,8 +5,8 @@ import { recordIndexGroupFieldMetadataItemComponentState } from '@/object-record import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { useCreateNewIndexRecord } from '@/object-record/record-table/hooks/useCreateNewIndexRecord'; import { RecordTableActionRow } from '@/object-record/record-table/record-table-row/components/RecordTableActionRow'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { IconPlus } from 'twenty-ui/display'; @@ -15,12 +15,12 @@ export const RecordTableRecordGroupSectionAddNew = () => { const currentRecordGroupId = useCurrentRecordGroupId(); - const recordGroup = useFamilyRecoilValueV2( + const recordGroup = useAtomFamilyStateValue( recordGroupDefinitionFamilyState, currentRecordGroupId, ); - const mainGroupByFieldMetadata = useRecoilComponentValueV2( + const mainGroupByFieldMetadata = useAtomComponentStateValue( recordIndexGroupFieldMetadataItemComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionLoadMore.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionLoadMore.tsx index 9b32a46d2c..9429f3e43d 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionLoadMore.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/components/RecordTableRecordGroupSectionLoadMore.tsx @@ -3,7 +3,7 @@ import { useRecordIndexTableFetchMore } from '@/object-record/record-index/hooks import { recordIndexHasFetchedAllRecordsByGroupComponentState } from '@/object-record/record-index/states/recordIndexHasFetchedAllRecordsByGroupComponentState'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { RecordTableActionRow } from '@/object-record/record-table/record-table-row/components/RecordTableActionRow'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { t } from '@lingui/core/macro'; import { IconArrowDown } from 'twenty-ui/display'; @@ -15,7 +15,7 @@ export const RecordTableRecordGroupSectionLoadMore = () => { const { fetchMoreRecordsLazy } = useRecordIndexTableFetchMore(objectNameSingular); - const hasFetchedAllRecords = useRecoilComponentFamilyValueV2( + const hasFetchedAllRecords = useAtomComponentFamilyStateValue( recordIndexHasFetchedAllRecordsByGroupComponentState, currentRecordGroupId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/states/isRecordGroupTableSectionToggledComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/states/isRecordGroupTableSectionToggledComponentState.ts index 1d6d4ec384..6d11fbde12 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-section/states/isRecordGroupTableSectionToggledComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-section/states/isRecordGroupTableSectionToggledComponentState.ts @@ -1,9 +1,9 @@ import { type RecordGroupDefinition } from '@/object-record/record-group/types/RecordGroupDefinition'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const isRecordGroupTableSectionToggledComponentState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordGroupTableSectionToggledComponentState', defaultValue: true, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/activeRecordTableRowIndexComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/activeRecordTableRowIndexComponentState.ts index 45f61f0b74..1f9a99d668 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/activeRecordTableRowIndexComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/activeRecordTableRowIndexComponentState.ts @@ -1,7 +1,7 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const activeRecordTableRowIndexComponentState = createComponentStateV2< +export const activeRecordTableRowIndexComponentState = createAtomComponentState< number | null >({ key: 'activeRecordTableRowIndexComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/focusedRecordTableRowIndexComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/focusedRecordTableRowIndexComponentState.ts index ac6ed6d88a..35b85b2a18 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/focusedRecordTableRowIndexComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/focusedRecordTableRowIndexComponentState.ts @@ -1,10 +1,9 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const focusedRecordTableRowIndexComponentState = createComponentStateV2< - number | null ->({ - key: 'focusedRecordTableRowIndexComponentState', - defaultValue: null, - componentInstanceContext: RecordTableComponentInstanceContext, -}); +export const focusedRecordTableRowIndexComponentState = + createAtomComponentState({ + key: 'focusedRecordTableRowIndexComponentState', + defaultValue: null, + componentInstanceContext: RecordTableComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableCellFocusActiveComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableCellFocusActiveComponentState.ts index 70a521fa5d..824228e764 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableCellFocusActiveComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableCellFocusActiveComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isRecordTableCellFocusActiveComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isRecordTableCellFocusActiveComponentState', defaultValue: false, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingComponentState.ts index 079be9a623..5691ef4f3a 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isRecordTableInitialLoadingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isRecordTableInitialLoadingComponentState', defaultValue: true, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowActiveComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowActiveComponentFamilyState.ts index a34384ae2e..28d7666dee 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowActiveComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowActiveComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const isRecordTableRowActiveComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordTableRowActiveComponentFamilyState', defaultValue: false, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusActiveComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusActiveComponentState.ts index 4f4d82329b..2f4e3858b9 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusActiveComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusActiveComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isRecordTableRowFocusActiveComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isRecordTableRowFocusActiveComponentState', defaultValue: false, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState.ts index 1b57f575b2..bf8fb56ec1 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableRowFocusedComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const isRecordTableRowFocusedComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isRecordTableRowFocusedComponentFamilyState', defaultValue: false, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledHorizontallyComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledHorizontallyComponentState.ts index 6b3de5ecf8..96dff63698 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledHorizontallyComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledHorizontallyComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isRecordTableScrolledHorizontallyComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isRecordTableScrolledHorizontallyComponentState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: false, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState.ts index fa3b0682d5..3f1764bc36 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableScrolledVerticallyComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isRecordTableScrolledVerticallyComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isRecordTableScrolledVerticallyComponentState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: false, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftDeleteFilterActiveComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftDeleteFilterActiveComponentState.ts index 0889083cd3..d9110c235b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftDeleteFilterActiveComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftDeleteFilterActiveComponentState.ts @@ -1,8 +1,8 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isSoftDeleteFilterActiveComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isSoftDeleteFilterActiveComponentState', defaultValue: false, componentInstanceContext: RecordFiltersComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsComponentState.ts index e0cb274347..312e07e6e0 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsComponentState.ts @@ -1,8 +1,10 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const numberOfTableRowsComponentState = createComponentStateV2({ - key: 'numberOfTableRowsComponentState', - defaultValue: 0, - componentInstanceContext: RecordTableComponentInstanceContext, -}); +export const numberOfTableRowsComponentState = createAtomComponentState( + { + key: 'numberOfTableRowsComponentState', + defaultValue: 0, + componentInstanceContext: RecordTableComponentInstanceContext, + }, +); diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableCellEditModePositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableCellEditModePositionComponentState.ts index 8267e8d606..1bc5c2fa69 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableCellEditModePositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableCellEditModePositionComponentState.ts @@ -1,9 +1,9 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordTableCellEditModePositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordTableCellEditModePositionComponentState', defaultValue: null, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableFocusPositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableFocusPositionComponentState.ts index 036f04d9c3..6dbed9f9e5 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableFocusPositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableFocusPositionComponentState.ts @@ -1,9 +1,9 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordTableFocusPositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordTableFocusPositionComponentState', defaultValue: null, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableHoverPositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableHoverPositionComponentState.ts index c14935c1b7..ea76124dbc 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableHoverPositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableHoverPositionComponentState.ts @@ -1,9 +1,9 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { type TableCellPosition } from '@/object-record/record-table/types/TableCellPosition'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const recordTableHoverPositionComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'recordTableHoverPositionComponentState', defaultValue: null, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableWidthComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableWidthComponentState.ts index d200eb6cb2..0a907ccf9e 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/recordTableWidthComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/recordTableWidthComponentState.ts @@ -1,7 +1,7 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const recordTableWidthComponentState = createComponentStateV2({ +export const recordTableWidthComponentState = createAtomComponentState({ key: 'recordTableWidthComponentState', defaultValue: 0, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetComponentState.ts index efaf9ac1cd..05692b17ce 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetComponentState.ts @@ -1,8 +1,10 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const resizeFieldOffsetComponentState = createComponentStateV2({ - key: 'resizeFieldOffsetComponentState', - defaultValue: 0, - componentInstanceContext: RecordTableComponentInstanceContext, -}); +export const resizeFieldOffsetComponentState = createAtomComponentState( + { + key: 'resizeFieldOffsetComponentState', + defaultValue: 0, + componentInstanceContext: RecordTableComponentInstanceContext, + }, +); diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/resizedFieldMetadataIdComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/resizedFieldMetadataIdComponentState.ts index 1e70922050..d43e5ef2fb 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/resizedFieldMetadataIdComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/resizedFieldMetadataIdComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type Nullable } from 'twenty-shared/types'; -export const resizedFieldMetadataIdComponentState = createComponentStateV2< +export const resizedFieldMetadataIdComponentState = createAtomComponentState< Nullable >({ key: 'resizedFieldMetadataIdComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusComponentSelector.ts index 617993e546..f078909b2f 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusComponentSelector.ts @@ -1,11 +1,11 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { selectedRowIdsComponentSelector } from '@/object-record/record-table/states/selectors/selectedRowIdsComponentSelector'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { type AllRowsSelectedStatus } from '@/object-record/record-table/types/AllRowSelectedStatus'; export const allRowsSelectedStatusComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'allRowsSelectedStatusComponentSelector', componentInstanceContext: RecordTableComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isAtLeastOneTableRowSelectedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isAtLeastOneTableRowSelectedSelector.ts index 4fe33ea12e..8bbdd7365d 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isAtLeastOneTableRowSelectedSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isAtLeastOneTableRowSelectedSelector.ts @@ -1,10 +1,10 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const isAtLeastOneTableRowSelectedSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'isAtLeastOneTableRowSelectedSelector', componentInstanceContext: RecordTableComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector.ts index ca1c91d346..47bc3c76b6 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/isSomeCellInEditModeComponentSelector.ts @@ -1,10 +1,10 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { recordTableCellEditModePositionComponentState } from '@/object-record/record-table/states/recordTableCellEditModePositionComponentState'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { isDefined } from 'twenty-shared/utils'; export const isSomeCellInEditModeComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'isSomeCellInEditModeComponentSelector', componentInstanceContext: RecordTableComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsComponentSelector.ts index 4b9ce486a5..31d84f3cdf 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsComponentSelector.ts @@ -1,9 +1,9 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; -export const selectedRowIdsComponentSelector = createComponentSelectorV2< +export const selectedRowIdsComponentSelector = createAtomComponentSelector< string[] >({ key: 'selectedRowIdsComponentSelector', diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/unselectedRowIdsComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/unselectedRowIdsComponentSelector.ts index ae9e35917b..41b6b3e433 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/unselectedRowIdsComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/unselectedRowIdsComponentSelector.ts @@ -1,9 +1,9 @@ import { recordIndexAllRecordIdsComponentSelector } from '@/object-record/record-index/states/selectors/recordIndexAllRecordIdsComponentSelector'; import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/record-table-row/states/isRowSelectedComponentFamilyState'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; -export const unselectedRowIdsComponentSelector = createComponentSelectorV2< +export const unselectedRowIdsComponentSelector = createAtomComponentSelector< string[] >({ key: 'unselectedRowIdsComponentSelector', diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/shouldCompactRecordTableFirstColumnComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/shouldCompactRecordTableFirstColumnComponentState.ts index 427bfb307a..63f556e5df 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/shouldCompactRecordTableFirstColumnComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/shouldCompactRecordTableFirstColumnComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const shouldCompactRecordTableFirstColumnComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'shouldCompactRecordTableFirstColumnComponentState', defaultValue: false, componentInstanceContext: RecordTableComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/tableWidthResizeIsActivedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/tableWidthResizeIsActivedState.ts index f7f7274aad..8a5c281009 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/states/tableWidthResizeIsActivedState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/states/tableWidthResizeIsActivedState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const tableWidthResizeIsActiveState = createStateV2({ +export const tableWidthResizeIsActiveState = createAtomState({ key: 'tableWidthResizeIsActiveState', defaultValue: true, }); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableNoRecordGroupScrollToPreviousRecordEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableNoRecordGroupScrollToPreviousRecordEffect.tsx index c86b63c181..f1d919a99c 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableNoRecordGroupScrollToPreviousRecordEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableNoRecordGroupScrollToPreviousRecordEffect.tsx @@ -6,19 +6,19 @@ import { useProcessTreadmillScrollTop } from '@/object-record/record-table/virtu import { useTriggerFetchPages } from '@/object-record/record-table/virtualization/hooks/useTriggerFetchPages'; import { useTriggerInitialRecordTableDataLoad } from '@/object-record/record-table/virtualization/hooks/useTriggerInitialRecordTableDataLoad'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { isNonEmptyString } from '@sniptt/guards'; import { useEffect, useState } from 'react'; export const RecordTableNoRecordGroupScrollToPreviousRecordEffect = () => { const { getScrollWrapperElement } = useScrollWrapperHTMLElement(); - const allRecordIds = useRecoilComponentSelectorValueV2( + const allRecordIds = useAtomComponentSelectorValue( recordIndexAllRecordIdsComponentSelector, ); - const [lastShowPageRecordId, setLastShowPageRecordId] = useRecoilStateV2( + const [lastShowPageRecordId, setLastShowPageRecordId] = useAtomState( lastShowPageRecordIdState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedContainer.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedContainer.tsx index 7b72312fd9..d52bc4ff8f 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedContainer.tsx @@ -6,8 +6,8 @@ import { TABLE_VIRTUALIZATION_DEBUG_ACTIVATED } from '@/object-record/record-tab import { realIndexByVirtualIndexComponentFamilyState } from '@/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState'; import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { styled } from '@linaria/react'; import { isDefined } from 'twenty-shared/utils'; @@ -26,14 +26,15 @@ type RecordTableRowVirtualizedContainerProps = { export const RecordTableRowVirtualizedContainer = ({ virtualIndex, }: RecordTableRowVirtualizedContainerProps) => { - const realIndex = useRecoilComponentFamilyValueV2( + const realIndex = useAtomComponentFamilyStateValue( realIndexByVirtualIndexComponentFamilyState, { virtualIndex }, ); const totalNumberOfRecordsToVirtualize = - useRecoilComponentValueV2(totalNumberOfRecordsToVirtualizeComponentState) ?? - 0; + useAtomComponentStateValue( + totalNumberOfRecordsToVirtualizeComponentState, + ) ?? 0; if (!isDefined(realIndex) || realIndex >= totalNumberOfRecordsToVirtualize) { return null; diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedDebugRowHelper.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedDebugRowHelper.tsx index be1f7f1bf8..11c269d475 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedDebugRowHelper.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedDebugRowHelper.tsx @@ -1,15 +1,15 @@ import { getLabelIdentifierFieldMetadataItem } from '@/object-metadata/utils/getLabelIdentifierFieldMetadataItem'; import { getLabelIdentifierFieldValue } from '@/object-metadata/utils/getLabelIdentifierFieldValue'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { RECORD_TABLE_ROW_HEIGHT } from '@/object-record/record-table/constants/RecordTableRowHeight'; import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { dataLoadingStatusByRealIndexComponentFamilySelector } from '@/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentFamilySelector'; import { realIndexByVirtualIndexComponentFamilyState } from '@/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState'; import { recordIdByRealIndexComponentFamilySelector } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -46,17 +46,17 @@ type RecordTableRowVirtualizedDebugRowHelperProps = { export const RecordTableRowVirtualizedDebugRowHelper = ({ virtualIndex, }: RecordTableRowVirtualizedDebugRowHelperProps) => { - const realIndex = useRecoilComponentFamilyValueV2( + const realIndex = useAtomComponentFamilyStateValue( realIndexByVirtualIndexComponentFamilyState, { virtualIndex }, ); - const recordId = useRecoilComponentFamilySelectorValueV2( + const recordId = useAtomComponentFamilySelectorValue( recordIdByRealIndexComponentFamilySelector, realIndex, ); - const dataLoadingStatus = useRecoilComponentFamilySelectorValueV2( + const dataLoadingStatus = useAtomComponentFamilySelectorValue( dataLoadingStatusByRealIndexComponentFamilySelector, realIndex, ); @@ -65,7 +65,10 @@ export const RecordTableRowVirtualizedDebugRowHelper = ({ (realIndex ?? 0) * (RECORD_TABLE_ROW_HEIGHT + 1) + (RECORD_TABLE_ROW_HEIGHT + 1); - const record = useFamilyRecoilValueV2(recordStoreFamilyState, recordId ?? ''); + const record = useAtomFamilyStateValue( + recordStoreFamilyState, + recordId ?? '', + ); const { objectMetadataItem } = useRecordTableContextOrThrow(); const labelIdentifierFieldMetadataItem = getLabelIdentifierFieldMetadataItem(objectMetadataItem); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedFullData.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedFullData.tsx index 11486e5292..8f7c40a17c 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedFullData.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedFullData.tsx @@ -12,9 +12,9 @@ import { isRecordTableRowFocusedComponentFamilyState } from '@/object-record/rec import { RecordTableRowVirtualizedSkeleton } from '@/object-record/record-table/virtualization/components/RecordTableRowVirtualizedSkeleton'; import { recordIdByRealIndexComponentFamilySelector } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; type RecordTableRowVirtualizedFullDataProps = { @@ -27,17 +27,17 @@ export const RecordTableRowVirtualizedFullData = ({ }: RecordTableRowVirtualizedFullDataProps) => { const { recordTableId } = useRecordTableContextOrThrow(); - const isFocused = useRecoilComponentFamilyValueV2( + const isFocused = useAtomComponentFamilyStateValue( isRecordTableRowFocusedComponentFamilyState, realIndex, ); - const isRowFocusActive = useRecoilComponentValueV2( + const isRowFocusActive = useAtomComponentStateValue( isRecordTableRowFocusActiveComponentState, recordTableId, ); - const recordId = useRecoilComponentFamilySelectorValueV2( + const recordId = useAtomComponentFamilySelectorValue( recordIdByRealIndexComponentFamilySelector, realIndex, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel1.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel1.tsx index 68e95670ad..34700b6151 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel1.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel1.tsx @@ -2,7 +2,7 @@ import { RecordTableRowVirtualizedRouterLevel2 } from '@/object-record/record-ta import { RecordTableRowVirtualizedSkeleton } from '@/object-record/record-table/virtualization/components/RecordTableRowVirtualizedSkeleton'; import { lowDetailsActivatedComponentState } from '@/object-record/record-table/virtualization/states/lowDetailsActivatedComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; type RecordTableRowVirtualizedRouterLevel1Props = { realIndex: number; @@ -11,7 +11,7 @@ type RecordTableRowVirtualizedRouterLevel1Props = { export const RecordTableRowVirtualizedRouterLevel1 = ({ realIndex, }: RecordTableRowVirtualizedRouterLevel1Props) => { - const lowDetailsActivated = useRecoilComponentValueV2( + const lowDetailsActivated = useAtomComponentStateValue( lowDetailsActivatedComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel2.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel2.tsx index d420a1247d..d021483e20 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel2.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableRowVirtualizedRouterLevel2.tsx @@ -3,7 +3,7 @@ import { RecordTableRowVirtualizedFullData } from '@/object-record/record-table/ import { RecordTableRowVirtualizedSkeleton } from '@/object-record/record-table/virtualization/components/RecordTableRowVirtualizedSkeleton'; import { dataLoadingStatusByRealIndexComponentFamilySelector } from '@/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentFamilySelector'; -import { useRecoilComponentFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2'; +import { useAtomComponentFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue'; type RecordTableRowVirtualizedRouterLevel2Props = { realIndex: number; @@ -12,7 +12,7 @@ type RecordTableRowVirtualizedRouterLevel2Props = { export const RecordTableRowVirtualizedRouterLevel2 = ({ realIndex, }: RecordTableRowVirtualizedRouterLevel2Props) => { - const dataLoadingStatus = useRecoilComponentFamilySelectorValueV2( + const dataLoadingStatus = useAtomComponentFamilySelectorValue( dataLoadingStatusByRealIndexComponentFamilySelector, realIndex, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedBodyPlaceholder.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedBodyPlaceholder.tsx index 54e6fe1c24..dd6d5d0cae 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedBodyPlaceholder.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedBodyPlaceholder.tsx @@ -1,7 +1,7 @@ import { RECORD_TABLE_ROW_HEIGHT } from '@/object-record/record-table/constants/RecordTableRowHeight'; import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { styled } from '@linaria/react'; import { isDefined } from 'twenty-shared/utils'; @@ -18,7 +18,7 @@ const StyledVirtualizationContainer = styled.div<{ `; export const RecordTableVirtualizedBodyPlaceholder = () => { - const totalNumberOfRecordsToVirtualize = useRecoilComponentValueV2( + const totalNumberOfRecordsToVirtualize = useAtomComponentStateValue( totalNumberOfRecordsToVirtualizeComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedDebugHelper.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedDebugHelper.tsx index f898b8ed00..d8ae8365f6 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedDebugHelper.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedDebugHelper.tsx @@ -4,11 +4,11 @@ import { } from '@/object-record/record-table/virtualization/components/RecordTableVirtualizedRowTreadmillEffect'; import { TABLE_VIRTUALIZATION_DEBUG_ACTIVATED } from '@/object-record/record-table/virtualization/constants/TableVirtualizationDebugActivated'; import { lowDetailsActivatedComponentState } from '@/object-record/record-table/virtualization/states/lowDetailsActivatedComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { createPortal } from 'react-dom'; export const RecordTableVirtualizedDebugHelper = () => { - const lowDetailsActivated = useRecoilComponentValueV2( + const lowDetailsActivated = useAtomComponentStateValue( lowDetailsActivatedComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedFieldMetadataUpdateEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedFieldMetadataUpdateEffect.tsx index d1f2b9d86d..fcf1f10d8f 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedFieldMetadataUpdateEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedFieldMetadataUpdateEffect.tsx @@ -3,9 +3,9 @@ import { visibleRecordFieldsComponentSelector } from '@/object-record/record-fie import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext'; import { useResetVirtualizationBecauseDataChanged } from '@/object-record/record-table/virtualization/hooks/useResetVirtualizationBecauseDataChanged'; import { lastProcessedFieldMetadataUpdateIdComponentState } from '@/object-record/record-table/virtualization/states/lastProcessedFieldMetadataUpdateIdComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect } from 'react'; export const RecordTableVirtualizedFieldMetadataUpdateEffect = () => { @@ -14,20 +14,18 @@ export const RecordTableVirtualizedFieldMetadataUpdateEffect = () => { const { resetVirtualizationBecauseDataChanged } = useResetVirtualizationBecauseDataChanged(objectNameSingular); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); - const lastFieldMetadataItemUpdate = useRecoilValueV2( + const lastFieldMetadataItemUpdate = useAtomStateValue( lastFieldMetadataItemUpdateState, ); const [ lastProcessedFieldMetadataUpdateId, setLastProcessedFieldMetadataUpdateId, - ] = useRecoilComponentStateV2( - lastProcessedFieldMetadataUpdateIdComponentState, - ); + ] = useAtomComponentState(lastProcessedFieldMetadataUpdateIdComponentState); useEffect(() => { if (!lastFieldMetadataItemUpdate) { diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedInitialDataLoadEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedInitialDataLoadEffect.tsx index 4d65ac56e2..29a0473355 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedInitialDataLoadEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedInitialDataLoadEffect.tsx @@ -8,9 +8,9 @@ import { lastContextStoreVirtualizedViewIdComponentState } from '@/object-record import { lastContextStoreVirtualizedVisibleRecordFieldsComponentState } from '@/object-record/record-table/virtualization/states/lastContextStoreVirtualizedVisibleRecordFieldsComponentState'; import { lastRecordTableQueryIdentifierComponentState } from '@/object-record/record-table/virtualization/states/lastRecordTableQueryIdentifierComponentState'; import { isFetchingMoreRecordsFamilyState } from '@/object-record/states/isFetchingMoreRecordsFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import isEmpty from 'lodash.isempty'; import { useEffect } from 'react'; @@ -22,16 +22,16 @@ export const RecordTableVirtualizedInitialDataLoadEffect = () => { const { queryIdentifier } = useRecordIndexTableFetchMore(objectNameSingular); const [lastRecordTableQueryIdentifier, setLastRecordTableQueryIdentifier] = - useRecoilComponentStateV2(lastRecordTableQueryIdentifierComponentState); + useAtomComponentState(lastRecordTableQueryIdentifierComponentState); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); - const [isInitializingVirtualTableDataLoading] = useRecoilComponentStateV2( + const [isInitializingVirtualTableDataLoading] = useAtomComponentState( isInitializingVirtualTableDataLoadingComponentState, ); - const isFetchingMoreRecords = useFamilyRecoilValueV2( + const isFetchingMoreRecords = useAtomFamilyStateValue( isFetchingMoreRecordsFamilyState, recordTableId, ); @@ -42,14 +42,12 @@ export const RecordTableVirtualizedInitialDataLoadEffect = () => { const [ lastContextStoreVirtualizedViewId, setLastContextStoreVirtualizedViewId, - ] = useRecoilComponentStateV2( - lastContextStoreVirtualizedViewIdComponentState, - ); + ] = useAtomComponentState(lastContextStoreVirtualizedViewIdComponentState); const [ lastContextStoreVisibleRecordFields, setLastContextStoreVisibleRecordFields, - ] = useRecoilComponentStateV2( + ] = useAtomComponentState( lastContextStoreVirtualizedVisibleRecordFieldsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedRowTreadmillEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedRowTreadmillEffect.tsx index abe9054ec5..3470f75b7d 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedRowTreadmillEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedRowTreadmillEffect.tsx @@ -10,7 +10,7 @@ import { lowDetailsActivatedComponentState } from '@/object-record/record-table/ import { scrollAtRealIndexComponentState } from '@/object-record/record-table/virtualization/states/scrollAtRealIndexComponentState'; import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useDebouncedCallback } from 'use-debounce'; export const SCROLL_SPEED_THRESHOLD_IN_ROWS_PER_SECOND_TO_ACTIVATE_LOW_DETAILS = 120; @@ -25,20 +25,19 @@ const LAST_SCROLL_DEBOUNCE_TIME = 300; export const RecordTableVirtualizedRowTreadmillEffect = () => { const { scrollWrapperHTMLElement } = useScrollWrapperHTMLElement(); - const scrollAtRealIndexCallbackState = useRecoilComponentStateCallbackStateV2( + const scrollAtRealIndexCallbackState = useAtomComponentStateCallbackState( scrollAtRealIndexComponentState, ); - const lowDetailsActivatedCallbackState = - useRecoilComponentStateCallbackStateV2(lowDetailsActivatedComponentState); + const lowDetailsActivatedCallbackState = useAtomComponentStateCallbackState( + lowDetailsActivatedComponentState, + ); const lastScrollMeasurementsCallbackState = - useRecoilComponentStateCallbackStateV2( - lastScrollMeasurementsComponentState, - ); + useAtomComponentStateCallbackState(lastScrollMeasurementsComponentState); const totalNumberOfRecordsToVirtualizeCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( totalNumberOfRecordsToVirtualizeComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedSSESubscribeEffect.tsx b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedSSESubscribeEffect.tsx index 1bf848b416..dee6cfca74 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedSSESubscribeEffect.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/components/RecordTableVirtualizedSSESubscribeEffect.tsx @@ -7,22 +7,22 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { useListenToEventsForQuery } from '@/sse-db-event/hooks/useListenToEventsForQuery'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { computeRecordGqlOperationFilter } from 'twenty-shared/utils'; export const RecordTableVirtualizedSSESubscribeEffect = () => { const { objectMetadataItem } = useRecordIndexContextOrThrow(); const { filterValueDependencies } = useFilterValueDependencies(); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useGetShouldResetTableVirtualizationForUpdateInputs.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useGetShouldResetTableVirtualizationForUpdateInputs.ts index 35bd9b341f..2173e8ecc5 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useGetShouldResetTableVirtualizationForUpdateInputs.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useGetShouldResetTableVirtualizationForUpdateInputs.ts @@ -3,7 +3,7 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { type ObjectRecordOperationUpdateInput } from '@/object-record/types/ObjectRecordOperationUpdateInput'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { FieldMetadataType } from 'twenty-shared/types'; import { mapById } from 'twenty-shared/utils'; @@ -14,11 +14,11 @@ export const useGetShouldResetTableVirtualizationForUpdateInputs = () => { objectMetadataItem, }); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useLoadRecordsToVirtualRows.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useLoadRecordsToVirtualRows.ts index 18f28e7965..cc9c1fe30f 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useLoadRecordsToVirtualRows.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useLoadRecordsToVirtualRows.ts @@ -8,28 +8,28 @@ import { isRowSelectedComponentFamilyState } from '@/object-record/record-table/ import { dataLoadingStatusByRealIndexComponentState } from '@/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentState'; import { recordIdByRealIndexComponentState } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState'; import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; export const useLoadRecordsToVirtualRows = () => { - const recordIdByRealIndex = useRecoilComponentStateCallbackStateV2( + const recordIdByRealIndex = useAtomComponentStateCallbackState( recordIdByRealIndexComponentState, ); - const dataLoadingStatusByRealIndex = useRecoilComponentStateCallbackStateV2( + const dataLoadingStatusByRealIndex = useAtomComponentStateCallbackState( dataLoadingStatusByRealIndexComponentState, ); const recordIndexRecordIdsByGroupFamilyState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( recordIndexRecordIdsByGroupComponentFamilyState, ); - const hasUserSelectedAllRows = useRecoilComponentStateCallbackStateV2( + const hasUserSelectedAllRows = useAtomComponentStateCallbackState( hasUserSelectedAllRowsComponentState, ); - const isRowSelectedFamilyState = useRecoilComponentFamilyStateCallbackStateV2( + const isRowSelectedFamilyState = useAtomComponentFamilyStateCallbackState( isRowSelectedComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useProcessTreadmillScrollTop.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useProcessTreadmillScrollTop.ts index 27ffaf61bb..3ecae7dde8 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useProcessTreadmillScrollTop.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useProcessTreadmillScrollTop.ts @@ -8,25 +8,26 @@ import { lastScrollPositionComponentState } from '@/object-record/record-table/v import { realIndexByVirtualIndexComponentFamilyState } from '@/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState'; import { scrollAtRealIndexComponentState } from '@/object-record/record-table/virtualization/states/scrollAtRealIndexComponentState'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; export const useProcessTreadmillScrollTop = () => { const { getScrollWrapperElement } = useScrollWrapperHTMLElement(); - const lastScrollPositionCallbackState = - useRecoilComponentStateCallbackStateV2(lastScrollPositionComponentState); + const lastScrollPositionCallbackState = useAtomComponentStateCallbackState( + lastScrollPositionComponentState, + ); - const lastRealIndexSetCallbackState = useRecoilComponentStateCallbackStateV2( + const lastRealIndexSetCallbackState = useAtomComponentStateCallbackState( lastRealIndexSetComponentState, ); - const scrollAtRealIndexCallbackState = useRecoilComponentStateCallbackStateV2( + const scrollAtRealIndexCallbackState = useAtomComponentStateCallbackState( scrollAtRealIndexComponentState, ); const virtualizedRowRealIndexByVirtualIndexCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( realIndexByVirtualIndexComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useReapplyRowSelection.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useReapplyRowSelection.ts index 95be7531a8..8323890d97 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useReapplyRowSelection.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useReapplyRowSelection.ts @@ -1,11 +1,11 @@ import { useSelectAllRows } from '@/object-record/record-table/hooks/internal/useSelectAllRows'; import { hasUserSelectedAllRowsComponentState } from '@/object-record/record-table/record-table-row/states/hasUserSelectedAllRowsFamilyState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useReapplyRowSelection = () => { const { selectAllRows } = useSelectAllRows(); - const hasUserSelectedAllRows = useRecoilComponentValueV2( + const hasUserSelectedAllRows = useAtomComponentStateValue( hasUserSelectedAllRowsComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetTableFocuses.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetTableFocuses.ts index 51afbca949..3e0d8b9e65 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetTableFocuses.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetTableFocuses.ts @@ -1,13 +1,13 @@ import { useFocusedRecordTableRow } from '@/object-record/record-table/hooks/useFocusedRecordTableRow'; import { useUnfocusRecordTableCell } from '@/object-record/record-table/record-table-cell/hooks/useUnfocusRecordTableCell'; import { recordTableHoverPositionComponentState } from '@/object-record/record-table/states/recordTableHoverPositionComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export const useResetTableFocuses = (recordTableId: string) => { const { unfocusRecordTableCell } = useUnfocusRecordTableCell(recordTableId); const { unfocusRecordTableRow } = useFocusedRecordTableRow(recordTableId); - const setRecordTableHoverPosition = useSetRecoilComponentStateV2( + const setRecordTableHoverPosition = useSetAtomComponentState( recordTableHoverPositionComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizationBecauseDataChanged.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizationBecauseDataChanged.ts index e70da44bad..d69c098d0b 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizationBecauseDataChanged.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizationBecauseDataChanged.ts @@ -14,7 +14,7 @@ import { recordIdByRealIndexComponentState } from '@/object-record/record-table/ import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState'; import { getVirtualizationOverscanWindow } from '@/object-record/record-table/virtualization/utils/getVirtualizationOverscanWindow'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { isDefined } from 'twenty-shared/utils'; import { sleep } from '~/utils/sleep'; @@ -41,24 +41,26 @@ export const useResetVirtualizationBecauseDataChanged = ( }); const totalNumberOfRecordsToVirtualizeCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( totalNumberOfRecordsToVirtualizeComponentState, ); - const dataPagesLoadedCallbackState = useRecoilComponentStateCallbackStateV2( + const dataPagesLoadedCallbackState = useAtomComponentStateCallbackState( dataPagesLoadedComponentState, ); const { triggerFetchPagesWithoutDebounce } = useTriggerFetchPages(); - const lastScrollPositionCallbackState = - useRecoilComponentStateCallbackStateV2(lastScrollPositionComponentState); + const lastScrollPositionCallbackState = useAtomComponentStateCallbackState( + lastScrollPositionComponentState, + ); - const recordIdByRealIndexCallbackState = - useRecoilComponentStateCallbackStateV2(recordIdByRealIndexComponentState); + const recordIdByRealIndexCallbackState = useAtomComponentStateCallbackState( + recordIdByRealIndexComponentState, + ); const dataLoadingStatusByRealIndexCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( dataLoadingStatusByRealIndexComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizedRowTreadmill.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizedRowTreadmill.ts index 5465236ed4..6321c5e591 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizedRowTreadmill.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useResetVirtualizedRowTreadmill.ts @@ -3,12 +3,12 @@ import { useStore } from 'jotai'; import { NUMBER_OF_VIRTUALIZED_ROWS } from '@/object-record/record-table/virtualization/constants/NumberOfVirtualizedRows'; import { realIndexByVirtualIndexComponentFamilyState } from '@/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState'; -import { useRecoilComponentFamilyStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2'; +import { useAtomComponentFamilyStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState'; import { getContiguousIncrementalValues } from 'twenty-shared/utils'; export const useResetVirtualizedRowTreadmill = () => { const realIndexByVirtualIndexCallbackState = - useRecoilComponentFamilyStateCallbackStateV2( + useAtomComponentFamilyStateCallbackState( realIndexByVirtualIndexComponentFamilyState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerFetchPages.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerFetchPages.ts index 5bfb6d0fc8..7dcf15e307 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerFetchPages.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerFetchPages.ts @@ -13,7 +13,7 @@ import { lowDetailsActivatedComponentState } from '@/object-record/record-table/ import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState'; import { getVirtualizationOverscanWindow } from '@/object-record/record-table/virtualization/utils/getVirtualizationOverscanWindow'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { getContiguousIncrementalValues, isDefined } from 'twenty-shared/utils'; import { useDebouncedCallback } from 'use-debounce'; @@ -30,14 +30,15 @@ export const useTriggerFetchPages = () => { const { loadRecordsToVirtualRows } = useLoadRecordsToVirtualRows(); const totalNumberOfRecordsToVirtualizeCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( totalNumberOfRecordsToVirtualizeComponentState, ); - const lastScrollPositionCallbackState = - useRecoilComponentStateCallbackStateV2(lastScrollPositionComponentState); + const lastScrollPositionCallbackState = useAtomComponentStateCallbackState( + lastScrollPositionComponentState, + ); - const dataPagesLoadedCallbackState = useRecoilComponentStateCallbackStateV2( + const dataPagesLoadedCallbackState = useAtomComponentStateCallbackState( dataPagesLoadedComponentState, ); @@ -45,8 +46,9 @@ export const useTriggerFetchPages = () => { objectNameSingular, }); - const lowDetailsActivatedCallbackState = - useRecoilComponentStateCallbackStateV2(lowDetailsActivatedComponentState); + const lowDetailsActivatedCallbackState = useAtomComponentStateCallbackState( + lowDetailsActivatedComponentState, + ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerInitialRecordTableDataLoad.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerInitialRecordTableDataLoad.ts index ea661f8f0c..655fb4e714 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerInitialRecordTableDataLoad.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/hooks/useTriggerInitialRecordTableDataLoad.ts @@ -26,11 +26,11 @@ import { totalNumberOfRecordsToVirtualizeComponentState } from '@/object-record/ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { SIGN_IN_BACKGROUND_MOCK_COMPANIES } from '@/sign-in-background-mock/constants/SignInBackgroundMockCompanies'; import { useShowAuthModal } from '@/ui/layout/hooks/useShowAuthModal'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { dataLoadingStatusByRealIndexComponentState } from '@/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentState'; import { recordIdByRealIndexComponentState } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useRecoilComponentSelectorCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomComponentSelectorCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState'; import { isDefined } from 'twenty-shared/utils'; export const useTriggerInitialRecordTableDataLoad = () => { @@ -42,50 +42,52 @@ export const useTriggerInitialRecordTableDataLoad = () => { useRecordIndexTableFetchMore(objectNameSingular); const isInitializingVirtualTableDataLoadingCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( isInitializingVirtualTableDataLoadingComponentState, ); - const dataPagesLoadedCallbackState = useRecoilComponentStateCallbackStateV2( + const dataPagesLoadedCallbackState = useAtomComponentStateCallbackState( dataPagesLoadedComponentState, ); - const isRecordTableInitialLoading = useRecoilComponentStateCallbackStateV2( + const isRecordTableInitialLoading = useAtomComponentStateCallbackState( isRecordTableInitialLoadingComponentState, recordTableId, ); - const recordIndexAllRecordIds = useRecoilComponentSelectorCallbackStateV2( + const recordIndexAllRecordIds = useAtomComponentSelectorCallbackState( recordIndexAllRecordIdsComponentSelector, recordTableId, ); const store = useStore(); - const recordIdByRealIndexCallbackState = - useRecoilComponentStateCallbackStateV2(recordIdByRealIndexComponentState); + const recordIdByRealIndexCallbackState = useAtomComponentStateCallbackState( + recordIdByRealIndexComponentState, + ); const dataLoadingStatusByRealIndexCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( dataLoadingStatusByRealIndexComponentState, ); - const setIsRecordTableScrolledHorizontally = useSetRecoilComponentStateV2( + const setIsRecordTableScrolledHorizontally = useSetAtomComponentState( isRecordTableScrolledHorizontallyComponentState, ); - const setIsRecordTableScrolledVertically = useSetRecoilComponentStateV2( + const setIsRecordTableScrolledVertically = useSetAtomComponentState( isRecordTableScrolledVerticallyComponentState, ); - const lastScrollPositionCallbackState = - useRecoilComponentStateCallbackStateV2(lastScrollPositionComponentState); + const lastScrollPositionCallbackState = useAtomComponentStateCallbackState( + lastScrollPositionComponentState, + ); - const lastRealIndexSetCallbackState = useRecoilComponentStateCallbackStateV2( + const lastRealIndexSetCallbackState = useAtomComponentStateCallbackState( lastRealIndexSetComponentState, ); - const scrollAtRealIndexCallbackState = useRecoilComponentStateCallbackStateV2( + const scrollAtRealIndexCallbackState = useAtomComponentStateCallbackState( scrollAtRealIndexComponentState, ); @@ -101,7 +103,7 @@ export const useTriggerInitialRecordTableDataLoad = () => { const { reapplyRowSelection } = useReapplyRowSelection(); const totalNumberOfRecordsToVirtualizeCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( totalNumberOfRecordsToVirtualizeComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentFamilySelector.ts index 4b9ac665a9..795987bc4a 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentFamilySelector.ts @@ -1,11 +1,11 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { dataLoadingStatusByRealIndexComponentState } from '@/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentState'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; import { type Nullable } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const dataLoadingStatusByRealIndexComponentFamilySelector = - createComponentFamilySelectorV2< + createAtomComponentFamilySelector< 'loaded' | 'not-loaded' | undefined, Nullable >({ diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentState.ts index cbb41a9b0a..22864d3055 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataLoadingStatusByRealIndexComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const dataLoadingStatusByRealIndexComponentState = - createComponentStateV2>({ + createAtomComponentState>({ key: 'dataLoadingStatusByRealIndexComponentState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: new Map(), diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataPagesLoadedComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataPagesLoadedComponentState.ts index ac3ab0be22..1189289670 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataPagesLoadedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/dataPagesLoadedComponentState.ts @@ -1,8 +1,10 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const dataPagesLoadedComponentState = createComponentStateV2({ - key: 'dataPagesLoadedComponentState', - componentInstanceContext: RecordTableComponentInstanceContext, - defaultValue: [], -}); +export const dataPagesLoadedComponentState = createAtomComponentState( + { + key: 'dataPagesLoadedComponentState', + componentInstanceContext: RecordTableComponentInstanceContext, + defaultValue: [], + }, +); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/isInitializingVirtualTableDataLoadingComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/isInitializingVirtualTableDataLoadingComponentState.ts index 8c2987d870..bddbbfe186 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/isInitializingVirtualTableDataLoadingComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/isInitializingVirtualTableDataLoadingComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isInitializingVirtualTableDataLoadingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isInitializingVirtualTableDataLoadingComponentState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: false, diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedViewIdComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedViewIdComponentState.ts index b07968c730..d33d20b2c5 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedViewIdComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedViewIdComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const lastContextStoreVirtualizedViewIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'lastContextStoreVirtualizedViewIdComponentState', componentInstanceContext: ContextStoreComponentInstanceContext, defaultValue: null, diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedVisibleRecordFieldsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedVisibleRecordFieldsComponentState.ts index 06446fa023..342217d8e2 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedVisibleRecordFieldsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastContextStoreVirtualizedVisibleRecordFieldsComponentState.ts @@ -1,9 +1,9 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const lastContextStoreVirtualizedVisibleRecordFieldsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'lastContextStoreVirtualizedVisibleRecordFieldsComponentState', componentInstanceContext: ContextStoreComponentInstanceContext, defaultValue: null, diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastProcessedFieldMetadataUpdateIdComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastProcessedFieldMetadataUpdateIdComponentState.ts index 21a67abe4f..c97d8894b9 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastProcessedFieldMetadataUpdateIdComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastProcessedFieldMetadataUpdateIdComponentState.ts @@ -1,8 +1,8 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const lastProcessedFieldMetadataUpdateIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'lastProcessedFieldMetadataUpdateIdComponentState', componentInstanceContext: ContextStoreComponentInstanceContext, defaultValue: null, diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRealIndexSetComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRealIndexSetComponentState.ts index fb1d6e6c0a..f544ffcd85 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRealIndexSetComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRealIndexSetComponentState.ts @@ -1,7 +1,7 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const lastRealIndexSetComponentState = createComponentStateV2< +export const lastRealIndexSetComponentState = createAtomComponentState< number | null >({ key: 'lastRealIndexSetComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRecordTableQueryIdentifierComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRecordTableQueryIdentifierComponentState.ts index 5a0ac360db..40bc8a7687 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRecordTableQueryIdentifierComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastRecordTableQueryIdentifierComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const lastRecordTableQueryIdentifierComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'lastRecordTableQueryIdentifierComponentState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: '', diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollMeasurementsComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollMeasurementsComponentState.ts index 78c17a6ebb..28843df6b2 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollMeasurementsComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollMeasurementsComponentState.ts @@ -1,12 +1,12 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export type ScrollMeasurement = { scrollToTop: number; timestamp: number; }; -export const lastScrollMeasurementsComponentState = createComponentStateV2< +export const lastScrollMeasurementsComponentState = createAtomComponentState< ScrollMeasurement[] >({ key: 'lastScrollMeasurementsComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollPositionComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollPositionComponentState.ts index 3fd988e067..73e50fe56d 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollPositionComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lastScrollPositionComponentState.ts @@ -1,8 +1,9 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const lastScrollPositionComponentState = createComponentStateV2({ - key: 'lastScrollPositionComponentState', - componentInstanceContext: RecordTableComponentInstanceContext, - defaultValue: 0, -}); +export const lastScrollPositionComponentState = + createAtomComponentState({ + key: 'lastScrollPositionComponentState', + componentInstanceContext: RecordTableComponentInstanceContext, + defaultValue: 0, + }); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lowDetailsActivatedComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lowDetailsActivatedComponentState.ts index 09a3ae3e73..1c2ab2cc3e 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lowDetailsActivatedComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/lowDetailsActivatedComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const lowDetailsActivatedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'lowDetailsActivatedComponentState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: false, diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState.ts index 3149a0a0f2..ed7050bfb5 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/realIndexByVirtualIndexComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const realIndexByVirtualIndexComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'realIndexByVirtualIndexComponentFamilyState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: null, diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector.ts index 9414c6b2b4..ce097558d7 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentFamilySelector.ts @@ -1,11 +1,11 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { recordIdByRealIndexComponentState } from '@/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState'; -import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2'; +import { createAtomComponentFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector'; import { type Nullable } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const recordIdByRealIndexComponentFamilySelector = - createComponentFamilySelectorV2, Nullable>({ + createAtomComponentFamilySelector, Nullable>({ key: 'recordIdByRealIndexComponentFamilySelector', componentInstanceContext: RecordTableComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState.ts index eb31f1525a..c59bd1a7a9 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/recordIdByRealIndexComponentState.ts @@ -1,7 +1,7 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const recordIdByRealIndexComponentState = createComponentStateV2< +export const recordIdByRealIndexComponentState = createAtomComponentState< Map >({ key: 'recordIdByRealIndexComponentState', diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/scrollAtRealIndexComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/scrollAtRealIndexComponentState.ts index 835f797ac4..7194dfb6eb 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/scrollAtRealIndexComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/scrollAtRealIndexComponentState.ts @@ -1,8 +1,10 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const scrollAtRealIndexComponentState = createComponentStateV2({ - key: 'scrollAtRealIndexComponentState', - componentInstanceContext: RecordTableComponentInstanceContext, - defaultValue: 0, -}); +export const scrollAtRealIndexComponentState = createAtomComponentState( + { + key: 'scrollAtRealIndexComponentState', + componentInstanceContext: RecordTableComponentInstanceContext, + defaultValue: 0, + }, +); diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/tableHasAnyFilterOrSortComponentSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/tableHasAnyFilterOrSortComponentSelector.ts index 963ac6f22a..e3ccc0c92a 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/tableHasAnyFilterOrSortComponentSelector.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/tableHasAnyFilterOrSortComponentSelector.ts @@ -1,10 +1,10 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; export const tableHasAnyFilterOrSortComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'tableHasAnyFilterOrSortComponentSelector', componentInstanceContext: RecordTableComponentInstanceContext, get: diff --git a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState.ts b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState.ts index 63ac311018..ac671dab94 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-table/virtualization/states/totalNumberOfRecordsToVirtualizeComponentState.ts @@ -1,8 +1,8 @@ import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const totalNumberOfRecordsToVirtualizeComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'totalNumberOfRecordsToVirtualizeComponentState', componentInstanceContext: RecordTableComponentInstanceContext, defaultValue: null, diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellContainer.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellContainer.tsx index 2210d23479..74a6464462 100644 --- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellContainer.tsx +++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellContainer.tsx @@ -1,6 +1,6 @@ import { RecordTitleCellContext } from '@/object-record/record-title-cell/components/RecordTitleCellContext'; import { isTitleCellInEditModeComponentState } from '@/object-record/record-title-cell/states/isTitleCellInEditModeComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -9,7 +9,7 @@ export const RecordTitleCellContainer = () => { RecordTitleCellContext, ); - const isTitleCellInEditMode = useRecoilComponentValueV2( + const isTitleCellInEditMode = useAtomComponentStateValue( isTitleCellInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldDisplay.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldDisplay.tsx index 5ddbe5b0ae..bf8acf8b68 100644 --- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldDisplay.tsx +++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellTextFieldDisplay.tsx @@ -1,6 +1,6 @@ import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useRecordTitleCell } from '@/object-record/record-title-cell/hooks/useRecordTitleCell'; import { type RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType'; import { getRecordFieldInputInstanceId } from '@/object-record/utils/getRecordFieldInputId'; @@ -39,7 +39,7 @@ export const RecordTitleCellSingleTextDisplayMode = ({ }) => { const { recordId, fieldDefinition } = useContext(FieldContext); - const recordValue = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const recordValue = useAtomFamilyStateValue(recordStoreFamilyState, recordId); const isEmpty = recordValue?.[fieldDefinition.metadata.fieldName]?.trim() === ''; diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellUuidFieldDisplay.tsx b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellUuidFieldDisplay.tsx index e9ac4aa845..edd2e3821f 100644 --- a/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellUuidFieldDisplay.tsx +++ b/packages/twenty-front/src/modules/object-record/record-title-cell/components/RecordTitleCellUuidFieldDisplay.tsx @@ -1,6 +1,6 @@ import { FieldContext } from '@/object-record/record-field/ui/contexts/FieldContext'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { type RecordTitleCellContainerType } from '@/object-record/record-title-cell/types/RecordTitleCellContainerType'; import styled from '@emotion/styled'; import { useContext } from 'react'; @@ -27,7 +27,7 @@ export const RecordTitleCellUuidFieldDisplay = ({ }) => { const { recordId, fieldDefinition } = useContext(FieldContext); - const recordValue = useFamilyRecoilValueV2(recordStoreFamilyState, recordId); + const recordValue = useAtomFamilyStateValue(recordStoreFamilyState, recordId); const uuidValue = recordValue?.[fieldDefinition.metadata.fieldName] ?? ''; diff --git a/packages/twenty-front/src/modules/object-record/record-title-cell/states/isTitleCellInEditModeComponentState.ts b/packages/twenty-front/src/modules/object-record/record-title-cell/states/isTitleCellInEditModeComponentState.ts index 0732c92c92..cfbfd92fb9 100644 --- a/packages/twenty-front/src/modules/object-record/record-title-cell/states/isTitleCellInEditModeComponentState.ts +++ b/packages/twenty-front/src/modules/object-record/record-title-cell/states/isTitleCellInEditModeComponentState.ts @@ -1,8 +1,8 @@ import { RecordTitleCellComponentInstanceContext } from '@/object-record/record-title-cell/states/contexts/RecordTitleCellComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isTitleCellInEditModeComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isTitleCellInEditModeComponentState', defaultValue: false, componentInstanceContext: RecordTitleCellComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/__tests__/useUpdateMultipleRecordsActions.test.ts b/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/__tests__/useUpdateMultipleRecordsActions.test.ts index 083d8f7ce0..f1415e2b82 100644 --- a/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/__tests__/useUpdateMultipleRecordsActions.test.ts +++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/__tests__/useUpdateMultipleRecordsActions.test.ts @@ -1,7 +1,7 @@ import { computeContextStoreFilters } from '@/context-store/utils/computeContextStoreFilters'; import { useIncrementalUpdateManyRecords } from '@/object-record/hooks/useIncrementalUpdateManyRecords'; import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { renderHook } from '@testing-library/react'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; @@ -11,7 +11,7 @@ jest.mock('@/context-store/utils/computeContextStoreFilters'); jest.mock('@/object-record/hooks/useIncrementalUpdateManyRecords'); jest.mock('@/object-record/record-filter/hooks/useFilterValueDependencies'); jest.mock('@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'); -jest.mock('@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'); +jest.mock('@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'); const mockComputeContextStoreFilters = jest.mocked(computeContextStoreFilters); const mockUseIncrementalUpdateManyRecords = jest.mocked( @@ -21,7 +21,7 @@ const mockUseFilterValueDependencies = jest.mocked(useFilterValueDependencies); const mockUseContextStoreObjectMetadataItemOrThrow = jest.mocked( useContextStoreObjectMetadataItemOrThrow, ); -const mockUseRecoilComponentValueV2 = jest.mocked(useRecoilComponentValueV2); +const mockUseRecoilComponentValueV2 = jest.mocked(useAtomComponentStateValue); describe('useUpdateMultipleRecordsActions', () => { const mockIncrementalUpdateManyRecords = jest.fn(); diff --git a/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/useUpdateMultipleRecordsActions.ts b/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/useUpdateMultipleRecordsActions.ts index e8845ca589..4a824e7fff 100644 --- a/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/useUpdateMultipleRecordsActions.ts +++ b/packages/twenty-front/src/modules/object-record/record-update-multiple/hooks/useUpdateMultipleRecordsActions.ts @@ -6,7 +6,7 @@ import { contextStoreTargetedRecordsRuleComponentState } from '@/context-store/s import { computeContextStoreFilters } from '@/context-store/utils/computeContextStoreFilters'; import { useIncrementalUpdateManyRecords } from '@/object-record/hooks/useIncrementalUpdateManyRecords'; import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; type UseUpdateMultipleRecordsActionsProps = { objectNameSingular: string; @@ -21,22 +21,22 @@ export const useUpdateMultipleRecordsActions = ({ contextStoreInstanceId, ); - const contextStoreTargetedRecordsRule = useRecoilComponentValueV2( + const contextStoreTargetedRecordsRule = useAtomComponentStateValue( contextStoreTargetedRecordsRuleComponentState, contextStoreInstanceId, ); - const contextStoreFilters = useRecoilComponentValueV2( + const contextStoreFilters = useAtomComponentStateValue( contextStoreFiltersComponentState, contextStoreInstanceId, ); - const contextStoreFilterGroups = useRecoilComponentValueV2( + const contextStoreFilterGroups = useAtomComponentStateValue( contextStoreFilterGroupsComponentState, contextStoreInstanceId, ); - const contextStoreAnyFieldFilterValue = useRecoilComponentValueV2( + const contextStoreAnyFieldFilterValue = useAtomComponentStateValue( contextStoreAnyFieldFilterValueComponentState, contextStoreInstanceId, ); diff --git a/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx b/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx index 3acf67a49d..c787eb462a 100644 --- a/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx +++ b/packages/twenty-front/src/modules/object-record/select/components/MultipleSelectDropdown.tsx @@ -9,7 +9,7 @@ import { SelectableListItem } from '@/ui/layout/selectable-list/components/Selec import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { Avatar } from 'twenty-ui/display'; import { MenuItem, MenuItemMultiSelectAvatar } from 'twenty-ui/navigation'; @@ -39,7 +39,7 @@ export const MultipleSelectDropdown = ({ const { resetSelectedItem } = useSelectableList(selectableListId); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, selectableListId, ); diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts index 6787f3376c..9ddd335b34 100644 --- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts +++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useBuildSpreadSheetImportFields.ts @@ -14,7 +14,7 @@ import { type SpreadsheetImportField, type SpreadsheetImportFields, } from '@/spreadsheet-import/types'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { assertUnreachable, getUniqueConstraintsFields, @@ -25,7 +25,7 @@ import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql'; export const useBuildSpreadsheetImportFields = () => { const { getIcon } = useIcons(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const buildSpreadsheetImportFields = ( fieldMetadataItems: FieldMetadataItem[], diff --git a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts index 3594fcdbb4..8b83a5f0c5 100644 --- a/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts +++ b/packages/twenty-front/src/modules/object-record/spreadsheet-import/hooks/useOpenObjectRecordsSpreadsheetImportDialog.ts @@ -11,7 +11,7 @@ import { useOpenSpreadsheetImportDialog } from '@/spreadsheet-import/hooks/useOp import { spreadsheetImportCreatedRecordsProgressState } from '@/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState'; import { type SpreadsheetImportDialogOptions } from '@/spreadsheet-import/types'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useOpenObjectRecordsSpreadsheetImportDialog = ( objectNameSingular: string, @@ -26,7 +26,7 @@ export const useOpenObjectRecordsSpreadsheetImportDialog = ( objectNameSingular, }); - const setCreatedRecordsProgress = useSetRecoilStateV2( + const setCreatedRecordsProgress = useSetAtomState( spreadsheetImportCreatedRecordsProgressState, ); diff --git a/packages/twenty-front/src/modules/object-record/states/cursorFamilyState.ts b/packages/twenty-front/src/modules/object-record/states/cursorFamilyState.ts index c347976175..c8c4c24d6f 100644 --- a/packages/twenty-front/src/modules/object-record/states/cursorFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/states/cursorFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const cursorFamilyState = createFamilyStateV2< +export const cursorFamilyState = createAtomFamilyState< string, string | undefined >({ diff --git a/packages/twenty-front/src/modules/object-record/states/hasNextPageFamilyState.ts b/packages/twenty-front/src/modules/object-record/states/hasNextPageFamilyState.ts index 54d5192be5..44837cec1f 100644 --- a/packages/twenty-front/src/modules/object-record/states/hasNextPageFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/states/hasNextPageFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const hasNextPageFamilyState = createFamilyStateV2< +export const hasNextPageFamilyState = createAtomFamilyState< boolean, string | undefined >({ diff --git a/packages/twenty-front/src/modules/object-record/states/isFetchingMoreRecordsFamilyState.ts b/packages/twenty-front/src/modules/object-record/states/isFetchingMoreRecordsFamilyState.ts index ccec150e07..9aa5c20efd 100644 --- a/packages/twenty-front/src/modules/object-record/states/isFetchingMoreRecordsFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/states/isFetchingMoreRecordsFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const isFetchingMoreRecordsFamilyState = createFamilyStateV2< +export const isFetchingMoreRecordsFamilyState = createAtomFamilyState< boolean, string | undefined >({ diff --git a/packages/twenty-front/src/modules/object-record/states/isRecordBoardColumnLoadingFamilyState.ts b/packages/twenty-front/src/modules/object-record/states/isRecordBoardColumnLoadingFamilyState.ts index 90143c4825..1f6086c722 100644 --- a/packages/twenty-front/src/modules/object-record/states/isRecordBoardColumnLoadingFamilyState.ts +++ b/packages/twenty-front/src/modules/object-record/states/isRecordBoardColumnLoadingFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const isRecordIndexBoardColumnLoadingFamilyState = createFamilyStateV2< +export const isRecordIndexBoardColumnLoadingFamilyState = createAtomFamilyState< boolean, string | undefined >({ diff --git a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useOnboardingStatus.test.ts b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useOnboardingStatus.test.ts index efc5d41a42..b2325fd958 100644 --- a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useOnboardingStatus.test.ts +++ b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useOnboardingStatus.test.ts @@ -8,7 +8,7 @@ import { currentUserState, } from '@/auth/states/currentUserState'; import { tokenPairState } from '@/auth/states/tokenPairState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus'; import { OnboardingStatus } from '~/generated-metadata/graphql'; @@ -36,8 +36,8 @@ const renderHooks = () => { const { result } = renderHook( () => { const onboardingStatus = useOnboardingStatus(); - const setCurrentUser = useSetRecoilStateV2(currentUserState); - const setTokenPair = useSetRecoilStateV2(tokenPairState); + const setCurrentUser = useSetAtomState(currentUserState); + const setTokenPair = useSetAtomState(tokenPairState); return { onboardingStatus, diff --git a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useSetNextOnboardingStatus.test.ts b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useSetNextOnboardingStatus.test.ts index d04a3c84f4..628c366ae9 100644 --- a/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useSetNextOnboardingStatus.test.ts +++ b/packages/twenty-front/src/modules/onboarding/hooks/__tests__/useSetNextOnboardingStatus.test.ts @@ -8,8 +8,8 @@ import { currentUserState } from '@/auth/states/currentUserState'; import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { useSetNextOnboardingStatus } from '@/onboarding/hooks/useSetNextOnboardingStatus'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { jotaiStore, resetJotaiStore, @@ -40,11 +40,11 @@ const renderHooks = ( ) => { const { result } = renderHook( () => { - const [currentUser, setCurrentUser] = useRecoilStateV2(currentUserState); - const setCurrentUserWorkspace = useSetRecoilStateV2( + const [currentUser, setCurrentUser] = useAtomState(currentUserState); + const setCurrentUserWorkspace = useSetAtomState( currentUserWorkspaceState, ); - const setCurrentWorkspace = useSetRecoilStateV2(currentWorkspaceState); + const setCurrentWorkspace = useSetAtomState(currentWorkspaceState); const setNextOnboardingStatus = useSetNextOnboardingStatus(); return { currentUser, diff --git a/packages/twenty-front/src/modules/onboarding/hooks/useOnboardingStatus.ts b/packages/twenty-front/src/modules/onboarding/hooks/useOnboardingStatus.ts index fd5357d320..186bfd2875 100644 --- a/packages/twenty-front/src/modules/onboarding/hooks/useOnboardingStatus.ts +++ b/packages/twenty-front/src/modules/onboarding/hooks/useOnboardingStatus.ts @@ -1,10 +1,10 @@ import { useIsLogged } from '@/auth/hooks/useIsLogged'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type OnboardingStatus } from '~/generated-metadata/graphql'; export const useOnboardingStatus = (): OnboardingStatus | null | undefined => { - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const isLoggedIn = useIsLogged(); return isLoggedIn ? currentUser?.onboardingStatus : undefined; }; diff --git a/packages/twenty-front/src/modules/onboarding/hooks/useSetNextOnboardingStatus.ts b/packages/twenty-front/src/modules/onboarding/hooks/useSetNextOnboardingStatus.ts index 591bb6af77..68a0413f57 100644 --- a/packages/twenty-front/src/modules/onboarding/hooks/useSetNextOnboardingStatus.ts +++ b/packages/twenty-front/src/modules/onboarding/hooks/useSetNextOnboardingStatus.ts @@ -10,7 +10,7 @@ import { } from '@/auth/states/currentWorkspaceState'; import { calendarBookingPageIdState } from '@/client-config/states/calendarBookingPageIdState'; import { usePermissionFlagMap } from '@/settings/roles/hooks/usePermissionFlagMap'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useCallback } from 'react'; import { @@ -64,9 +64,9 @@ const getNextOnboardingStatus = ({ export const useSetNextOnboardingStatus = () => { const store = useStore(); - const currentUser = useRecoilValueV2(currentUserState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const calendarBookingPageId = useRecoilValueV2(calendarBookingPageIdState); + const currentUser = useAtomStateValue(currentUserState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const calendarBookingPageId = useAtomStateValue(calendarBookingPageIdState); const permissionMap = usePermissionFlagMap(); const isAccountSyncEnabled = permissionMap[PermissionFlagType.CONNECTED_ACCOUNTS]; diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutContent.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutContent.tsx index 7676eb3dd9..cb74e76055 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutContent.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutContent.tsx @@ -7,14 +7,14 @@ import { useCurrentPageLayoutOrThrow } from '@/page-layout/hooks/useCurrentPageL import { usePageLayoutTabWithVisibleWidgetsOrThrow } from '@/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow'; import { useReorderPageLayoutWidgets } from '@/page-layout/hooks/useReorderPageLayoutWidgets'; import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { PageLayoutTabLayoutMode, PageLayoutType, } from '~/generated-metadata/graphql'; export const PageLayoutContent = () => { - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx index d669fcc5ae..fb610670bf 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridLayout.tsx @@ -24,8 +24,8 @@ import { filterPendingPlaceholderFromLayouts } from '@/page-layout/utils/filterP import { prepareGridLayoutItemsWithPlaceholders } from '@/page-layout/utils/prepareGridLayoutItemsWithPlaceholders'; import { WidgetPlaceholder } from '@/page-layout/widgets/components/WidgetPlaceholder'; import { WidgetRenderer } from '@/page-layout/widgets/components/WidgetRenderer'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { css } from '@emotion/react'; import styled from '@emotion/styled'; import { useMemo, useRef } from 'react'; @@ -100,15 +100,15 @@ type PageLayoutGridLayoutProps = { }; export const PageLayoutGridLayout = ({ tabId }: PageLayoutGridLayoutProps) => { - const setPageLayoutCurrentBreakpoint = useSetRecoilComponentStateV2( + const setPageLayoutCurrentBreakpoint = useSetAtomComponentState( pageLayoutCurrentBreakpointComponentState, ); - const setDraggingWidgetId = useSetRecoilComponentStateV2( + const setDraggingWidgetId = useSetAtomComponentState( pageLayoutDraggingWidgetIdComponentState, ); - const setResizingWidgetId = useSetRecoilComponentStateV2( + const setResizingWidgetId = useSetAtomComponentState( pageLayoutResizingWidgetIdComponentState, ); @@ -126,18 +126,18 @@ export const PageLayoutGridLayout = ({ tabId }: PageLayoutGridLayoutProps) => { const gridContainerRef = useRef(null); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); - const pageLayoutCurrentLayouts = useRecoilComponentValueV2( + const pageLayoutCurrentLayouts = useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, ); - const pageLayoutDraggedArea = useRecoilComponentValueV2( + const pageLayoutDraggedArea = useAtomComponentStateValue( pageLayoutDraggedAreaComponentState, ); - const draggingWidgetId = useRecoilComponentValueV2( + const draggingWidgetId = useAtomComponentStateValue( pageLayoutDraggingWidgetIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridOverlay.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridOverlay.tsx index 480c15d0a4..498cd365d3 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridOverlay.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutGridOverlay.tsx @@ -8,7 +8,7 @@ import { calculateGridCellPosition } from '@/page-layout/utils/calculateGridCell import { calculateTotalGridRows } from '@/page-layout/utils/calculateTotalGridRows'; import { generateCellId } from '@/page-layout/utils/generateCellId'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { useMemo } from 'react'; @@ -48,19 +48,19 @@ const StyledGridCell = styled.div<{ isSelected?: boolean }>` `; export const PageLayoutGridOverlay = () => { - const pageLayoutCurrentBreakpoint = useRecoilComponentValueV2( + const pageLayoutCurrentBreakpoint = useAtomComponentStateValue( pageLayoutCurrentBreakpointComponentState, ); - const pageLayoutSelectedCells = useRecoilComponentValueV2( + const pageLayoutSelectedCells = useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, ); - const pageLayoutCurrentLayouts = useRecoilComponentValueV2( + const pageLayoutCurrentLayouts = useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, ); - const activeTabId = useRecoilComponentValueV2(activeTabIdComponentState); + const activeTabId = useAtomComponentStateValue(activeTabIdComponentState); const { createWidgetFromClick } = useCreateWidgetFromClick(); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsx index ae868c2210..5985a0d8df 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutInitializationQueryEffect.tsx @@ -6,8 +6,8 @@ import { pageLayoutIsInitializedComponentState } from '@/page-layout/states/page import { pageLayoutPersistedComponentState } from '@/page-layout/states/pageLayoutPersistedComponentState'; import { type PageLayout } from '@/page-layout/types/PageLayout'; import { convertPageLayoutToTabLayouts } from '@/page-layout/utils/convertPageLayoutToTabLayouts'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useStore } from 'jotai'; import { useCallback, useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -22,7 +22,7 @@ export const PageLayoutInitializationQueryEffect = ({ pageLayoutId, onInitialized, }: PageLayoutInitializationQueryEffectProps) => { - const [isInitialized, setIsInitialized] = useRecoilComponentStateV2( + const [isInitialized, setIsInitialized] = useAtomComponentState( pageLayoutIsInitializedComponentState, ); @@ -31,15 +31,13 @@ export const PageLayoutInitializationQueryEffect = ({ const pageLayout = usePageLayoutWithRelationWidgets(basePageLayout); const pageLayoutPersistedComponentCallbackState = - useRecoilComponentStateCallbackStateV2(pageLayoutPersistedComponentState); + useAtomComponentStateCallbackState(pageLayoutPersistedComponentState); const pageLayoutDraftComponentCallbackState = - useRecoilComponentStateCallbackStateV2(pageLayoutDraftComponentState); + useAtomComponentStateCallbackState(pageLayoutDraftComponentState); const pageLayoutCurrentLayoutsComponentCallbackState = - useRecoilComponentStateCallbackStateV2( - pageLayoutCurrentLayoutsComponentState, - ); + useAtomComponentStateCallbackState(pageLayoutCurrentLayoutsComponentState); const store = useStore(); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRelationWidgetsSyncEffect.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRelationWidgetsSyncEffect.tsx index aac9ea256d..e51a3be83e 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRelationWidgetsSyncEffect.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRelationWidgetsSyncEffect.tsx @@ -8,8 +8,8 @@ import { type PageLayout } from '@/page-layout/types/PageLayout'; import { convertPageLayoutToTabLayouts } from '@/page-layout/utils/convertPageLayoutToTabLayouts'; import { injectRelationWidgetsIntoLayout } from '@/page-layout/utils/injectRelationWidgetsIntoLayout'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useStore } from 'jotai'; import { useCallback, useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -25,7 +25,7 @@ export const PageLayoutRelationWidgetsSyncEffect = ({ }: PageLayoutRelationWidgetsSyncEffectProps) => { const { targetRecordIdentifier, layoutType } = useLayoutRenderingContext(); - const isInitialized = useRecoilComponentValueV2( + const isInitialized = useAtomComponentStateValue( pageLayoutIsInitializedComponentState, ); @@ -36,15 +36,13 @@ export const PageLayoutRelationWidgetsSyncEffect = ({ }); const pageLayoutPersistedComponentCallbackState = - useRecoilComponentStateCallbackStateV2(pageLayoutPersistedComponentState); + useAtomComponentStateCallbackState(pageLayoutPersistedComponentState); const pageLayoutDraftComponentCallbackState = - useRecoilComponentStateCallbackStateV2(pageLayoutDraftComponentState); + useAtomComponentStateCallbackState(pageLayoutDraftComponentState); const pageLayoutCurrentLayoutsComponentCallbackState = - useRecoilComponentStateCallbackStateV2( - pageLayoutCurrentLayoutsComponentState, - ); + useAtomComponentStateCallbackState(pageLayoutCurrentLayoutsComponentState); const store = useStore(); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx index fdd337efb6..adb32ce234 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutRendererContent.tsx @@ -18,8 +18,8 @@ import { sortTabsByPosition } from '@/page-layout/utils/sortTabsByPosition'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { CommandMenuPages } from 'twenty-shared/types'; @@ -55,15 +55,15 @@ export const PageLayoutRendererContent = () => { const { isInRightDrawer, layoutType, targetRecordIdentifier } = useLayoutRenderingContext(); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); - const activeTabId = useRecoilComponentValueV2(activeTabIdComponentState); + const activeTabId = useAtomComponentStateValue(activeTabIdComponentState); const { createPageLayoutTab } = useCreatePageLayoutTab(currentPageLayout?.id); const { reorderTabs } = useReorderPageLayoutTabs(currentPageLayout?.id ?? ''); - const setTabSettingsOpenTabId = useSetRecoilComponentStateV2( + const setTabSettingsOpenTabId = useSetAtomComponentState( pageLayoutTabSettingsOpenTabIdComponentState, ); const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsx index 0e91af5c9f..bbb26a2ae0 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabList.tsx @@ -24,8 +24,8 @@ import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/con import { type TabListProps } from '@/ui/layout/tab-list/types/TabListProps'; import { NodeDimension } from '@/ui/utilities/dimensions/components/NodeDimension'; import { useClickOutsideListener } from '@/ui/utilities/pointer-event/hooks/useClickOutsideListener'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; import { PAGE_LAYOUT_TAB_LIST_DROPPABLE_IDS } from '@/page-layout/components/PageLayoutTabListDroppableIds'; @@ -43,7 +43,7 @@ import { shouldEnableTabEditingFeatures } from '@/page-layout/utils/shouldEnable import { TabListFromUrlOptionalEffect } from '@/ui/layout/tab-list/components/TabListFromUrlOptionalEffect'; import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { CommandMenuPages } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { type PageLayoutType } from '~/generated-metadata/graphql'; @@ -115,7 +115,7 @@ export const PageLayoutTabList = ({ const navigate = useNavigate(); - const [activeTabId, setActiveTabId] = useRecoilComponentStateV2( + const [activeTabId, setActiveTabId] = useAtomComponentState( activeTabIdComponentState, componentInstanceId, ); @@ -143,7 +143,7 @@ export const PageLayoutTabList = ({ const { openDropdown } = useOpenDropdown(); const { toggleClickOutside } = useClickOutsideListener(dropdownId); - const setIsTabDragging = useSetRecoilComponentStateV2( + const setIsTabDragging = useSetAtomComponentState( isPageLayoutTabDraggingComponentState, componentInstanceId, ); @@ -178,11 +178,10 @@ export const PageLayoutTabList = ({ closeDropdown(dropdownId); }, [closeDropdown, dropdownId]); - const setPageLayoutTabListCurrentDragDroppableId = - useSetRecoilComponentStateV2( - pageLayoutTabListCurrentDragDroppableIdComponentState, - pageLayoutId, - ); + const setPageLayoutTabListCurrentDragDroppableId = useSetAtomComponentState( + pageLayoutTabListCurrentDragDroppableIdComponentState, + pageLayoutId, + ); const handleDragUpdate: OnDragUpdateResponder = (update) => { setPageLayoutTabListCurrentDragDroppableId(update.destination?.droppableId); @@ -220,15 +219,15 @@ export const PageLayoutTabList = ({ [onReorder, setIsTabDragging, toggleClickOutside, openDropdown, dropdownId], ); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, pageLayoutId, ); - const tabSettingsOpenTabId = useRecoilComponentValueV2( + const tabSettingsOpenTabId = useAtomComponentStateValue( pageLayoutTabSettingsOpenTabIdComponentState, pageLayoutId, ); - const setTabSettingsOpenTabId = useSetRecoilComponentStateV2( + const setTabSettingsOpenTabId = useSetAtomComponentState( pageLayoutTabSettingsOpenTabIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx index 961c76520d..782af52011 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListEffect.tsx @@ -4,7 +4,7 @@ import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingC import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { type TabListProps } from '@/ui/layout/tab-list/types/TabListProps'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useEffect } from 'react'; type PageLayoutTabListEffectProps = Pick< @@ -21,7 +21,7 @@ export const PageLayoutTabListEffect = ({ componentInstanceId, defaultTabToFocusOnMobileAndSidePanelId, }: PageLayoutTabListEffectProps) => { - const [activeTabId, setActiveTabId] = useRecoilComponentStateV2( + const [activeTabId, setActiveTabId] = useAtomComponentState( activeTabIdComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx index fe18594b3f..8445e7ed28 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableOverflowDropdown.tsx @@ -25,8 +25,8 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Gene import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext'; import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; import { type PageLayoutType } from '~/generated-metadata/graphql'; @@ -73,7 +73,7 @@ export const PageLayoutTabListReorderableOverflowDropdown = ({ PageLayoutComponentInstanceContext, ); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, pageLayoutId, ); @@ -81,17 +81,17 @@ export const PageLayoutTabListReorderableOverflowDropdown = ({ const shouldShowEditButton = isPageLayoutInEditMode && shouldEnableTabEditingFeatures(pageLayoutType); - const isTabDragging = useRecoilComponentValueV2( + const isTabDragging = useAtomComponentStateValue( isPageLayoutTabDraggingComponentState, instanceId, ); - const setIsTabDragging = useSetRecoilComponentStateV2( + const setIsTabDragging = useSetAtomComponentState( isPageLayoutTabDraggingComponentState, instanceId, ); - const setTabSettingsOpenTabId = useSetRecoilComponentStateV2( + const setTabSettingsOpenTabId = useSetAtomComponentState( pageLayoutTabSettingsOpenTabIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsx index 179b58a551..f8d4ea6a55 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabListReorderableTab.tsx @@ -2,7 +2,7 @@ import { Draggable } from '@hello-pangea/dnd'; import { pageLayoutTabSettingsOpenTabIdComponentState } from '@/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState'; import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { StyledTabContainer, TabContent } from 'twenty-ui/input'; @@ -27,7 +27,7 @@ export const PageLayoutTabListReorderableTab = ({ disabled, onSelect, }: PageLayoutTabListReorderableTabProps) => { - const tabSettingsOpenTabId = useRecoilComponentValueV2( + const tabSettingsOpenTabId = useAtomComponentStateValue( pageLayoutTabSettingsOpenTabIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx index f0514f4af0..9b4025f584 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutTabRenderClone.tsx @@ -3,7 +3,7 @@ import { pageLayoutTabListCurrentDragDroppableIdComponentState } from '@/page-la import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { TabAvatar } from '@/ui/layout/tab-list/components/TabAvatar'; import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { type DraggableProvided } from '@hello-pangea/dnd'; @@ -30,7 +30,7 @@ export const PageLayoutTabRenderClone = ({ }) => { const theme = useTheme(); - const pageLayoutTabListCurrentDragDroppableId = useRecoilComponentValueV2( + const pageLayoutTabListCurrentDragDroppableId = useAtomComponentStateValue( pageLayoutTabListCurrentDragDroppableIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx b/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx index c0ad1128d3..de9bdbc177 100644 --- a/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx +++ b/packages/twenty-front/src/modules/page-layout/components/PageLayoutVerticalListEditor.tsx @@ -5,7 +5,7 @@ import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { WidgetRenderer } from '@/page-layout/widgets/components/WidgetRenderer'; import { useIsInPinnedTab } from '@/page-layout/widgets/hooks/useIsInPinnedTab'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { DragDropContext, @@ -61,7 +61,7 @@ export const PageLayoutVerticalListEditor = ({ isInRightDrawer, }); - const setDraggingWidgetId = useSetRecoilComponentStateV2( + const setDraggingWidgetId = useSetAtomComponentState( pageLayoutDraggingWidgetIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useChangePageLayoutDragSelection.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useChangePageLayoutDragSelection.test.tsx index 42378ce040..664edd0c90 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useChangePageLayoutDragSelection.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useChangePageLayoutDragSelection.test.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { act, renderHook } from '@testing-library/react'; import { createStore } from 'jotai'; import { type ReactNode } from 'react'; @@ -24,7 +24,7 @@ describe('useChangePageLayoutDragSelection', () => { changeDragSelection: useChangePageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -67,7 +67,7 @@ describe('useChangePageLayoutDragSelection', () => { changeDragSelection: useChangePageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -102,7 +102,7 @@ describe('useChangePageLayoutDragSelection', () => { changeDragSelection: useChangePageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -145,7 +145,7 @@ describe('useChangePageLayoutDragSelection', () => { changeDragSelection: useChangePageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutGraphWidget.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutGraphWidget.test.tsx index 3197b21a02..e53202650d 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutGraphWidget.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutGraphWidget.test.tsx @@ -3,8 +3,8 @@ import { pageLayoutCurrentLayoutsComponentState } from '@/page-layout/states/pag import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { type GraphWidgetFieldSelection } from '@/page-layout/types/GraphWidgetFieldSelection'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { act, renderHook } from '@testing-library/react'; import { useSetAtom } from 'jotai'; import { isDefined } from 'twenty-shared/utils'; @@ -35,16 +35,16 @@ describe('useCreatePageLayoutGraphWidget', () => { instanceId: `${PAGE_LAYOUT_TEST_INSTANCE_ID}-tab-list`, }), ); - const setPageLayoutDraft = useSetRecoilComponentStateV2( + const setPageLayoutDraft = useSetAtomComponentState( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); - const pageLayoutDraft = useRecoilComponentValueV2( + const pageLayoutDraft = useAtomComponentStateValue( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); const allWidgets = pageLayoutDraft.tabs.flatMap((tab) => tab.widgets); - const pageLayoutCurrentLayouts = useRecoilComponentValueV2( + const pageLayoutCurrentLayouts = useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); @@ -109,7 +109,7 @@ describe('useCreatePageLayoutGraphWidget', () => { it('should handle different graph types', () => { const { result } = renderHook( () => { - const setPageLayoutDraft = useSetRecoilComponentStateV2( + const setPageLayoutDraft = useSetAtomComponentState( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); @@ -118,12 +118,12 @@ describe('useCreatePageLayoutGraphWidget', () => { instanceId: `${PAGE_LAYOUT_TEST_INSTANCE_ID}-tab-list`, }), ); - const pageLayoutDraft = useRecoilComponentValueV2( + const pageLayoutDraft = useAtomComponentStateValue( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); const allWidgets = pageLayoutDraft.tabs.flatMap((tab) => tab.widgets); - const pageLayoutCurrentLayouts = useRecoilComponentValueV2( + const pageLayoutCurrentLayouts = useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutTab.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutTab.test.tsx index 89fee35707..e4e7142b94 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutTab.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreatePageLayoutTab.test.tsx @@ -2,8 +2,8 @@ import { useCreatePageLayoutTab } from '@/page-layout/hooks/useCreatePageLayoutT import { pageLayoutCurrentLayoutsComponentState } from '@/page-layout/states/pageLayoutCurrentLayoutsComponentState'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { act, renderHook } from '@testing-library/react'; import { useSetAtom } from 'jotai'; import { PageLayoutType } from '~/generated-metadata/graphql'; @@ -28,11 +28,11 @@ describe('useCreatePageLayoutTab', () => { const { result } = renderHook( () => ({ createTab: useCreatePageLayoutTab(PAGE_LAYOUT_TEST_INSTANCE_ID), - pageLayoutDraft: useRecoilComponentValueV2( + pageLayoutDraft: useAtomComponentStateValue( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), - pageLayoutCurrentLayouts: useRecoilComponentValueV2( + pageLayoutCurrentLayouts: useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -70,7 +70,7 @@ describe('useCreatePageLayoutTab', () => { const { result } = renderHook( () => ({ createTab: useCreatePageLayoutTab(PAGE_LAYOUT_TEST_INSTANCE_ID), - pageLayoutDraft: useRecoilComponentValueV2( + pageLayoutDraft: useAtomComponentStateValue( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -98,7 +98,7 @@ describe('useCreatePageLayoutTab', () => { const { result } = renderHook( () => ({ createTab: useCreatePageLayoutTab(PAGE_LAYOUT_TEST_INSTANCE_ID), - pageLayoutDraft: useRecoilComponentValueV2( + pageLayoutDraft: useAtomComponentStateValue( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -134,7 +134,7 @@ describe('useCreatePageLayoutTab', () => { const { result } = renderHook( () => ({ createTab: useCreatePageLayoutTab(PAGE_LAYOUT_TEST_INSTANCE_ID), - pageLayoutCurrentLayouts: useRecoilComponentValueV2( + pageLayoutCurrentLayouts: useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -174,7 +174,7 @@ describe('useCreatePageLayoutTab', () => { const { result } = renderHook( () => { - const getActiveTabId = useRecoilComponentValueV2( + const getActiveTabId = useAtomComponentStateValue( activeTabIdComponentState, `${PAGE_LAYOUT_TEST_INSTANCE_ID}-tab-list`, ); @@ -203,11 +203,11 @@ describe('useCreatePageLayoutTab', () => { const { result } = renderHook( () => { - const setPageLayoutDraft = useSetRecoilComponentStateV2( + const setPageLayoutDraft = useSetAtomComponentState( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); - const pageLayoutDraft = useRecoilComponentValueV2( + const pageLayoutDraft = useAtomComponentStateValue( pageLayoutDraftComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx index 1f86654861..f9d89093dd 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useCreateWidgetFromClick.test.tsx @@ -2,7 +2,7 @@ import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layo import { useCreateWidgetFromClick } from '@/page-layout/hooks/useCreateWidgetFromClick'; import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { act, renderHook } from '@testing-library/react'; import { type ReactNode } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; @@ -29,11 +29,11 @@ describe('useCreateWidgetFromClick', () => { const { result } = renderHook( () => ({ createWidget: useCreateWidgetFromClick(), - draggedArea: useRecoilComponentValueV2( + draggedArea: useAtomComponentStateValue( pageLayoutDraggedAreaComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), - editingWidgetId: useRecoilComponentValueV2( + editingWidgetId: useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx index 8470dc6495..c14ecb9a71 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useEndPageLayoutDragSelection.test.tsx @@ -3,7 +3,7 @@ import { useEndPageLayoutDragSelection } from '@/page-layout/hooks/useEndPageLay import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutSelectedCellsComponentState } from '@/page-layout/states/pageLayoutSelectedCellsComponentState'; import { calculateGridBoundsFromSelectedCells } from '@/page-layout/utils/calculateGridBoundsFromSelectedCells'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { act, renderHook } from '@testing-library/react'; import { createStore } from 'jotai'; import { type ReactNode } from 'react'; @@ -66,11 +66,11 @@ describe('useEndPageLayoutDragSelection', () => { endDragSelection: useEndPageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), - draggedArea: useRecoilComponentValueV2( + draggedArea: useAtomComponentStateValue( pageLayoutDraggedAreaComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -117,11 +117,11 @@ describe('useEndPageLayoutDragSelection', () => { endDragSelection: useEndPageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), - draggedArea: useRecoilComponentValueV2( + draggedArea: useAtomComponentStateValue( pageLayoutDraggedAreaComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -155,11 +155,11 @@ describe('useEndPageLayoutDragSelection', () => { endDragSelection: useEndPageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), - draggedArea: useRecoilComponentValueV2( + draggedArea: useAtomComponentStateValue( pageLayoutDraggedAreaComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -211,7 +211,7 @@ describe('useEndPageLayoutDragSelection', () => { endDragSelection: useEndPageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -245,7 +245,7 @@ describe('useEndPageLayoutDragSelection', () => { endDragSelection: useEndPageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx index 41e022f2b3..015822ee5e 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/usePageLayoutHandleLayoutChange.test.tsx @@ -1,5 +1,5 @@ import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { act, renderHook } from '@testing-library/react'; import { useSetAtom } from 'jotai'; import { pageLayoutCurrentLayoutsComponentState } from '@/page-layout/states/pageLayoutCurrentLayoutsComponentState'; @@ -14,7 +14,7 @@ describe('usePageLayoutHandleLayoutChange', () => { const { result } = renderHook( () => ({ handler: usePageLayoutHandleLayoutChange(PAGE_LAYOUT_TEST_INSTANCE_ID), - layouts: useRecoilComponentValueV2( + layouts: useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -57,7 +57,7 @@ describe('usePageLayoutHandleLayoutChange', () => { const { result } = renderHook( () => ({ handler: usePageLayoutHandleLayoutChange(PAGE_LAYOUT_TEST_INSTANCE_ID), - layouts: useRecoilComponentValueV2( + layouts: useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -92,7 +92,7 @@ describe('usePageLayoutHandleLayoutChange', () => { const { result } = renderHook( () => ({ handler: usePageLayoutHandleLayoutChange(PAGE_LAYOUT_TEST_INSTANCE_ID), - layouts: useRecoilComponentValueV2( + layouts: useAtomComponentStateValue( pageLayoutCurrentLayoutsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), diff --git a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useStartPageLayoutDragSelection.test.tsx b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useStartPageLayoutDragSelection.test.tsx index e95ad75e53..f719f15773 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useStartPageLayoutDragSelection.test.tsx +++ b/packages/twenty-front/src/modules/page-layout/hooks/__tests__/useStartPageLayoutDragSelection.test.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { act, renderHook } from '@testing-library/react'; import { createStore } from 'jotai'; import { type ReactNode } from 'react'; @@ -32,7 +32,7 @@ describe('useStartPageLayoutDragSelection', () => { startDragSelection: useStartPageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), @@ -78,7 +78,7 @@ describe('useStartPageLayoutDragSelection', () => { startDragSelection: useStartPageLayoutDragSelection( PAGE_LAYOUT_TEST_INSTANCE_ID, ), - selectedCells: useRecoilComponentValueV2( + selectedCells: useAtomComponentStateValue( pageLayoutSelectedCellsComponentState, PAGE_LAYOUT_TEST_INSTANCE_ID, ), diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useBasePageLayout.ts b/packages/twenty-front/src/modules/page-layout/hooks/useBasePageLayout.ts index 0d3d2c45ce..0de3352e00 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useBasePageLayout.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useBasePageLayout.ts @@ -20,7 +20,7 @@ import { DEFAULT_WORKFLOW_VERSION_PAGE_LAYOUT_ID } from '@/page-layout/constants import { recordPageLayoutFromIdFamilySelector } from '@/page-layout/states/selectors/recordPageLayoutFromIdFamilySelector'; import { type PageLayout } from '@/page-layout/types/PageLayout'; import { transformPageLayout } from '@/page-layout/utils/transformPageLayout'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useQuery } from '@apollo/client'; import { isDefined } from 'twenty-shared/utils'; @@ -64,7 +64,7 @@ export const useBasePageLayout = ( ): PageLayout | undefined => { const isDefaultLayout = isDefaultLayoutId(pageLayoutId); - const cachedRecordPageLayout = useFamilySelectorValueV2( + const cachedRecordPageLayout = useAtomFamilySelectorValue( recordPageLayoutFromIdFamilySelector, { pageLayoutId }, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useChangePageLayoutDragSelection.ts b/packages/twenty-front/src/modules/page-layout/hooks/useChangePageLayoutDragSelection.ts index 0ae9b0a72d..c68f2d2b65 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useChangePageLayoutDragSelection.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useChangePageLayoutDragSelection.ts @@ -1,6 +1,6 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { pageLayoutSelectedCellsComponentState } from '@/page-layout/states/pageLayoutSelectedCellsComponentState'; @@ -13,7 +13,7 @@ export const useChangePageLayoutDragSelection = ( pageLayoutIdFromProps, ); - const pageLayoutSelectedCellsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutSelectedCellsState = useAtomComponentStateCallbackState( pageLayoutSelectedCellsComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutFrontComponentWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutFrontComponentWidget.ts index eb54473879..69a5c8365c 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutFrontComponentWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutFrontComponentWidget.ts @@ -11,8 +11,8 @@ import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTab import { getUpdatedTabLayouts } from '@/page-layout/utils/getUpdatedTabLayouts'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -27,22 +27,22 @@ export const useCreatePageLayoutFrontComponentWidget = ( pageLayoutIdFromProps, ); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, getTabListInstanceIdFromPageLayoutId(pageLayoutId), ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraggedAreaState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( pageLayoutDraggedAreaComponentState, pageLayoutId, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts index da0f5cce1d..4ae3691cc9 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutGraphWidget.ts @@ -15,7 +15,7 @@ import { getWidgetSize } from '@/page-layout/utils/getWidgetSize'; import { getWidgetTitle } from '@/page-layout/utils/getWidgetTitle'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -39,17 +39,17 @@ export const useCreatePageLayoutGraphWidget = ( const tabListInstanceId = getTabListInstanceIdFromPageLayoutId(pageLayoutId); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraggedAreaState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( pageLayoutDraggedAreaComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutIframeWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutIframeWidget.ts index c57ae88da5..58672455ce 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutIframeWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutIframeWidget.ts @@ -11,8 +11,8 @@ import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTab import { getUpdatedTabLayouts } from '@/page-layout/utils/getUpdatedTabLayouts'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -27,22 +27,22 @@ export const useCreatePageLayoutIframeWidget = ( pageLayoutIdFromProps, ); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, getTabListInstanceIdFromPageLayoutId(pageLayoutId), ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraggedAreaState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( pageLayoutDraggedAreaComponentState, pageLayoutId, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutStandaloneRichTextWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutStandaloneRichTextWidget.ts index 2c414be6c7..9f33c1f87f 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutStandaloneRichTextWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutStandaloneRichTextWidget.ts @@ -10,7 +10,7 @@ import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTab import { getUpdatedTabLayouts } from '@/page-layout/utils/getUpdatedTabLayouts'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -32,17 +32,17 @@ export const useCreatePageLayoutStandaloneRichTextWidget = ( const store = useStore(); const tabListInstanceId = getTabListInstanceIdFromPageLayoutId(pageLayoutId); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraggedAreaState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( pageLayoutDraggedAreaComponentState, pageLayoutId, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutTab.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutTab.ts index 1c555ab62b..8be01aff1e 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutTab.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreatePageLayoutTab.ts @@ -6,8 +6,8 @@ import { getEmptyTabLayout } from '@/page-layout/utils/getEmptyTabLayout'; import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { v4 as uuidv4 } from 'uuid'; @@ -18,18 +18,18 @@ export const useCreatePageLayoutTab = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); const tabListInstanceId = getTabListInstanceIdFromPageLayoutId(pageLayoutId); - const setActiveTabId = useSetRecoilComponentStateV2( + const setActiveTabId = useSetAtomComponentState( activeTabIdComponentState, tabListInstanceId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts index 6b19cb75a4..83fd4f9d98 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCreateWidgetFromClick.ts @@ -2,17 +2,17 @@ import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layo import { pageLayoutDraggedAreaComponentState } from '@/page-layout/states/pageLayoutDraggedAreaComponentState'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { parseCellIdToCoordinates } from '@/page-layout/utils/parseCellIdToCoordinates'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; export const useCreateWidgetFromClick = () => { - const pageLayoutDraggedAreaState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( pageLayoutDraggedAreaComponentState, ); - const pageLayoutEditingWidgetIdState = useRecoilComponentStateCallbackStateV2( + const pageLayoutEditingWidgetIdState = useAtomComponentStateCallbackState( pageLayoutEditingWidgetIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useCurrentPageLayout.ts b/packages/twenty-front/src/modules/page-layout/hooks/useCurrentPageLayout.ts index 3fcc34d29f..621d6d70db 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useCurrentPageLayout.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useCurrentPageLayout.ts @@ -1,18 +1,18 @@ import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutPersistedComponentState } from '@/page-layout/states/pageLayoutPersistedComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const useCurrentPageLayout = () => { - const pageLayoutPersisted = useRecoilComponentValueV2( + const pageLayoutPersisted = useAtomComponentStateValue( pageLayoutPersistedComponentState, ); - const pageLayoutDraft = useRecoilComponentValueV2( + const pageLayoutDraft = useAtomComponentStateValue( pageLayoutDraftComponentState, ); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutTab.ts b/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutTab.ts index f960c4b42b..78f7c512e9 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutTab.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutTab.ts @@ -6,7 +6,7 @@ import { removeTabLayouts } from '@/page-layout/utils/removeTabLayouts'; import { sortTabsByPosition } from '@/page-layout/utils/sortTabsByPosition'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -16,12 +16,12 @@ export const useDeletePageLayoutTab = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts index c2670fa1c4..be0775cc49 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useDeletePageLayoutWidget.ts @@ -1,7 +1,7 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -16,12 +16,12 @@ export const useDeletePageLayoutWidget = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts b/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts index b6ecb3e50b..8dcab8c72f 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutTab.ts @@ -12,8 +12,8 @@ import { sortTabsByPosition } from '@/page-layout/utils/sortTabsByPosition'; import { calculateNewPosition } from '@/ui/layout/draggable-list/utils/calculateNewPosition'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { appendCopySuffix, isDefined } from 'twenty-shared/utils'; @@ -25,12 +25,12 @@ export const useDuplicatePageLayoutTab = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const pageLayoutDraft = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraft = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutCurrentLayouts = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayouts = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); @@ -38,12 +38,12 @@ export const useDuplicatePageLayoutTab = (pageLayoutIdFromProps?: string) => { const store = useStore(); const tabListInstanceId = getTabListInstanceIdFromPageLayoutId(pageLayoutId); - const setActiveTabId = useSetRecoilComponentStateV2( + const setActiveTabId = useSetAtomComponentState( activeTabIdComponentState, tabListInstanceId, ); - const setTabSettingsOpenTabId = useSetRecoilComponentStateV2( + const setTabSettingsOpenTabId = useSetAtomComponentState( pageLayoutTabSettingsOpenTabIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutWidget.ts index 7d63cff9b8..c8ba2ccf9b 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useDuplicatePageLayoutWidget.ts @@ -9,8 +9,8 @@ import { getScrollWrapperInstanceIdFromPageLayoutId } from '@/page-layout/utils/ import { getUpdatedTabLayouts } from '@/page-layout/utils/getUpdatedTabLayouts'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { appendCopySuffix, isDefined } from 'twenty-shared/utils'; @@ -24,17 +24,17 @@ export const useDuplicatePageLayoutWidget = ( pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const setEditingWidgetId = useSetRecoilComponentStateV2( + const setEditingWidgetId = useSetAtomComponentState( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts index 040a5f5310..ea01d45d91 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useEditPageLayoutWidget.ts @@ -2,14 +2,14 @@ import { useCallback } from 'react'; import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { commandMenuPageState } from '@/command-menu/states/commandMenuPageState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { CommandMenuPages } from 'twenty-shared/types'; import { useNavigatePageLayoutCommandMenu } from '@/command-menu/pages/page-layout/hooks/useNavigatePageLayoutCommandMenu'; import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { t } from '@lingui/core/macro'; import { WidgetType } from '~/generated-metadata/graphql'; @@ -19,14 +19,14 @@ export const useEditPageLayoutWidget = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const setPageLayoutEditingWidgetId = useSetRecoilComponentStateV2( + const setPageLayoutEditingWidgetId = useSetAtomComponentState( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); const { navigatePageLayoutCommandMenu } = useNavigatePageLayoutCommandMenu(); const { closeCommandMenu } = useCommandMenu(); - const setCommandMenuPage = useSetRecoilStateV2(commandMenuPageState); + const setCommandMenuPage = useSetAtomState(commandMenuPageState); const handleEditWidget = useCallback( ({ diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts b/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts index b9f92c0642..797af731c3 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useEndPageLayoutDragSelection.ts @@ -5,7 +5,7 @@ import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pa import { pageLayoutSelectedCellsComponentState } from '@/page-layout/states/pageLayoutSelectedCellsComponentState'; import { calculateGridBoundsFromSelectedCells } from '@/page-layout/utils/calculateGridBoundsFromSelectedCells'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { CommandMenuPages } from 'twenty-shared/types'; @@ -19,16 +19,16 @@ export const useEndPageLayoutDragSelection = ( pageLayoutIdFromProps, ); - const pageLayoutSelectedCellsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutSelectedCellsState = useAtomComponentStateCallbackState( pageLayoutSelectedCellsComponentState, pageLayoutId, ); - const pageLayoutDraggedAreaState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( pageLayoutDraggedAreaComponentState, pageLayoutId, ); - const pageLayoutEditingWidgetIdState = useRecoilComponentStateCallbackStateV2( + const pageLayoutEditingWidgetIdState = useAtomComponentStateCallbackState( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useIsCurrentObjectCustom.ts b/packages/twenty-front/src/modules/page-layout/hooks/useIsCurrentObjectCustom.ts index 0f689db759..189c31dc7b 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useIsCurrentObjectCustom.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useIsCurrentObjectCustom.ts @@ -1,12 +1,12 @@ import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const useIsCurrentObjectCustom = () => { const { targetRecordIdentifier } = useLayoutRenderingContext(); - const objectMetadataItem = useFamilySelectorValueV2( + const objectMetadataItem = useAtomFamilySelectorValue( objectMetadataItemFamilySelector, { objectName: targetRecordIdentifier?.targetObjectNameSingular ?? '', diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useMovePageLayoutTab.ts b/packages/twenty-front/src/modules/page-layout/hooks/useMovePageLayoutTab.ts index 918dbb160f..0404978af5 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useMovePageLayoutTab.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useMovePageLayoutTab.ts @@ -3,7 +3,7 @@ import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDr import { sortTabsByPosition } from '@/page-layout/utils/sortTabsByPosition'; import { calculateNewPosition } from '@/ui/layout/draggable-list/utils/calculateNewPosition'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -13,7 +13,7 @@ export const useMovePageLayoutTab = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useOpportunityDefaultChartConfig.ts b/packages/twenty-front/src/modules/page-layout/hooks/useOpportunityDefaultChartConfig.ts index e625be3c73..7f6d8ecac2 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useOpportunityDefaultChartConfig.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useOpportunityDefaultChartConfig.ts @@ -1,12 +1,12 @@ import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { type GraphWidgetFieldSelection } from '@/page-layout/types/GraphWidgetFieldSelection'; export const useOpportunityDefaultChartConfig = () => { - const opportunityObjectMetadata = useFamilySelectorValueV2( + const opportunityObjectMetadata = useAtomFamilySelectorValue( objectMetadataItemFamilySelector, { objectName: CoreObjectNameSingular.Opportunity, diff --git a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutDraftState.ts b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutDraftState.ts index 431f592fa3..539baed297 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutDraftState.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutDraftState.ts @@ -1,7 +1,7 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { pageLayoutPersistedComponentState } from '@/page-layout/states/pageLayoutPersistedComponentState'; @@ -12,11 +12,11 @@ export const usePageLayoutDraftState = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const [pageLayoutDraft, setPageLayoutDraft] = useRecoilComponentStateV2( + const [pageLayoutDraft, setPageLayoutDraft] = useAtomComponentState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutPersisted = useRecoilComponentValueV2( + const pageLayoutPersisted = useAtomComponentStateValue( pageLayoutPersistedComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts index f6867694fc..1a77c3f27b 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutHandleLayoutChange.ts @@ -2,7 +2,7 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/context import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { type Layout, type Layouts } from 'react-grid-layout'; import { useCallback } from 'react'; @@ -22,12 +22,12 @@ export const usePageLayoutHandleLayoutChange = ( const store = useStore(); const tabListInstanceId = getTabListInstanceIdFromPageLayoutId(pageLayoutId); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutIdForRecord.ts b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutIdForRecord.ts index 69e153cba6..7f3bfc61d6 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutIdForRecord.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutIdForRecord.ts @@ -5,7 +5,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord'; import { recordPageLayoutByObjectMetadataIdFamilySelector } from '@/page-layout/states/selectors/recordPageLayoutByObjectMetadataIdFamilySelector'; import { getDefaultRecordPageLayoutId } from '@/page-layout/utils/getDefaultRecordPageLayoutId'; import { type TargetRecordIdentifier } from '@/ui/layout/contexts/TargetRecordIdentifier'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const usePageLayoutIdForRecord = ({ @@ -28,7 +28,7 @@ export const usePageLayoutIdForRecord = ({ objectNameSingular: targetObjectNameSingular, }); - const recordPageLayout = useFamilySelectorValueV2( + const recordPageLayout = useAtomFamilySelectorValue( recordPageLayoutByObjectMetadataIdFamilySelector, { objectMetadataId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts index ac47fe59d8..b92d35579b 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/usePageLayoutTabWithVisibleWidgetsOrThrow.ts @@ -5,7 +5,7 @@ import { buildWidgetVisibilityContext } from '@/page-layout/utils/buildWidgetVis import { filterVisibleWidgets } from '@/page-layout/utils/filterVisibleWidgets'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const usePageLayoutTabWithVisibleWidgetsOrThrow = ( @@ -14,7 +14,7 @@ export const usePageLayoutTabWithVisibleWidgetsOrThrow = ( const { currentPageLayout } = useCurrentPageLayout(); const isMobile = useIsMobile(); const { isInRightDrawer } = useLayoutRenderingContext(); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useRecordPageLayoutIdFromRecordStoreOrThrow.ts b/packages/twenty-front/src/modules/page-layout/hooks/useRecordPageLayoutIdFromRecordStoreOrThrow.ts index e5b84f5ba9..ff7c1b1561 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useRecordPageLayoutIdFromRecordStoreOrThrow.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useRecordPageLayoutIdFromRecordStoreOrThrow.ts @@ -2,7 +2,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata import { recordPageLayoutByObjectMetadataIdFamilySelector } from '@/page-layout/states/selectors/recordPageLayoutByObjectMetadataIdFamilySelector'; import { getDefaultRecordPageLayoutId } from '@/page-layout/utils/getDefaultRecordPageLayoutId'; import { type TargetRecordIdentifier } from '@/ui/layout/contexts/TargetRecordIdentifier'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; export const useRecordPageLayoutIdFromRecordStoreOrThrow = ({ @@ -12,7 +12,7 @@ export const useRecordPageLayoutIdFromRecordStoreOrThrow = ({ objectNameSingular: targetObjectNameSingular, }); - const recordPageLayout = useFamilySelectorValueV2( + const recordPageLayout = useAtomFamilySelectorValue( recordPageLayoutByObjectMetadataIdFamilySelector, { objectMetadataId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useRemovePageLayoutWidgetAndPreservePosition.ts b/packages/twenty-front/src/modules/page-layout/hooks/useRemovePageLayoutWidgetAndPreservePosition.ts index b2756947c2..736af8e1e8 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useRemovePageLayoutWidgetAndPreservePosition.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useRemovePageLayoutWidgetAndPreservePosition.ts @@ -6,7 +6,7 @@ import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pa import { removeWidgetFromTab } from '@/page-layout/utils/removeWidgetFromTab'; import { removeWidgetLayoutFromTab } from '@/page-layout/utils/removeWidgetLayoutFromTab'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -19,22 +19,22 @@ export const useRemovePageLayoutWidgetAndPreservePosition = ( pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraggedAreaState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraggedAreaState = useAtomComponentStateCallbackState( pageLayoutDraggedAreaComponentState, pageLayoutId, ); - const pageLayoutEditingWidgetIdState = useRecoilComponentStateCallbackStateV2( + const pageLayoutEditingWidgetIdState = useAtomComponentStateCallbackState( pageLayoutEditingWidgetIdComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useReorderPageLayoutWidgets.ts b/packages/twenty-front/src/modules/page-layout/hooks/useReorderPageLayoutWidgets.ts index 8f8cd82bbb..d65f0f3745 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useReorderPageLayoutWidgets.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useReorderPageLayoutWidgets.ts @@ -1,7 +1,7 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { type DropResult } from '@hello-pangea/dnd'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -16,7 +16,7 @@ export const useReorderPageLayoutWidgets = ( pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout.ts b/packages/twenty-front/src/modules/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout.ts index 6e427d2360..45b0b383e3 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useResetDraftPageLayoutToPersistedPageLayout.ts @@ -8,7 +8,7 @@ import { convertPageLayoutToTabLayouts } from '@/page-layout/utils/convertPageLa import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -25,17 +25,17 @@ export const useResetDraftPageLayoutToPersistedPageLayout = ( const tabListComponentInstanceId = getTabListInstanceIdFromPageLayoutId(componentInstanceId); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, componentInstanceId, ); - const pageLayoutPersistedState = useRecoilComponentStateCallbackStateV2( + const pageLayoutPersistedState = useAtomComponentStateCallbackState( pageLayoutPersistedComponentState, componentInstanceId, ); - const pageLayoutCurrentLayoutsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutCurrentLayoutsState = useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, componentInstanceId, ); @@ -44,16 +44,15 @@ export const useResetDraftPageLayoutToPersistedPageLayout = ( instanceId: tabListComponentInstanceId, }); - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, componentInstanceId, ); - const fieldsWidgetGroupsPersistedState = - useRecoilComponentStateCallbackStateV2( - fieldsWidgetGroupsPersistedComponentState, - componentInstanceId, - ); + const fieldsWidgetGroupsPersistedState = useAtomComponentStateCallbackState( + fieldsWidgetGroupsPersistedComponentState, + componentInstanceId, + ); const resetDraftPageLayoutToPersistedPageLayout = useCallback(() => { const pageLayoutPersisted = store.get(pageLayoutPersistedState); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useSaveFieldsWidgetGroups.ts b/packages/twenty-front/src/modules/page-layout/hooks/useSaveFieldsWidgetGroups.ts index 4afd568004..7f514c6b56 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useSaveFieldsWidgetGroups.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useSaveFieldsWidgetGroups.ts @@ -1,7 +1,7 @@ import { UPSERT_FIELDS_WIDGET } from '@/page-layout/graphql/mutations/upsertFieldsWidget'; import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; import { fieldsWidgetGroupsPersistedComponentState } from '@/page-layout/states/fieldsWidgetGroupsPersistedComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useRefreshAllCoreViews } from '@/views/hooks/useRefreshAllCoreViews'; import { useMutation } from '@apollo/client'; import { useStore } from 'jotai'; @@ -40,16 +40,15 @@ type UseSaveFieldsWidgetGroupsParams = { export const useSaveFieldsWidgetGroups = ({ pageLayoutId, }: UseSaveFieldsWidgetGroupsParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); - const fieldsWidgetGroupsPersistedState = - useRecoilComponentStateCallbackStateV2( - fieldsWidgetGroupsPersistedComponentState, - pageLayoutId, - ); + const fieldsWidgetGroupsPersistedState = useAtomComponentStateCallbackState( + fieldsWidgetGroupsPersistedComponentState, + pageLayoutId, + ); const [upsertFieldsWidgetMutation] = useMutation< UpsertFieldsWidgetResult, diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useSavePageLayout.ts b/packages/twenty-front/src/modules/page-layout/hooks/useSavePageLayout.ts index e0f574d52f..34e9d5daf1 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useSavePageLayout.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useSavePageLayout.ts @@ -9,7 +9,7 @@ import { convertPageLayoutToTabLayouts } from '@/page-layout/utils/convertPageLa import { reInjectDynamicRelationWidgetsFromDraft } from '@/page-layout/utils/reInjectDynamicRelationWidgetsFromDraft'; import { transformPageLayout } from '@/page-layout/utils/transformPageLayout'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -21,19 +21,18 @@ export const useSavePageLayout = (pageLayoutIdFromProps: string) => { pageLayoutIdFromProps, ); - const pageLayoutPersistedCallbackState = - useRecoilComponentStateCallbackStateV2( - pageLayoutPersistedComponentState, - pageLayoutId, - ); + const pageLayoutPersistedCallbackState = useAtomComponentStateCallbackState( + pageLayoutPersistedComponentState, + pageLayoutId, + ); const pageLayoutCurrentLayoutsCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( pageLayoutCurrentLayoutsComponentState, pageLayoutId, ); - const pageLayoutDraftCallbackState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftCallbackState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts b/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts index dcc191738d..4a59c019eb 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useSetIsPageLayoutInEditMode.ts @@ -6,7 +6,7 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/context import { currentPageLayoutIdState } from '@/page-layout/states/currentPageLayoutIdState'; import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -16,13 +16,13 @@ export const useSetIsPageLayoutInEditMode = (pageLayoutIdFromProps: string) => { pageLayoutIdFromProps, ); - const isPageLayoutInEditModeState = useRecoilComponentStateCallbackStateV2( + const isPageLayoutInEditModeState = useAtomComponentStateCallbackState( isPageLayoutInEditModeComponentState, pageLayoutId, ); const contextStoreIsFullTabWidgetInEditModeState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( contextStoreIsPageInEditModeComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useStartPageLayoutDragSelection.ts b/packages/twenty-front/src/modules/page-layout/hooks/useStartPageLayoutDragSelection.ts index 2c3ae8cab5..093444a608 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useStartPageLayoutDragSelection.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useStartPageLayoutDragSelection.ts @@ -1,6 +1,6 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { pageLayoutSelectedCellsComponentState } from '@/page-layout/states/pageLayoutSelectedCellsComponentState'; @@ -13,7 +13,7 @@ export const useStartPageLayoutDragSelection = ( pageLayoutIdFromProps, ); - const pageLayoutSelectedCellsState = useRecoilComponentStateCallbackStateV2( + const pageLayoutSelectedCellsState = useAtomComponentStateCallbackState( pageLayoutSelectedCellsComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutTab.ts b/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutTab.ts index 6a99c7d52a..eb1eff0b78 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutTab.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutTab.ts @@ -1,7 +1,7 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { type PageLayoutTab } from '@/page-layout/types/PageLayoutTab'; @@ -12,7 +12,7 @@ export const useUpdatePageLayoutTab = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWidget.ts b/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWidget.ts index 8e3fe30cf8..25d805c80a 100644 --- a/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWidget.ts +++ b/packages/twenty-front/src/modules/page-layout/hooks/useUpdatePageLayoutWidget.ts @@ -2,7 +2,7 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/context import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -12,7 +12,7 @@ export const useUpdatePageLayoutWidget = (pageLayoutIdFromProps?: string) => { pageLayoutIdFromProps, ); - const pageLayoutDraftState = useRecoilComponentStateCallbackStateV2( + const pageLayoutDraftState = useAtomComponentStateCallbackState( pageLayoutDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/states/currentPageLayoutIdState.ts b/packages/twenty-front/src/modules/page-layout/states/currentPageLayoutIdState.ts index 45504046d5..2eb4255bfc 100644 --- a/packages/twenty-front/src/modules/page-layout/states/currentPageLayoutIdState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/currentPageLayoutIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentPageLayoutIdState = createStateV2({ +export const currentPageLayoutIdState = createAtomState({ key: 'currentPageLayoutIdState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsDraftComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsDraftComponentState.ts index b6aefd393b..6014e9292f 100644 --- a/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsDraftComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsDraftComponentState.ts @@ -1,9 +1,9 @@ import { type FieldsWidgetGroup } from '@/page-layout/widgets/fields/types/FieldsWidgetGroup'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const fieldsWidgetGroupsDraftComponentState = createComponentStateV2< +export const fieldsWidgetGroupsDraftComponentState = createAtomComponentState< Record >({ key: 'fieldsWidgetGroupsDraftComponentState', diff --git a/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsPersistedComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsPersistedComponentState.ts index 8afcc2ea4e..2ab96dd9b0 100644 --- a/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsPersistedComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/fieldsWidgetGroupsPersistedComponentState.ts @@ -1,12 +1,11 @@ import { type FieldsWidgetGroup } from '@/page-layout/widgets/fields/types/FieldsWidgetGroup'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const fieldsWidgetGroupsPersistedComponentState = createComponentStateV2< - Record ->({ - key: 'fieldsWidgetGroupsPersistedComponentState', - defaultValue: {}, - componentInstanceContext: PageLayoutComponentInstanceContext, -}); +export const fieldsWidgetGroupsPersistedComponentState = + createAtomComponentState>({ + key: 'fieldsWidgetGroupsPersistedComponentState', + defaultValue: {}, + componentInstanceContext: PageLayoutComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/page-layout/states/hasInitializedFieldsWidgetGroupsDraftComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/hasInitializedFieldsWidgetGroupsDraftComponentState.ts index b44da0de84..1aa822b386 100644 --- a/packages/twenty-front/src/modules/page-layout/states/hasInitializedFieldsWidgetGroupsDraftComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/hasInitializedFieldsWidgetGroupsDraftComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const hasInitializedFieldsWidgetGroupsDraftComponentState = - createComponentStateV2>({ + createAtomComponentState>({ key: 'hasInitializedFieldsWidgetGroupsDraftComponentState', defaultValue: {}, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/isPageLayoutInEditModeComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/isPageLayoutInEditModeComponentState.ts index 6b66f9ec0c..7467d6100a 100644 --- a/packages/twenty-front/src/modules/page-layout/states/isPageLayoutInEditModeComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/isPageLayoutInEditModeComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const isPageLayoutInEditModeComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isPageLayoutInEditModeComponentState', defaultValue: false, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/isPageLayoutTabDraggingComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/isPageLayoutTabDraggingComponentState.ts index 5a7d752b5a..96d9b64477 100644 --- a/packages/twenty-front/src/modules/page-layout/states/isPageLayoutTabDraggingComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/isPageLayoutTabDraggingComponentState.ts @@ -1,8 +1,8 @@ import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const isPageLayoutTabDraggingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isPageLayoutTabDraggingComponentState', defaultValue: false, componentInstanceContext: TabListComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentBreakpointComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentBreakpointComponentState.ts index 998940dfc6..56ef25d2b6 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentBreakpointComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentBreakpointComponentState.ts @@ -1,10 +1,10 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type PageLayoutBreakpoint } from '@/page-layout/constants/PageLayoutBreakpoints'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const pageLayoutCurrentBreakpointComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'pageLayoutCurrentBreakpointComponentState', defaultValue: 'desktop', componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentLayoutsComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentLayoutsComponentState.ts index 9877a9a768..5678faab5a 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentLayoutsComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutCurrentLayoutsComponentState.ts @@ -1,10 +1,10 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type TabLayouts } from '@/page-layout/types/TabLayouts'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const pageLayoutCurrentLayoutsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'pageLayoutCurrentLayoutsComponentState', defaultValue: {}, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraftComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraftComponentState.ts index 044ec0ce6c..7f13cfb81d 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraftComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraftComponentState.ts @@ -1,11 +1,11 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutType } from '~/generated-metadata/graphql'; import { type DraftPageLayout } from '@/page-layout/types/DraftPageLayout'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const pageLayoutDraftComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'pageLayoutDraftComponentState', defaultValue: { id: '', diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggedAreaComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggedAreaComponentState.ts index 409c964180..ae32434257 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggedAreaComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggedAreaComponentState.ts @@ -1,10 +1,10 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type PageLayoutDraggedArea } from '@/page-layout/types/page-layout-dragged-area'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const pageLayoutDraggedAreaComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'pageLayoutDraggedAreaComponentState', defaultValue: null, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggingWidgetIdComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggingWidgetIdComponentState.ts index a356c5aba0..00bda2e7ac 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggingWidgetIdComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutDraggingWidgetIdComponentState.ts @@ -1,11 +1,10 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const pageLayoutDraggingWidgetIdComponentState = createComponentStateV2< - string | null ->({ - key: 'pageLayoutDraggingWidgetIdComponentState', - defaultValue: null, - componentInstanceContext: PageLayoutComponentInstanceContext, -}); +export const pageLayoutDraggingWidgetIdComponentState = + createAtomComponentState({ + key: 'pageLayoutDraggingWidgetIdComponentState', + defaultValue: null, + componentInstanceContext: PageLayoutComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutEditingWidgetIdComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutEditingWidgetIdComponentState.ts index 9e6f6cb301..28da84cd56 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutEditingWidgetIdComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutEditingWidgetIdComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const pageLayoutEditingWidgetIdComponentState = createComponentStateV2< +export const pageLayoutEditingWidgetIdComponentState = createAtomComponentState< string | null >({ key: 'pageLayoutEditingWidgetIdComponentState', diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutIsInitializedComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutIsInitializedComponentState.ts index 720faf27ed..903def59dc 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutIsInitializedComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutIsInitializedComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const pageLayoutIsInitializedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'pageLayoutIsInitializedComponentState', defaultValue: false, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutPersistedComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutPersistedComponentState.ts index 3c00731176..8c6cd842e3 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutPersistedComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutPersistedComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type PageLayout } from '@/page-layout/types/PageLayout'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const pageLayoutPersistedComponentState = createComponentStateV2< +export const pageLayoutPersistedComponentState = createAtomComponentState< PageLayout | undefined >({ key: 'pageLayoutPersistedComponentState', diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutResizingWidgetIdComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutResizingWidgetIdComponentState.ts index 5d5822aa2d..da1776865d 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutResizingWidgetIdComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutResizingWidgetIdComponentState.ts @@ -1,11 +1,10 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const pageLayoutResizingWidgetIdComponentState = createComponentStateV2< - string | null ->({ - key: 'pageLayoutResizingWidgetIdComponentState', - defaultValue: null, - componentInstanceContext: PageLayoutComponentInstanceContext, -}); +export const pageLayoutResizingWidgetIdComponentState = + createAtomComponentState({ + key: 'pageLayoutResizingWidgetIdComponentState', + defaultValue: null, + componentInstanceContext: PageLayoutComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutSelectedCellsComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutSelectedCellsComponentState.ts index 986594e819..4d80c13b05 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutSelectedCellsComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutSelectedCellsComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const pageLayoutSelectedCellsComponentState = createComponentStateV2< +export const pageLayoutSelectedCellsComponentState = createAtomComponentState< Set >({ key: 'pageLayoutSelectedCellsComponentState', diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabListCurrentDragDroppableIdComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabListCurrentDragDroppableIdComponentState.ts index 43d428dc9a..cbbcbbaab4 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabListCurrentDragDroppableIdComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabListCurrentDragDroppableIdComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const pageLayoutTabListCurrentDragDroppableIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'pageLayoutTabListCurrentDragDroppableIdComponentState', defaultValue: undefined, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState.ts index 1c4f65b66c..71230a8995 100644 --- a/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/pageLayoutTabSettingsOpenTabIdComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; export const pageLayoutTabSettingsOpenTabIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'pageLayoutTabSettingsOpenTabIdComponentState', defaultValue: null, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/states/recordPageLayoutsState.ts b/packages/twenty-front/src/modules/page-layout/states/recordPageLayoutsState.ts index f7a6129ceb..cb72050c0e 100644 --- a/packages/twenty-front/src/modules/page-layout/states/recordPageLayoutsState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/recordPageLayoutsState.ts @@ -1,7 +1,7 @@ import { type PageLayout } from '@/page-layout/types/PageLayout'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const recordPageLayoutsState = createStateV2({ +export const recordPageLayoutsState = createAtomState({ key: 'recordPageLayoutsState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/page-layout/states/savedPageLayoutsComponentState.ts b/packages/twenty-front/src/modules/page-layout/states/savedPageLayoutsComponentState.ts index d82fa8d973..a3346c4564 100644 --- a/packages/twenty-front/src/modules/page-layout/states/savedPageLayoutsComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/states/savedPageLayoutsComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type PageLayout } from '@/page-layout/types/PageLayout'; import { PageLayoutComponentInstanceContext } from './contexts/PageLayoutComponentInstanceContext'; -export const savedPageLayoutsComponentState = createComponentStateV2< +export const savedPageLayoutsComponentState = createAtomComponentState< PageLayout[] >({ key: 'savedPageLayoutsComponentState', diff --git a/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutByObjectMetadataIdFamilySelector.ts b/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutByObjectMetadataIdFamilySelector.ts index a5828a3db5..44b7166307 100644 --- a/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutByObjectMetadataIdFamilySelector.ts +++ b/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutByObjectMetadataIdFamilySelector.ts @@ -1,9 +1,12 @@ import { recordPageLayoutsState } from '@/page-layout/states/recordPageLayoutsState'; import { type PageLayout } from '@/page-layout/types/PageLayout'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; export const recordPageLayoutByObjectMetadataIdFamilySelector = - createFamilySelectorV2({ + createAtomFamilySelector< + PageLayout | undefined, + { objectMetadataId: string } + >({ key: 'recordPageLayoutByObjectMetadataIdFamilySelector', get: ({ objectMetadataId }) => diff --git a/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutFromIdFamilySelector.ts b/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutFromIdFamilySelector.ts index 159fc958da..2310a563a6 100644 --- a/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutFromIdFamilySelector.ts +++ b/packages/twenty-front/src/modules/page-layout/states/selectors/recordPageLayoutFromIdFamilySelector.ts @@ -1,8 +1,8 @@ import { recordPageLayoutsState } from '@/page-layout/states/recordPageLayoutsState'; import { type PageLayout } from '@/page-layout/types/PageLayout'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; -export const recordPageLayoutFromIdFamilySelector = createFamilySelectorV2< +export const recordPageLayoutFromIdFamilySelector = createAtomFamilySelector< PageLayout | undefined, { pageLayoutId: string } >({ diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx index 69f797089f..563cc34940 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/components/DashboardWidgetPlaceholder.tsx @@ -5,7 +5,7 @@ import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPag import { WidgetCard } from '@/page-layout/widgets/widget-card/components/WidgetCard'; import { WidgetCardHeader } from '@/page-layout/widgets/widget-card/components/WidgetCardHeader'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { Trans } from '@lingui/react/macro'; import { CommandMenuPages } from 'twenty-shared/types'; @@ -23,7 +23,7 @@ export const DashboardWidgetPlaceholder = () => { PageLayoutComponentInstanceContext, ); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx index 37c53aa23a..ce9a61b665 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx @@ -9,7 +9,7 @@ import { isFieldWidget } from '@/page-layout/widgets/field/utils/isFieldWidget'; import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; import { css } from '@emotion/react'; import styled from '@emotion/styled'; @@ -92,7 +92,7 @@ export const WidgetActionFieldSeeAll = () => { ({ id }) => id === relationMetadata?.relationFieldMetadataId, ); - const indexViewId = useFamilySelectorValueV2( + const indexViewId = useAtomFamilySelectorValue( coreIndexViewIdFromObjectMetadataItemFamilySelector, { objectMetadataItemId: relationObjectMetadataItem?.id ?? '' }, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx index 44ed06f41d..1f9d584fc3 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetRenderer.tsx @@ -22,8 +22,8 @@ import { WidgetCardContent } from '@/page-layout/widgets/widget-card/components/ import { WidgetCardHeader } from '@/page-layout/widgets/widget-card/components/WidgetCardHeader'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentFamilyStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { type MouseEvent } from 'react'; @@ -50,19 +50,19 @@ export const WidgetRenderer = ({ widget }: WidgetRendererProps) => { const { deletePageLayoutWidget } = useDeletePageLayoutWidget(); const { handleEditWidget } = useEditPageLayoutWidget(); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); - const draggingWidgetId = useRecoilComponentValueV2( + const draggingWidgetId = useAtomComponentStateValue( pageLayoutDraggingWidgetIdComponentState, ); - const resizingWidgetId = useRecoilComponentValueV2( + const resizingWidgetId = useAtomComponentStateValue( pageLayoutResizingWidgetIdComponentState, ); - const currentlyEditingWidgetId = useRecoilComponentValueV2( + const currentlyEditingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, ); @@ -109,7 +109,7 @@ export const WidgetRenderer = ({ widget }: WidgetRendererProps) => { deletePageLayoutWidget(widget.id); }; - const setIsHovered = useSetRecoilComponentFamilyStateV2( + const setIsHovered = useSetAtomComponentFamilyState( widgetCardHoveredComponentFamilyState, widget.id, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx index 88d1167d1a..6562909d49 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidget.tsx @@ -19,7 +19,7 @@ import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord'; import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; import { AnimatedPlaceholder, @@ -62,7 +62,7 @@ export const FieldWidget = ({ widget }: FieldWidgetProps) => { resolvedFieldMetadataId ?? '', ); - const record = useFamilySelectorValueV2(recordStoreFamilySelectorV2, { + const record = useAtomFamilySelectorValue(recordStoreFamilySelectorV2, { recordId: targetRecord.id, fieldName: fieldMetadataItem?.name ?? '', }); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetCellEditModePortal.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetCellEditModePortal.tsx index 9d431d6ff3..40b6e49d0a 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetCellEditModePortal.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetCellEditModePortal.tsx @@ -7,7 +7,7 @@ import { FieldWidgetInputContextProvider } from '@/page-layout/widgets/field/com import { useIsFieldWidgetEditing } from '@/page-layout/widgets/field/hooks/useIsFieldWidgetEditing'; import { useOpenFieldWidgetFieldInputEditMode } from '@/page-layout/widgets/field/hooks/useOpenFieldWidgetFieldInputEditMode'; import { fieldWidgetHoverComponentState } from '@/page-layout/widgets/field/states/fieldWidgetHoverComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; type FieldWidgetCellEditModePortalProps = { objectMetadataItem: ObjectMetadataItem; @@ -24,9 +24,7 @@ export const FieldWidgetCellEditModePortal = ({ }: FieldWidgetCellEditModePortalProps) => { const { isEditing } = useIsFieldWidgetEditing(); - const setIsHovered = useSetRecoilComponentStateV2( - fieldWidgetHoverComponentState, - ); + const setIsHovered = useSetAtomComponentState(fieldWidgetHoverComponentState); const { closeFieldInput } = useOpenFieldWidgetFieldInputEditMode(); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx index 94213e6bb8..2f96994672 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetDisplay.tsx @@ -17,7 +17,7 @@ import { generateFieldWidgetInstanceId } from '@/page-layout/widgets/field/utils import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { getObjectPermissionsFromMapByObjectMetadataId } from '@/settings/roles/role-permissions/objects-permissions/utils/getObjectPermissionsFromMapByObjectMetadataId'; import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import styled from '@emotion/styled'; const StyledContainer = styled.div` @@ -41,7 +41,7 @@ export const FieldWidgetDisplay = ({ }: FieldWidgetDisplayProps) => { const widget = useCurrentWidget(); - const [isHovered, setIsHovered] = useRecoilComponentStateV2( + const [isHovered, setIsHovered] = useAtomComponentState( fieldWidgetHoverComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationEditAction.tsx b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationEditAction.tsx index cedc1c56fe..1be0eee0e8 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationEditAction.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/components/FieldWidgetRelationEditAction.tsx @@ -20,7 +20,7 @@ import { isFieldMorphRelation } from '@/object-record/record-field/ui/types/guar import { getRecordFieldCardRelationPickerDropdownId } from '@/object-record/record-show/utils/getRecordFieldCardRelationPickerDropdownId'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { css } from '@emotion/react'; import styled from '@emotion/styled'; import { CustomError } from 'twenty-shared/utils'; @@ -99,7 +99,7 @@ export const FieldWidgetRelationEditAction = ({ instanceId: scopeInstanceId, }); - const isRelationSelectionDropdownOpen = useRecoilComponentValueV2( + const isRelationSelectionDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, relationSelectionDropdownId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/hooks/useIsFieldWidgetEditing.ts b/packages/twenty-front/src/modules/page-layout/widgets/field/hooks/useIsFieldWidgetEditing.ts index 1ec38d71ac..59170007df 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/hooks/useIsFieldWidgetEditing.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/hooks/useIsFieldWidgetEditing.ts @@ -1,14 +1,14 @@ import { RecordFieldComponentInstanceContext } from '@/object-record/record-field/ui/states/contexts/RecordFieldComponentInstanceContext'; import { focusStackState } from '@/ui/utilities/focus/states/focusStackState'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useIsFieldWidgetEditing = () => { const recordFieldInstanceId = useAvailableComponentInstanceIdOrThrow( RecordFieldComponentInstanceContext, ); - const focusStack = useRecoilValueV2(focusStackState); + const focusStack = useAtomStateValue(focusStackState); const isEditing = focusStack.some( (item) => diff --git a/packages/twenty-front/src/modules/page-layout/widgets/field/states/fieldWidgetHoverComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/field/states/fieldWidgetHoverComponentState.ts index 01c3072e3d..f43dbe64de 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/field/states/fieldWidgetHoverComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/field/states/fieldWidgetHoverComponentState.ts @@ -1,8 +1,10 @@ import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const fieldWidgetHoverComponentState = createComponentStateV2({ - key: 'fieldWidgetHoverComponentState', - defaultValue: false, - componentInstanceContext: WidgetComponentInstanceContext, -}); +export const fieldWidgetHoverComponentState = createAtomComponentState( + { + key: 'fieldWidgetHoverComponentState', + defaultValue: false, + componentInstanceContext: WidgetComponentInstanceContext, + }, +); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx index 806ec25b32..25e63f5e68 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidget.tsx @@ -27,7 +27,7 @@ import { getObjectPermissionsFromMapByObjectMetadataId } from '@/settings/roles/ import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord'; import { RightDrawerProvider } from '@/ui/layout/right-drawer/contexts/RightDrawerContext'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { @@ -87,7 +87,7 @@ export const FieldsWidget = ({ widget }: FieldsWidgetProps) => { objectMetadataId: objectMetadataItem.id, }); - const setRecordFieldListHoverPosition = useSetRecoilComponentStateV2( + const setRecordFieldListHoverPosition = useSetAtomComponentState( recordFieldListHoverPositionComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellEditModePortal.tsx b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellEditModePortal.tsx index 4f06bafdcd..1477a31915 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellEditModePortal.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellEditModePortal.tsx @@ -7,7 +7,7 @@ import { FieldInput } from '@/object-record/record-field/ui/components/FieldInpu import { RecordInlineCellAnchoredPortal } from '@/object-record/record-inline-cell/components/RecordInlineCellAnchoredPortal'; import { RecordInlineCellEditMode } from '@/object-record/record-inline-cell/components/RecordInlineCellEditMode'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; type FieldsWidgetCellEditModePortalProps = { @@ -25,7 +25,7 @@ export const FieldsWidgetCellEditModePortal = ({ RecordFieldListComponentInstanceContext, ); - const editModePosition = useRecoilComponentValueV2( + const editModePosition = useAtomComponentStateValue( recordFieldListCellEditModePositionComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellHoveredPortal.tsx b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellHoveredPortal.tsx index c1f1bacf0a..b2ecd3cf9d 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellHoveredPortal.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/components/FieldsWidgetCellHoveredPortal.tsx @@ -6,7 +6,7 @@ import { RecordFieldListComponentInstanceContext } from '@/object-record/record- import { recordFieldListHoverPositionComponentState } from '@/object-record/record-field-list/states/recordFieldListHoverPositionComponentState'; import { RecordInlineCellAnchoredPortal } from '@/object-record/record-inline-cell/components/RecordInlineCellAnchoredPortal'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; type FieldsWidgetCellHoveredPortalProps = { @@ -24,7 +24,7 @@ export const FieldsWidgetCellHoveredPortal = ({ RecordFieldListComponentInstanceContext, ); - const hoverPosition = useRecoilComponentValueV2( + const hoverPosition = useAtomComponentStateValue( recordFieldListHoverPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useCreateFieldsWidgetEditorGroup.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useCreateFieldsWidgetEditorGroup.ts index 8ad1afa7bb..f8c0655187 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useCreateFieldsWidgetEditorGroup.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useCreateFieldsWidgetEditorGroup.ts @@ -1,5 +1,5 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { v4 } from 'uuid'; @@ -13,7 +13,7 @@ export const useCreateFieldsWidgetEditorGroup = ({ pageLayoutId, widgetId, }: UseCreateFieldsWidgetEditorGroupParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useDeleteFieldsWidgetEditorGroup.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useDeleteFieldsWidgetEditorGroup.ts index aa66333796..56b3a4cb53 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useDeleteFieldsWidgetEditorGroup.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useDeleteFieldsWidgetEditorGroup.ts @@ -1,5 +1,5 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -12,7 +12,7 @@ export const useDeleteFieldsWidgetEditorGroup = ({ pageLayoutId, widgetId, }: UseDeleteFieldsWidgetEditorGroupParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsDraft.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsDraft.ts index 3a59dbce8e..ad411a49b7 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsDraft.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsDraft.ts @@ -1,6 +1,6 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; import { type FieldsWidgetGroup } from '@/page-layout/widgets/fields/types/FieldsWidgetGroup'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useMemo } from 'react'; type UseFieldsWidgetGroupsDraftParams = { @@ -14,7 +14,7 @@ export const useFieldsWidgetGroupsDraft = ({ }: UseFieldsWidgetGroupsDraftParams): { draftGroups: FieldsWidgetGroup[]; } => { - const allDraftGroups = useRecoilComponentValueV2( + const allDraftGroups = useAtomComponentStateValue( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsForDisplay.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsForDisplay.ts index 792605357b..e3a1428bd2 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsForDisplay.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useFieldsWidgetGroupsForDisplay.ts @@ -3,7 +3,7 @@ import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPag import { useFieldsWidgetGroups } from '@/page-layout/widgets/fields/hooks/useFieldsWidgetGroups'; import { type FieldsWidgetGroup } from '@/page-layout/widgets/fields/types/FieldsWidgetGroup'; import { filterDraftGroupsForDisplay } from '@/page-layout/widgets/fields/utils/filterDraftGroupsForDisplay'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useMemo } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -18,11 +18,11 @@ export const useFieldsWidgetGroupsForDisplay = ({ viewId, objectNameSingular, }: UseFieldsWidgetGroupsForDisplayParams) => { - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); - const allDraftGroups = useRecoilComponentValueV2( + const allDraftGroups = useAtomComponentStateValue( fieldsWidgetGroupsDraftComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useInitializeFieldsWidgetGroupsDraft.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useInitializeFieldsWidgetGroupsDraft.ts index c9c3db14ab..4bf9c2db55 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useInitializeFieldsWidgetGroupsDraft.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useInitializeFieldsWidgetGroupsDraft.ts @@ -2,7 +2,7 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fiel import { fieldsWidgetGroupsPersistedComponentState } from '@/page-layout/states/fieldsWidgetGroupsPersistedComponentState'; import { hasInitializedFieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/hasInitializedFieldsWidgetGroupsDraftComponentState'; import { type FieldsWidgetGroup } from '@/page-layout/widgets/fields/types/FieldsWidgetGroup'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback, useEffect } from 'react'; @@ -17,19 +17,18 @@ export const useInitializeFieldsWidgetGroupsDraft = ({ widgetId, serverGroups, }: UseInitializeFieldsWidgetGroupsDraftParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); - const fieldsWidgetGroupsPersistedState = - useRecoilComponentStateCallbackStateV2( - fieldsWidgetGroupsPersistedComponentState, - pageLayoutId, - ); + const fieldsWidgetGroupsPersistedState = useAtomComponentStateCallbackState( + fieldsWidgetGroupsPersistedComponentState, + pageLayoutId, + ); const hasInitializedFieldsWidgetGroupsDraftState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( hasInitializedFieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useMoveFieldInDraft.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useMoveFieldInDraft.ts index a410e87433..462774a40b 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useMoveFieldInDraft.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useMoveFieldInDraft.ts @@ -1,5 +1,5 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -12,7 +12,7 @@ export const useMoveFieldInDraft = ({ pageLayoutId, widgetId, }: UseMoveFieldInDraftParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useReorderFieldsWidgetEditorGroups.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useReorderFieldsWidgetEditorGroups.ts index 0f40d627db..76ac29e7d6 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useReorderFieldsWidgetEditorGroups.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useReorderFieldsWidgetEditorGroups.ts @@ -1,5 +1,5 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -12,7 +12,7 @@ export const useReorderFieldsWidgetEditorGroups = ({ pageLayoutId, widgetId, }: UseReorderFieldsWidgetEditorGroupsParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useToggleFieldVisibilityInDraft.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useToggleFieldVisibilityInDraft.ts index 19dc34d972..6d0c8c527c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useToggleFieldVisibilityInDraft.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useToggleFieldVisibilityInDraft.ts @@ -1,5 +1,5 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -12,7 +12,7 @@ export const useToggleFieldVisibilityInDraft = ({ pageLayoutId, widgetId, }: UseToggleFieldVisibilityInDraftParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useUpdateFieldsWidgetEditorGroup.ts b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useUpdateFieldsWidgetEditorGroup.ts index db66da7e60..88db64bb6c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useUpdateFieldsWidgetEditorGroup.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/fields/hooks/useUpdateFieldsWidgetEditorGroup.ts @@ -1,5 +1,5 @@ import { fieldsWidgetGroupsDraftComponentState } from '@/page-layout/states/fieldsWidgetGroupsDraftComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -20,7 +20,7 @@ export const useUpdateFieldsWidgetEditorGroup = ({ pageLayoutId, widgetId, }: UseUpdateFieldsWidgetEditorGroupParams) => { - const fieldsWidgetGroupsDraftState = useRecoilComponentStateCallbackStateV2( + const fieldsWidgetGroupsDraftState = useAtomComponentStateCallbackState( fieldsWidgetGroupsDraftComponentState, pageLayoutId, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx index a672d5ca0b..475da27cc2 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx @@ -4,7 +4,7 @@ import { Suspense, lazy } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { isWidgetConfigurationOfType } from '@/command-menu/pages/page-layout/utils/isWidgetConfigurationOfType'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { PageLayoutWidgetNoDataDisplay } from '@/page-layout/widgets/components/PageLayoutWidgetNoDataDisplay'; @@ -29,7 +29,7 @@ type FrontComponentWidgetRendererProps = { export const FrontComponentWidgetRenderer = ({ widget, }: FrontComponentWidgetRendererProps) => { - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetChartHasTooManyGroupsEffect.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetChartHasTooManyGroupsEffect.tsx index d8ea976458..87a6ddc7d8 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetChartHasTooManyGroupsEffect.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetChartHasTooManyGroupsEffect.tsx @@ -1,5 +1,5 @@ import { hasWidgetTooManyGroupsComponentState } from '@/page-layout/widgets/graph/states/hasWidgetTooManyGroupsComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect } from 'react'; type GraphWidgetChartHasTooManyGroupsEffectProps = { @@ -9,7 +9,7 @@ type GraphWidgetChartHasTooManyGroupsEffectProps = { export const GraphWidgetChartHasTooManyGroupsEffect = ({ hasTooManyGroups, }: GraphWidgetChartHasTooManyGroupsEffectProps) => { - const setHasWidgetTooManyGroups = useSetRecoilComponentStateV2( + const setHasWidgetTooManyGroups = useSetAtomComponentState( hasWidgetTooManyGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx index 80499a23f9..89568cbb0b 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/components/GraphWidgetLegend.tsx @@ -8,9 +8,9 @@ import { useLegendItemToggle } from '@/page-layout/widgets/graph/hooks/useLegend import { graphWidgetHiddenLegendIdsComponentState } from '@/page-layout/widgets/graph/states/graphWidgetHiddenLegendIdsComponentState'; import { graphWidgetHighlightedLegendIdComponentState } from '@/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState'; import { NodeDimensionEffect } from '@/ui/utilities/dimensions/components/NodeDimensionEffect'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { AnimatePresence, motion } from 'framer-motion'; @@ -146,17 +146,17 @@ export const GraphWidgetLegend = ({ const theme = useTheme(); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); const isInteractive = !isPageLayoutInEditMode; - const setHighlightedLegendId = useSetRecoilComponentStateV2( + const setHighlightedLegendId = useSetAtomComponentState( graphWidgetHighlightedLegendIdComponentState, ); - const [hiddenLegendIds, setHiddenLegendIds] = useRecoilComponentStateV2( + const [hiddenLegendIds, setHiddenLegendIds] = useAtomComponentState( graphWidgetHiddenLegendIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx index 92657d79ad..87871d97a2 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChart.tsx @@ -14,7 +14,7 @@ import { formatGraphValue, type GraphValueFormatOptions, } from '@/page-layout/widgets/graph/utils/graphFormatters'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { type MouseEvent } from 'react'; @@ -77,7 +77,7 @@ export const BarChart = ({ hasNoData = false, }: BarChartProps) => { const theme = useTheme(); - const highlightedLegendId = useRecoilComponentValueV2( + const highlightedLegendId = useAtomComponentStateValue( graphWidgetHighlightedLegendIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartTooltip.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartTooltip.tsx index 3bf496eb51..6a2ed94877 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartTooltip.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/BarChartTooltip.tsx @@ -1,5 +1,5 @@ import { GraphWidgetFloatingTooltip } from '@/page-layout/widgets/graph/components/GraphWidgetFloatingTooltip'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { BAR_CHART_CONSTANTS } from '@/page-layout/widgets/graph/graphWidgetBarChart/constants/BarChartConstants'; import { graphWidgetBarTooltipComponentState } from '@/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetBarTooltipComponentState'; import { type BarChartDatum } from '@/page-layout/widgets/graph/graphWidgetBarChart/types/BarChartDatum'; @@ -30,7 +30,7 @@ export const BarChartTooltip = ({ onMouseEnter, onMouseLeave, }: BarChartTooltipProps) => { - const tooltipState = useRecoilComponentValueV2( + const tooltipState = useAtomComponentStateValue( graphWidgetBarTooltipComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx index 57ebc55ed1..21c3cd853c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChart.tsx @@ -19,9 +19,9 @@ import { computeEffectiveValueRange } from '@/page-layout/widgets/graph/utils/co import { createGraphColorRegistry } from '@/page-layout/widgets/graph/utils/createGraphColorRegistry'; import { type GraphValueFormatOptions } from '@/page-layout/widgets/graph/utils/graphFormatters'; import { NodeDimensionEffect } from '@/ui/utilities/dimensions/components/NodeDimensionEffect'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useMemo, useRef, useState } from 'react'; @@ -91,27 +91,27 @@ export const GraphWidgetBarChart = ({ const [chartHeight, setChartHeight] = useState(0); const containerRef = useRef(null); - const setActiveBarTooltip = useSetRecoilComponentStateV2( + const setActiveBarTooltip = useSetAtomComponentState( graphWidgetBarTooltipComponentState, ); - const setHoveredSliceIndex = useSetRecoilComponentStateV2( + const setHoveredSliceIndex = useSetAtomComponentState( graphWidgetHoveredSliceIndexComponentState, ); - const hoveredSliceIndexValue = useRecoilComponentValueV2( + const hoveredSliceIndexValue = useAtomComponentStateValue( graphWidgetHoveredSliceIndexComponentState, ); - const draggingWidgetId = useRecoilComponentValueV2( + const draggingWidgetId = useAtomComponentStateValue( pageLayoutDraggingWidgetIdComponentState, ); - const resizingWidgetId = useRecoilComponentValueV2( + const resizingWidgetId = useAtomComponentStateValue( pageLayoutResizingWidgetIdComponentState, ); - const isSidePanelAnimating = useRecoilValueV2(isSidePanelAnimatingStateV2); + const isSidePanelAnimating = useAtomStateValue(isSidePanelAnimatingStateV2); const isLayoutAnimating = isSidePanelAnimating || draggingWidgetId === id || resizingWidgetId === id; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChartRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChartRenderer.tsx index c6b887fbaa..c30af3ba8a 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChartRenderer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/components/GraphWidgetBarChartRenderer.tsx @@ -10,8 +10,8 @@ import { isFilteredViewRedirectionSupported } from '@/page-layout/widgets/graph/ import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { useUserFirstDayOfTheWeek } from '@/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; import { lazy, Suspense } from 'react'; import { useNavigate } from 'react-router-dom'; @@ -58,7 +58,7 @@ export const GraphWidgetBarChartRenderer = () => { const navigate = useNavigate(); const configuration = widget.configuration; - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); @@ -81,7 +81,7 @@ export const GraphWidgetBarChartRenderer = () => { configuration.omitNullValues, ); - const indexViewId = useFamilySelectorValueV2( + const indexViewId = useAtomFamilySelectorValue( coreIndexViewIdFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/__tests__/useBarChartData.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/__tests__/useBarChartData.test.ts index 50291a62b1..07a7e1479c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/__tests__/useBarChartData.test.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/__tests__/useBarChartData.test.ts @@ -4,9 +4,12 @@ import { type GraphColorRegistry } from '@/page-layout/widgets/graph/types/Graph import { renderHook } from '@testing-library/react'; const mockUseRecoilComponentValue = jest.fn(); -jest.mock('@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2', () => ({ - useRecoilComponentValueV2: () => mockUseRecoilComponentValue(), -})); +jest.mock( + '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue', + () => ({ + useAtomComponentStateValue: () => mockUseRecoilComponentValue(), + }), +); describe('useBarChartData', () => { beforeEach(() => { diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartData.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartData.ts index ab7d0cae49..0290b6401d 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartData.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/hooks/useBarChartData.ts @@ -5,7 +5,7 @@ import { graphWidgetHiddenLegendIdsComponentState } from '@/page-layout/widgets/ import { type GraphColorMode } from '@/page-layout/widgets/graph/types/GraphColorMode'; import { type GraphColorRegistry } from '@/page-layout/widgets/graph/types/GraphColorRegistry'; import { getColorScheme } from '@/page-layout/widgets/graph/utils/getColorScheme'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useMemo } from 'react'; type UseBarChartDataProps = { @@ -24,7 +24,7 @@ export const useBarChartData = ({ seriesLabels, colorMode, }: UseBarChartDataProps) => { - const hiddenLegendIds = useRecoilComponentValueV2( + const hiddenLegendIds = useAtomComponentStateValue( graphWidgetHiddenLegendIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetBarTooltipComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetBarTooltipComponentState.ts index 0930d69d35..21578fadd8 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetBarTooltipComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetBarTooltipComponentState.ts @@ -1,9 +1,9 @@ import { type BarChartSliceHoverData } from '@/page-layout/widgets/graph/graphWidgetBarChart/types/BarChartSliceHoverData'; import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const graphWidgetBarTooltipComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'graphWidgetBarTooltipComponentState', defaultValue: null, componentInstanceContext: WidgetComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetHoveredSliceIndexComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetHoveredSliceIndexComponentState.ts index 1307555365..cd84f7159c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetHoveredSliceIndexComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetBarChart/states/graphWidgetHoveredSliceIndexComponentState.ts @@ -1,8 +1,8 @@ import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const graphWidgetHoveredSliceIndexComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'graphWidgetHoveredSliceIndexComponentState', defaultValue: null, componentInstanceContext: WidgetComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx index 36001f08df..16f0cb9dfe 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomCrosshairLayer.tsx @@ -1,6 +1,6 @@ import { LINE_CHART_CONSTANTS } from '@/page-layout/widgets/graph/graphWidgetLineChart/constants/LineChartConstants'; import { graphWidgetLineCrosshairXComponentState } from '@/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineCrosshairXComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import { type LineSeries, type Point } from '@nivo/line'; import { motion } from 'framer-motion'; @@ -41,7 +41,7 @@ export const CustomCrosshairLayer = ({ onRectLeave, }: CustomCrosshairLayerProps) => { const theme = useTheme(); - const crosshairX = useRecoilComponentValueV2( + const crosshairX = useAtomComponentStateValue( graphWidgetLineCrosshairXComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomLinesLayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomLinesLayer.tsx index aa8fdbce46..ba1483245c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomLinesLayer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/CustomLinesLayer.tsx @@ -1,6 +1,6 @@ import { LEGEND_HIGHLIGHT_DIMMED_OPACITY } from '@/page-layout/widgets/graph/constants/LegendHighlightDimmedOpacity.constant'; import { graphWidgetHighlightedLegendIdComponentState } from '@/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useAnimatedPath } from '@nivo/core'; import { type ComputedSeries, @@ -31,7 +31,7 @@ const AnimatedLinePath = ({ }: AnimatedLinePathProps) => { const animatedPath = useAnimatedPath(path); - const highlightedLegendId = useRecoilComponentValueV2( + const highlightedLegendId = useAtomComponentStateValue( graphWidgetHighlightedLegendIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphLineChartTooltip.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphLineChartTooltip.tsx index 40d75b5887..17da3695c4 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphLineChartTooltip.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphLineChartTooltip.tsx @@ -5,7 +5,7 @@ import { type LineChartEnrichedSeries } from '@/page-layout/widgets/graph/graphW import { getLineChartTooltipData } from '@/page-layout/widgets/graph/graphWidgetLineChart/utils/getLineChartTooltipData'; import { createVirtualElementFromContainerOffset } from '@/page-layout/widgets/graph/utils/createVirtualElementFromContainerOffset'; import { type GraphValueFormatOptions } from '@/page-layout/widgets/graph/utils/graphFormatters'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type LineSeries, type Point } from '@nivo/line'; import { type RefObject } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -29,7 +29,7 @@ export const GraphLineChartTooltip = ({ onMouseEnter, onMouseLeave, }: GraphLineChartTooltipProps) => { - const tooltipState = useRecoilComponentValueV2( + const tooltipState = useAtomComponentStateValue( graphWidgetLineTooltipComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx index 5ceb4edfe1..c9ca88cd3b 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChart.tsx @@ -25,7 +25,7 @@ import { type GraphValueFormatOptions, } from '@/page-layout/widgets/graph/utils/graphFormatters'; import { NodeDimensionEffect } from '@/ui/utilities/dimensions/components/NodeDimensionEffect'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { @@ -131,11 +131,11 @@ export const GraphWidgetLineChart = ({ const hasClickableItems = isDefined(onSliceClick); - const setActiveLineTooltip = useSetRecoilComponentStateV2( + const setActiveLineTooltip = useSetAtomComponentState( graphWidgetLineTooltipComponentState, ); - const setCrosshairX = useSetRecoilComponentStateV2( + const setCrosshairX = useSetAtomComponentState( graphWidgetLineCrosshairXComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChartRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChartRenderer.tsx index ca8ce1084b..600dc41d95 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChartRenderer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/GraphWidgetLineChartRenderer.tsx @@ -10,8 +10,8 @@ import { isFilteredViewRedirectionSupported } from '@/page-layout/widgets/graph/ import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { useUserFirstDayOfTheWeek } from '@/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; import { type LineSeries, type Point } from '@nivo/line'; import { lazy, Suspense } from 'react'; @@ -56,7 +56,7 @@ export const GraphWidgetLineChartRenderer = () => { const navigate = useNavigate(); const configuration = widget.configuration; - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); @@ -89,7 +89,7 @@ export const GraphWidgetLineChartRenderer = () => { configuration.omitNullValues, ); - const indexViewId = useFamilySelectorValueV2( + const indexViewId = useAtomFamilySelectorValue( coreIndexViewIdFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/LineAnimatedAreaPath.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/LineAnimatedAreaPath.tsx index 045efc7cf1..a02706c40c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/LineAnimatedAreaPath.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/components/LineAnimatedAreaPath.tsx @@ -1,6 +1,6 @@ import { LEGEND_HIGHLIGHT_DIMMED_OPACITY } from '@/page-layout/widgets/graph/constants/LegendHighlightDimmedOpacity.constant'; import { graphWidgetHighlightedLegendIdComponentState } from '@/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useAnimatedPath } from '@nivo/core'; import { animated } from '@react-spring/web'; import { isDefined } from 'twenty-shared/utils'; @@ -18,7 +18,7 @@ export const LineAnimatedAreaPath = ({ }: LineAnimatedAreaPathProps) => { const animatedPath = useAnimatedPath(path); - const highlightedLegendId = useRecoilComponentValueV2( + const highlightedLegendId = useAtomComponentStateValue( graphWidgetHighlightedLegendIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/__tests__/useLineChartData.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/__tests__/useLineChartData.test.ts index f217b87091..6d4ac830eb 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/__tests__/useLineChartData.test.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/__tests__/useLineChartData.test.ts @@ -6,9 +6,12 @@ import { useLineChartData } from '@/page-layout/widgets/graph/graphWidgetLineCha import { type LineChartSeries } from '~/generated-metadata/graphql'; const mockUseRecoilComponentValue = jest.fn(); -jest.mock('@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2', () => ({ - useRecoilComponentValueV2: () => mockUseRecoilComponentValue(), -})); +jest.mock( + '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue', + () => ({ + useAtomComponentStateValue: () => mockUseRecoilComponentValue(), + }), +); describe('useLineChartData', () => { beforeEach(() => { diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartData.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartData.ts index 27bf72e154..bf5af19a6b 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartData.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/hooks/useLineChartData.ts @@ -5,7 +5,7 @@ import { graphWidgetHiddenLegendIdsComponentState } from '@/page-layout/widgets/ import { type GraphColorMode } from '@/page-layout/widgets/graph/types/GraphColorMode'; import { type GraphColorRegistry } from '@/page-layout/widgets/graph/types/GraphColorRegistry'; import { getColorScheme } from '@/page-layout/widgets/graph/utils/getColorScheme'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type LineSeries } from '@nivo/line'; import { useMemo } from 'react'; @@ -22,7 +22,7 @@ export const useLineChartData = ({ id, colorMode, }: UseLineChartDataProps) => { - const hiddenLegendIds = useRecoilComponentValueV2( + const hiddenLegendIds = useAtomComponentStateValue( graphWidgetHiddenLegendIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineCrosshairXComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineCrosshairXComponentState.ts index d3760dee85..51c521aed0 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineCrosshairXComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineCrosshairXComponentState.ts @@ -1,7 +1,7 @@ import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const graphWidgetLineCrosshairXComponentState = createComponentStateV2< +export const graphWidgetLineCrosshairXComponentState = createAtomComponentState< number | null >({ key: 'graphWidgetLineCrosshairXComponentState', diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineTooltipComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineTooltipComponentState.ts index 7c3ba5748d..5a82ecee1c 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineTooltipComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetLineChart/states/graphWidgetLineTooltipComponentState.ts @@ -1,8 +1,8 @@ import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type LineSeries, type SliceTooltipProps } from '@nivo/line'; -export const graphWidgetLineTooltipComponentState = createComponentStateV2<{ +export const graphWidgetLineTooltipComponentState = createAtomComponentState<{ slice: SliceTooltipProps['slice']; offsetLeft: number; offsetTop: number; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/CustomArcsLayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/CustomArcsLayer.tsx index 195e08787d..4bb8f0035f 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/CustomArcsLayer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/CustomArcsLayer.tsx @@ -1,7 +1,7 @@ import { LEGEND_HIGHLIGHT_DIMMED_OPACITY } from '@/page-layout/widgets/graph/constants/LegendHighlightDimmedOpacity.constant'; import { type PieChartDataItemWithColor } from '@/page-layout/widgets/graph/graphWidgetPieChart/types/PieChartDataItem'; import { graphWidgetHighlightedLegendIdComponentState } from '@/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useArcsTransition } from '@nivo/arcs'; import { type MouseEventHandler, type PieCustomLayerProps } from '@nivo/pie'; import { animated } from '@react-spring/web'; @@ -27,7 +27,7 @@ export const CustomArcsLayer = ({ onMouseLeave, onClick, }: CustomArcsLayerProps) => { - const highlightedLegendId = useRecoilComponentValueV2( + const highlightedLegendId = useAtomComponentStateValue( graphWidgetHighlightedLegendIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphPieChartTooltip.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphPieChartTooltip.tsx index 41ed3ba40e..548d3af9a3 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphPieChartTooltip.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphPieChartTooltip.tsx @@ -6,7 +6,7 @@ import { type PieChartEnrichedData } from '@/page-layout/widgets/graph/graphWidg import { getPieChartTooltipData } from '@/page-layout/widgets/graph/graphWidgetPieChart/utils/getPieChartTooltipData'; import { createVirtualElementFromContainerOffset } from '@/page-layout/widgets/graph/utils/createVirtualElementFromContainerOffset'; import { type GraphValueFormatOptions } from '@/page-layout/widgets/graph/utils/graphFormatters'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type RefObject } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -25,7 +25,7 @@ export const GraphPieChartTooltip = ({ displayType, onSliceClick, }: GraphPieChartTooltipProps) => { - const tooltipState = useRecoilComponentValueV2( + const tooltipState = useAtomComponentStateValue( graphWidgetPieTooltipComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChart.tsx index 1553258074..bb78d3b056 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChart.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChart.tsx @@ -13,7 +13,7 @@ import { getPieChartFormattedValue } from '@/page-layout/widgets/graph/graphWidg import { type GraphColorMode } from '@/page-layout/widgets/graph/types/GraphColorMode'; import { createGraphColorRegistry } from '@/page-layout/widgets/graph/utils/createGraphColorRegistry'; import { type GraphValueFormatOptions } from '@/page-layout/widgets/graph/utils/graphFormatters'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { @@ -91,7 +91,7 @@ export const GraphWidgetPieChart = ({ const theme = useTheme(); const colorRegistry = createGraphColorRegistry(theme); const containerRef = useRef(null); - const setActivePieTooltip = useSetRecoilComponentStateV2( + const setActivePieTooltip = useSetAtomComponentState( graphWidgetPieTooltipComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChartRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChartRenderer.tsx index 320eba3ad4..96991b2f58 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChartRenderer.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/components/GraphWidgetPieChartRenderer.tsx @@ -9,8 +9,8 @@ import { isFilteredViewRedirectionSupported } from '@/page-layout/widgets/graph/ import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget'; import { useUserFirstDayOfTheWeek } from '@/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; import { lazy, Suspense } from 'react'; import { useNavigate } from 'react-router-dom'; @@ -49,10 +49,10 @@ export const GraphWidgetPieChartRenderer = () => { const navigate = useNavigate(); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); - const indexViewId = useFamilySelectorValueV2( + const indexViewId = useAtomFamilySelectorValue( coreIndexViewIdFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/__tests__/usePieChartData.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/__tests__/usePieChartData.test.ts index 22d227522d..9082e4e1db 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/__tests__/usePieChartData.test.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/__tests__/usePieChartData.test.ts @@ -5,9 +5,12 @@ import { renderHook } from '@testing-library/react'; import { type PieChartDataItem } from '~/generated-metadata/graphql'; const mockUseRecoilComponentValue = jest.fn(); -jest.mock('@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2', () => ({ - useRecoilComponentValueV2: () => mockUseRecoilComponentValue(), -})); +jest.mock( + '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue', + () => ({ + useAtomComponentStateValue: () => mockUseRecoilComponentValue(), + }), +); describe('usePieChartData', () => { beforeEach(() => { diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartCenterMetricData.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartCenterMetricData.ts index 0e5a83b0d8..ae1aee06c9 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartCenterMetricData.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartCenterMetricData.ts @@ -5,7 +5,7 @@ import { getAggregateOperationLabel } from '@/object-record/record-board/record- import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations'; import { convertAggregateOperationToExtendedAggregateOperation } from '@/object-record/utils/convertAggregateOperationToExtendedAggregateOperation'; import { useGraphWidgetQueryCommon } from '@/page-layout/widgets/graph/hooks/useGraphWidgetQueryCommon'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { t } from '@lingui/core/macro'; import { useContext, useMemo } from 'react'; @@ -80,7 +80,7 @@ export const usePieChartCenterMetricData = ({ }); const { dateFormat, timeFormat, timeZone } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); const aggregateFieldMetadataItem = objectMetadataItem.readableFields.find( findById(configuration.aggregateFieldMetadataId), diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartData.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartData.ts index bc58c9b06e..7b2dc73bd2 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartData.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/hooks/usePieChartData.ts @@ -6,7 +6,7 @@ import { graphWidgetHiddenLegendIdsComponentState } from '@/page-layout/widgets/ import { type GraphColorMode } from '@/page-layout/widgets/graph/types/GraphColorMode'; import { type GraphColorRegistry } from '@/page-layout/widgets/graph/types/GraphColorRegistry'; import { getColorScheme } from '@/page-layout/widgets/graph/utils/getColorScheme'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useMemo } from 'react'; type UsePieChartDataProps = { @@ -20,7 +20,7 @@ export const usePieChartData = ({ colorRegistry, colorMode, }: UsePieChartDataProps) => { - const hiddenLegendIds = useRecoilComponentValueV2( + const hiddenLegendIds = useAtomComponentStateValue( graphWidgetHiddenLegendIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/states/graphWidgetPieTooltipComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/states/graphWidgetPieTooltipComponentState.ts index fbf1824f24..e6ec652c8d 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/states/graphWidgetPieTooltipComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graphWidgetPieChart/states/graphWidgetPieTooltipComponentState.ts @@ -1,9 +1,9 @@ import { type PieChartDataItemWithColor } from '@/page-layout/widgets/graph/graphWidgetPieChart/types/PieChartDataItem'; import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type ComputedDatum } from '@nivo/pie'; -export const graphWidgetPieTooltipComponentState = createComponentStateV2<{ +export const graphWidgetPieTooltipComponentState = createAtomComponentState<{ datum: ComputedDatum; offsetLeft: number; offsetTop: number; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useGraphWidgetAggregateQuery.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useGraphWidgetAggregateQuery.ts index aa44e29863..eed5c3d53d 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useGraphWidgetAggregateQuery.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useGraphWidgetAggregateQuery.ts @@ -8,7 +8,7 @@ import { convertAggregateOperationToExtendedAggregateOperation } from '@/object- import { buildRatioNumeratorFilter } from '@/page-layout/widgets/graph/graphWidgetAggregateChart/utils/buildRatioNumeratorFilter'; import { computeRatioDisplayValue } from '@/page-layout/widgets/graph/graphWidgetAggregateChart/utils/computeRatioDisplayValue'; import { useGraphWidgetQueryCommon } from '@/page-layout/widgets/graph/hooks/useGraphWidgetQueryCommon'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { t } from '@lingui/core/macro'; import { useContext } from 'react'; @@ -88,7 +88,7 @@ export const useGraphWidgetAggregateQuery = ({ }); const { dateFormat, timeFormat, timeZone } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); if (isRatioQuery) { const isRatioLoading = ratioNumeratorLoading || ratioDenominatorLoading; diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useLegendItemToggle.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useLegendItemToggle.ts index 9aa26c43f7..d39c62b8f9 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useLegendItemToggle.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/hooks/useLegendItemToggle.ts @@ -1,5 +1,5 @@ import { graphWidgetHiddenLegendIdsComponentState } from '@/page-layout/widgets/graph/states/graphWidgetHiddenLegendIdsComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useCallback } from 'react'; type UseLegendItemToggleProps = { @@ -11,7 +11,7 @@ export const useLegendItemToggle = ({ itemIds, isInteractive, }: UseLegendItemToggleProps) => { - const setHiddenLegendIds = useSetRecoilComponentStateV2( + const setHiddenLegendIds = useSetAtomComponentState( graphWidgetHiddenLegendIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHiddenLegendIdsComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHiddenLegendIdsComponentState.ts index bc02bd46da..3875bcf375 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHiddenLegendIdsComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHiddenLegendIdsComponentState.ts @@ -1,10 +1,9 @@ import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const graphWidgetHiddenLegendIdsComponentState = createComponentStateV2< - string[] ->({ - key: 'graphWidgetHiddenLegendIdsComponentState', - defaultValue: [], - componentInstanceContext: WidgetComponentInstanceContext, -}); +export const graphWidgetHiddenLegendIdsComponentState = + createAtomComponentState({ + key: 'graphWidgetHiddenLegendIdsComponentState', + defaultValue: [], + componentInstanceContext: WidgetComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState.ts index 4ff6297469..04e595bebe 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/states/graphWidgetHighlightedLegendIdComponentState.ts @@ -1,8 +1,8 @@ import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const graphWidgetHighlightedLegendIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'graphWidgetHighlightedLegendIdComponentState', defaultValue: null, componentInstanceContext: WidgetComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/states/hasWidgetTooManyGroupsComponentState.ts b/packages/twenty-front/src/modules/page-layout/widgets/graph/states/hasWidgetTooManyGroupsComponentState.ts index f20575c766..a73d2acd9b 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/graph/states/hasWidgetTooManyGroupsComponentState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/states/hasWidgetTooManyGroupsComponentState.ts @@ -1,8 +1,8 @@ import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const hasWidgetTooManyGroupsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'hasWidgetTooManyGroupsComponentState', defaultValue: false, componentInstanceContext: WidgetComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts index 604469c080..ba525bc582 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts @@ -4,14 +4,14 @@ import { buildWidgetVisibilityContext } from '@/page-layout/utils/buildWidgetVis import { filterVisibleWidgets } from '@/page-layout/utils/filterVisibleWidgets'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useIsCurrentWidgetLastOfTab = (widgetId: string): boolean => { const { currentPageLayout } = useCurrentPageLayout(); const isMobile = useIsMobile(); const { isInRightDrawer } = useLayoutRenderingContext(); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts index 6f823912bd..a71e78da60 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsInPinnedTab.ts @@ -4,7 +4,7 @@ import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPag import { getTabsByDisplayMode } from '@/page-layout/utils/getTabsByDisplayMode'; import { getTabsWithVisibleWidgets } from '@/page-layout/utils/getTabsWithVisibleWidgets'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isDefined } from 'twenty-shared/utils'; import { useIsMobile } from 'twenty-ui/utilities'; @@ -15,7 +15,7 @@ export const useIsInPinnedTab = () => { const { isInRightDrawer } = useLayoutRenderingContext(); const { currentPageLayout } = useCurrentPageLayoutOrThrow(); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/iframe/components/IframeWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/iframe/components/IframeWidget.tsx index fd0c37dea7..b6e7664be9 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/iframe/components/IframeWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/iframe/components/IframeWidget.tsx @@ -1,5 +1,5 @@ import { isPageLayoutInEditModeComponentState } from '@/page-layout/states/isPageLayoutInEditModeComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { PageLayoutWidgetNoDataDisplay } from '@/page-layout/widgets/components/PageLayoutWidgetNoDataDisplay'; import { WidgetSkeletonLoader } from '@/page-layout/widgets/components/WidgetSkeletonLoader'; @@ -56,7 +56,7 @@ export type IframeWidgetProps = { }; export const IframeWidget = ({ widget }: IframeWidgetProps) => { - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextEditorContent.tsx b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextEditorContent.tsx index 8d36f704c1..0753d0f8be 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextEditorContent.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextEditorContent.tsx @@ -16,7 +16,7 @@ import { parseInitialBlocknote } from '@/blocknote-editor/utils/parseInitialBloc import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks/useRemoveFocusItemFromFocusStackById'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import '@blocknote/core/fonts/inter.css'; import '@blocknote/mantine/style.css'; import { useCreateBlockNote } from '@blocknote/react'; @@ -45,10 +45,10 @@ export const StandaloneRichTextEditorContent = ({ const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); const { removeFocusItemFromFocusStackById } = useRemoveFocusItemFromFocusStackById(); - const isPageLayoutInEditModeState = useRecoilComponentStateCallbackStateV2( + const isPageLayoutInEditModeState = useAtomComponentStateCallbackState( isPageLayoutInEditModeComponentState, ); - const pageLayoutEditingWidgetIdState = useRecoilComponentStateCallbackStateV2( + const pageLayoutEditingWidgetIdState = useAtomComponentStateCallbackState( pageLayoutEditingWidgetIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextWidget.tsx b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextWidget.tsx index 99deca84f0..a2937c1820 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextWidget.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextWidget.tsx @@ -10,7 +10,7 @@ import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget'; import { StandaloneRichTextEditorContent } from '@/page-layout/widgets/standalone-rich-text/components/StandaloneRichTextEditorContent'; import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -39,11 +39,11 @@ export const StandaloneRichTextWidget = ({ widget, }: StandaloneRichTextWidgetProps) => { const containerElementRef = useRef(null); - const isPageLayoutInEditMode = useRecoilComponentValueV2( + const isPageLayoutInEditMode = useAtomComponentStateValue( isPageLayoutInEditModeComponentState, ); - const editingWidgetId = useRecoilComponentValueV2( + const editingWidgetId = useAtomComponentStateValue( pageLayoutEditingWidgetIdComponentState, ); diff --git a/packages/twenty-front/src/modules/page-layout/widgets/states/widgetCardHoveredComponentFamilyState.ts b/packages/twenty-front/src/modules/page-layout/widgets/states/widgetCardHoveredComponentFamilyState.ts index 5c4add85f8..09d994ad80 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/states/widgetCardHoveredComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/page-layout/widgets/states/widgetCardHoveredComponentFamilyState.ts @@ -1,8 +1,8 @@ import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const widgetCardHoveredComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'widgetCardHoveredComponentFamilyState', defaultValue: false, componentInstanceContext: PageLayoutComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx index 8a604ca7b3..314cd61a51 100644 --- a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx +++ b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeader.tsx @@ -1,7 +1,7 @@ import { WidgetActionRenderer } from '@/page-layout/widgets/components/WidgetActionRenderer'; import { widgetCardHoveredComponentFamilyState } from '@/page-layout/widgets/states/widgetCardHoveredComponentFamilyState'; import { type WidgetAction } from '@/page-layout/widgets/types/WidgetAction'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { css, useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -90,7 +90,7 @@ export const WidgetCardHeader = ({ }: WidgetCardHeaderProps) => { const theme = useTheme(); - const isWidgetCardHovered = useRecoilComponentFamilyValueV2( + const isWidgetCardHovered = useAtomComponentFamilyStateValue( widgetCardHoveredComponentFamilyState, widgetId, ); diff --git a/packages/twenty-front/src/modules/prefetch/components/PrefetchRunFavoriteQueriesEffect.tsx b/packages/twenty-front/src/modules/prefetch/components/PrefetchRunFavoriteQueriesEffect.tsx index 0d50932101..a035b00fe6 100644 --- a/packages/twenty-front/src/modules/prefetch/components/PrefetchRunFavoriteQueriesEffect.tsx +++ b/packages/twenty-front/src/modules/prefetch/components/PrefetchRunFavoriteQueriesEffect.tsx @@ -11,9 +11,9 @@ import { prefetchFavoritesState } from '@/prefetch/states/prefetchFavoritesState import { prefetchIsLoadedFamilyState } from '@/prefetch/states/prefetchIsLoadedFamilyState'; import { PrefetchKey } from '@/prefetch/types/PrefetchKey'; import { useShowAuthModal } from '@/ui/layout/hooks/useShowAuthModal'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useCallback, useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -31,26 +31,24 @@ export const PrefetchRunFavoriteQueriesEffect = () => { ); const showAuthModal = useShowAuthModal(); const isSettingsPage = useIsSettingsPage(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const isWorkspaceActive = currentWorkspace?.activationStatus === WorkspaceActivationStatus.ACTIVE; const { objectMetadataItems } = useObjectMetadataItems(); - const setIsPrefetchFavoritesLoaded = useSetFamilyRecoilStateV2( + const setIsPrefetchFavoritesLoaded = useSetAtomFamilyState( prefetchIsLoadedFamilyState, PrefetchKey.AllFavorites, ); - const setIsPrefetchFavoritesFoldersLoaded = useSetFamilyRecoilStateV2( + const setIsPrefetchFavoritesFoldersLoaded = useSetAtomFamilyState( prefetchIsLoadedFamilyState, PrefetchKey.AllFavoritesFolders, ); - const setFavoritesState = useSetRecoilStateV2(prefetchFavoritesState); - const setFavoriteFoldersState = useSetRecoilStateV2( - prefetchFavoriteFoldersState, - ); + const setFavoritesState = useSetAtomState(prefetchFavoritesState); + const setFavoriteFoldersState = useSetAtomState(prefetchFavoriteFoldersState); const { objectMetadataItem: favoriteObjectMetadataItem } = useObjectMetadataItem({ diff --git a/packages/twenty-front/src/modules/prefetch/components/PrefetchRunNavigationMenuItemQueriesEffect.tsx b/packages/twenty-front/src/modules/prefetch/components/PrefetchRunNavigationMenuItemQueriesEffect.tsx index d9b4a24c65..c763aed596 100644 --- a/packages/twenty-front/src/modules/prefetch/components/PrefetchRunNavigationMenuItemQueriesEffect.tsx +++ b/packages/twenty-front/src/modules/prefetch/components/PrefetchRunNavigationMenuItemQueriesEffect.tsx @@ -4,9 +4,9 @@ import { prefetchIsLoadedFamilyState } from '@/prefetch/states/prefetchIsLoadedF import { prefetchNavigationMenuItemsState } from '@/prefetch/states/prefetchNavigationMenuItemsState'; import { PrefetchKey } from '@/prefetch/types/PrefetchKey'; import { useShowAuthModal } from '@/ui/layout/hooks/useShowAuthModal'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useCallback, useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -27,16 +27,16 @@ export const PrefetchRunNavigationMenuItemQueriesEffect = () => { const showAuthModal = useShowAuthModal(); const isSettingsPage = useIsSettingsPage(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const isWorkspaceActive = currentWorkspace?.activationStatus === WorkspaceActivationStatus.ACTIVE; - const setIsPrefetchNavigationMenuItemsLoaded = useSetFamilyRecoilStateV2( + const setIsPrefetchNavigationMenuItemsLoaded = useSetAtomFamilyState( prefetchIsLoadedFamilyState, PrefetchKey.AllNavigationMenuItems, ); - const setNavigationMenuItemsState = useSetRecoilStateV2( + const setNavigationMenuItemsState = useSetAtomState( prefetchNavigationMenuItemsState, ); diff --git a/packages/twenty-front/src/modules/prefetch/hooks/useIsPrefetchLoading.ts b/packages/twenty-front/src/modules/prefetch/hooks/useIsPrefetchLoading.ts index 2769011b34..a3e5cde866 100644 --- a/packages/twenty-front/src/modules/prefetch/hooks/useIsPrefetchLoading.ts +++ b/packages/twenty-front/src/modules/prefetch/hooks/useIsPrefetchLoading.ts @@ -1,6 +1,6 @@ import { prefetchIsLoadedFamilyState } from '@/prefetch/states/prefetchIsLoadedFamilyState'; import { PrefetchKey } from '@/prefetch/types/PrefetchKey'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo'; import { WorkspaceActivationStatus } from 'twenty-shared/workspace'; @@ -8,12 +8,12 @@ export const useIsPrefetchLoading = () => { const isWorkspaceActive = useIsWorkspaceActivationStatusEqualsTo( WorkspaceActivationStatus.ACTIVE, ); - const isFavoriteFoldersPrefetched = useFamilyRecoilValueV2( + const isFavoriteFoldersPrefetched = useAtomFamilyStateValue( prefetchIsLoadedFamilyState, PrefetchKey.AllFavoritesFolders, ); - const areFavoritesPrefetched = useFamilyRecoilValueV2( + const areFavoritesPrefetched = useAtomFamilyStateValue( prefetchIsLoadedFamilyState, PrefetchKey.AllFavorites, ); diff --git a/packages/twenty-front/src/modules/prefetch/states/prefetchFavoriteFoldersState.ts b/packages/twenty-front/src/modules/prefetch/states/prefetchFavoriteFoldersState.ts index 3eb173ddbf..1afb654190 100644 --- a/packages/twenty-front/src/modules/prefetch/states/prefetchFavoriteFoldersState.ts +++ b/packages/twenty-front/src/modules/prefetch/states/prefetchFavoriteFoldersState.ts @@ -1,7 +1,7 @@ import { type FavoriteFolder } from '@/favorites/types/FavoriteFolder'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const prefetchFavoriteFoldersState = createStateV2({ +export const prefetchFavoriteFoldersState = createAtomState({ key: 'prefetchFavoriteFoldersState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/prefetch/states/prefetchFavoritesState.ts b/packages/twenty-front/src/modules/prefetch/states/prefetchFavoritesState.ts index 28355b4573..85a34a19c9 100644 --- a/packages/twenty-front/src/modules/prefetch/states/prefetchFavoritesState.ts +++ b/packages/twenty-front/src/modules/prefetch/states/prefetchFavoritesState.ts @@ -1,7 +1,7 @@ import { type Favorite } from '@/favorites/types/Favorite'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const prefetchFavoritesState = createStateV2({ +export const prefetchFavoritesState = createAtomState({ key: 'prefetchFavoritesState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/prefetch/states/prefetchIsLoadedFamilyState.ts b/packages/twenty-front/src/modules/prefetch/states/prefetchIsLoadedFamilyState.ts index 3189f4c29d..d207d10477 100644 --- a/packages/twenty-front/src/modules/prefetch/states/prefetchIsLoadedFamilyState.ts +++ b/packages/twenty-front/src/modules/prefetch/states/prefetchIsLoadedFamilyState.ts @@ -1,7 +1,7 @@ import { type PrefetchKey } from '@/prefetch/types/PrefetchKey'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const prefetchIsLoadedFamilyState = createFamilyStateV2< +export const prefetchIsLoadedFamilyState = createAtomFamilyState< boolean, PrefetchKey >({ diff --git a/packages/twenty-front/src/modules/prefetch/states/prefetchNavigationMenuItemsState.ts b/packages/twenty-front/src/modules/prefetch/states/prefetchNavigationMenuItemsState.ts index 5855e3cf72..35151380f4 100644 --- a/packages/twenty-front/src/modules/prefetch/states/prefetchNavigationMenuItemsState.ts +++ b/packages/twenty-front/src/modules/prefetch/states/prefetchNavigationMenuItemsState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type NavigationMenuItem } from '~/generated-metadata/graphql'; -export const prefetchNavigationMenuItemsState = createStateV2< +export const prefetchNavigationMenuItemsState = createAtomState< NavigationMenuItem[] >({ key: 'prefetchNavigationMenuItemsState', diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistSection.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistSection.tsx index dc69b8c3f5..b6b62a1d0b 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistSection.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistSection.tsx @@ -1,6 +1,6 @@ import { type BlocklistItem } from '@/accounts/types/BlocklistItem'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord'; import { useDeleteOneRecord } from '@/object-record/hooks/useDeleteOneRecord'; @@ -15,7 +15,7 @@ import { Section } from 'twenty-ui/layout'; export const SettingsAccountsBlocklistSection = () => { const { t } = useLingui(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const currentWorkspaceMemberId = currentWorkspaceMember?.id ?? ''; diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsContainer.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsContainer.tsx index 0f1580b254..c88f63cab0 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsContainer.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsContainer.tsx @@ -6,7 +6,7 @@ import { } from '@/accounts/types/CalendarChannel'; import { type ConnectedAccount } from '@/accounts/types/ConnectedAccount'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; import { SettingsAccountsCalendarChannelDetails } from '@/settings/accounts/components/SettingsAccountsCalendarChannelDetails'; @@ -14,7 +14,7 @@ import { SettingsNewAccountSection } from '@/settings/accounts/components/Settin import { SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID } from '@/settings/accounts/constants/SettingsAccountCalendarChannelsTabListComponentId'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import React from 'react'; const StyledCalenderContainer = styled.div` @@ -22,11 +22,11 @@ const StyledCalenderContainer = styled.div` `; export const SettingsAccountsCalendarChannelsContainer = () => { - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, SETTINGS_ACCOUNT_CALENDAR_CHANNELS_TAB_LIST_COMPONENT_ID, ); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { records: accounts } = useFindManyRecords({ objectNameSingular: CoreObjectNameSingular.ConnectedAccount, diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsGeneral.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsGeneral.tsx index c4374c8dde..67668cb28b 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsGeneral.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelsGeneral.tsx @@ -6,7 +6,7 @@ import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { Section } from '@react-email/components'; import { addMinutes, endOfDay, min, startOfDay } from 'date-fns'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { H2Title } from 'twenty-ui/display'; import { CalendarChannelVisibility, @@ -21,7 +21,7 @@ const StyledGeneralContainer = styled.div` `; export const SettingsAccountsCalendarChannelsGeneral = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const exampleStartDate = new Date(); const exampleEndDate = min([ diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx index 241668e2ba..91cacff9d6 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsListEmptyStateCard.tsx @@ -8,7 +8,7 @@ import { SettingsCard } from '@/settings/components/SettingsCard'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { ConnectedAccountProvider, SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; import { IconAt, IconGoogle, IconMicrosoft } from 'twenty-ui/display'; @@ -26,22 +26,22 @@ export const SettingsAccountsListEmptyStateCard = () => { const { t } = useLingui(); const theme = useTheme(); - const isGoogleMessagingEnabled = useRecoilValueV2( + const isGoogleMessagingEnabled = useAtomStateValue( isGoogleMessagingEnabledState, ); - const isMicrosoftMessagingEnabled = useRecoilValueV2( + const isMicrosoftMessagingEnabled = useAtomStateValue( isMicrosoftMessagingEnabledState, ); - const isGoogleCalendarEnabled = useRecoilValueV2( + const isGoogleCalendarEnabled = useAtomStateValue( isGoogleCalendarEnabledState, ); - const isMicrosoftCalendarEnabled = useRecoilValueV2( + const isMicrosoftCalendarEnabled = useAtomStateValue( isMicrosoftCalendarEnabledState, ); - const isImapSmtpCaldavEnabled = useRecoilValueV2( + const isImapSmtpCaldavEnabled = useAtomStateValue( isImapSmtpCaldavEnabledState, ); diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx index 2a6c370aa5..897871e471 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelsContainer.tsx @@ -6,7 +6,7 @@ import { MessageChannelSyncStage, } from '@/accounts/types/MessageChannel'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useGenerateDepthRecordGqlFieldsFromObject } from '@/object-record/graphql/record-gql-fields/hooks/useGenerateDepthRecordGqlFieldsFromObject'; import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords'; @@ -14,10 +14,10 @@ import { SettingsAccountsMessageChannelDetails } from '@/settings/accounts/compo import { SettingsNewAccountSection } from '@/settings/accounts/components/SettingsNewAccountSection'; import { SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID } from '@/settings/accounts/constants/SettingsAccountMessageChannelsTabListComponentId'; import { settingsAccountsSelectedMessageChannelStateV2 } from '@/settings/accounts/states/settingsAccountsSelectedMessageChannelStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import React, { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -26,12 +26,12 @@ const StyledMessageContainer = styled.div` `; export const SettingsAccountsMessageChannelsContainer = () => { - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, SETTINGS_ACCOUNT_MESSAGE_CHANNELS_TAB_LIST_COMPONENT_ID, ); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); - const setSelectedMessageChannel = useSetRecoilStateV2( + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); + const setSelectedMessageChannel = useSetAtomState( settingsAccountsSelectedMessageChannelStateV2, ); diff --git a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx index ebe950856b..9496527804 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/message-folders/SettingsAccountsMessageFoldersCard.tsx @@ -17,7 +17,7 @@ import { TableCell } from '@/ui/layout/table/components/TableCell'; import { ApolloError } from '@apollo/client'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useMemo, useState } from 'react'; import { Label } from 'twenty-ui/display'; import { Checkbox, CheckboxSize } from 'twenty-ui/input'; @@ -72,7 +72,7 @@ export const SettingsAccountsMessageFoldersCard = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const settingsAccountsSelectedMessageChannel = useRecoilValueV2( + const settingsAccountsSelectedMessageChannel = useAtomStateValue( settingsAccountsSelectedMessageChannelStateV2, ); diff --git a/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts b/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts index 54458be82e..acd4c35e8f 100644 --- a/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts +++ b/packages/twenty-front/src/modules/settings/accounts/hooks/useImapSmtpCaldavConnectionForm.ts @@ -3,7 +3,7 @@ import { useCallback, useMemo } from 'react'; import { useForm } from 'react-hook-form'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { t } from '@lingui/core/macro'; @@ -41,7 +41,7 @@ export const useImapSmtpCaldavConnectionForm = ({ connectedAccountId, }: UseConnectionFormProps = {}) => { const navigate = useNavigateSettings(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const formMethods = useForm({ mode: 'onSubmit', diff --git a/packages/twenty-front/src/modules/settings/accounts/states/settingsAccountsSelectedMessageChannelStateV2.ts b/packages/twenty-front/src/modules/settings/accounts/states/settingsAccountsSelectedMessageChannelStateV2.ts index 05b882119c..7c4ad3fc67 100644 --- a/packages/twenty-front/src/modules/settings/accounts/states/settingsAccountsSelectedMessageChannelStateV2.ts +++ b/packages/twenty-front/src/modules/settings/accounts/states/settingsAccountsSelectedMessageChannelStateV2.ts @@ -1,9 +1,9 @@ import { type MessageChannel } from '@/accounts/types/MessageChannel'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const settingsAccountsSelectedMessageChannelStateV2 = - createStateV2({ + createAtomState({ key: 'settingsAccountsSelectedMessageChannelStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminContent.tsx index 62e4dfb863..bc522ff769 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminContent.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminContent.tsx @@ -10,10 +10,10 @@ import { IconSparkles, IconVariable, } from 'twenty-ui/display'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const SettingsAdminContent = () => { - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const canAccessFullAdminPanel = currentUser?.canAccessFullAdminPanel; const canImpersonate = currentUser?.canImpersonate; diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx index f1e96330f2..fdc8c85107 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminGeneral.tsx @@ -8,18 +8,18 @@ import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/consta import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { isNonEmptyString } from '@sniptt/guards'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useState } from 'react'; import { REACT_APP_SERVER_BASE_URL } from '~/config'; import { useUserLookupAdminPanelMutation } from '~/generated-metadata/graphql'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsAdminTableCard } from '@/settings/admin-panel/components/SettingsAdminTableCard'; import { SettingsAdminVersionContainer } from '@/settings/admin-panel/components/SettingsAdminVersionContainer'; import { SETTINGS_ADMIN_USER_LOOKUP_WORKSPACE_TABS_ID } from '@/settings/admin-panel/constants/SettingsAdminUserLookupWorkspaceTabsId'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils'; import { H2Title, @@ -42,24 +42,24 @@ export const SettingsAdminGeneral = () => { const [userIdentifier, setUserIdentifier] = useState(''); const { enqueueErrorSnackBar } = useSnackBar(); - const [activeTabId, setActiveTabId] = useRecoilComponentStateV2( + const [activeTabId, setActiveTabId] = useAtomComponentState( activeTabIdComponentState, SETTINGS_ADMIN_USER_LOOKUP_WORKSPACE_TABS_ID, ); - const [userLookupResult, setUserLookupResult] = useRecoilStateV2( + const [userLookupResult, setUserLookupResult] = useAtomState( userLookupResultStateV2, ); const [isUserLookupLoading, setIsUserLookupLoading] = useState(false); const [userLookup] = useUserLookupAdminPanelMutation(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const canAccessFullAdminPanel = currentUser?.canAccessFullAdminPanel; const canImpersonate = currentUser?.canImpersonate; - const canManageFeatureFlags = useRecoilValueV2(canManageFeatureFlagsState); + const canManageFeatureFlags = useAtomStateValue(canManageFeatureFlagsState); const handleSearch = async () => { setActiveTabId(''); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabContent.tsx index bd6b7cec17..6387007601 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabContent.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminTabContent.tsx @@ -5,10 +5,10 @@ import { SETTINGS_ADMIN_TABS } from '@/settings/admin-panel/constants/SettingsAd import { SETTINGS_ADMIN_TABS_ID } from '@/settings/admin-panel/constants/SettingsAdminTabsId'; import { SettingsAdminHealthStatus } from '@/settings/admin-panel/health-status/components/SettingsAdminHealthStatus'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const SettingsAdminTabContent = () => { - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, SETTINGS_ADMIN_TABS_ID, ); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx index 08abddb5fc..6fd64374bc 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx @@ -18,10 +18,10 @@ import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/consta import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { isNonEmptyString } from '@sniptt/guards'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useState } from 'react'; import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { AvatarChip, Chip } from 'twenty-ui/components'; import { H2Title, @@ -58,10 +58,10 @@ const StyledButtonContainer = styled.div` export const SettingsAdminWorkspaceContent = ({ activeWorkspace, }: SettingsAdminWorkspaceContentProps) => { - const canManageFeatureFlags = useRecoilValueV2(canManageFeatureFlagsState); + const canManageFeatureFlags = useAtomStateValue(canManageFeatureFlagsState); const { enqueueErrorSnackBar } = useSnackBar(); - const [currentUser] = useRecoilStateV2(currentUserState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const [currentUser] = useAtomState(currentUserState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const [updateFeatureFlag] = useUpdateWorkspaceFeatureFlagMutation(); const [isImpersonateLoading, setIsImpersonationLoading] = useState(false); @@ -70,7 +70,7 @@ export const SettingsAdminWorkspaceContent = ({ const [impersonate] = useImpersonateMutation(); const { updateFeatureFlagState } = useFeatureFlagState(); - const userLookupResult = useRecoilValueV2(userLookupResultStateV2); + const userLookupResult = useAtomStateValue(userLookupResultStateV2); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableActionButtons.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableActionButtons.tsx index 6e4a16cf9b..f6706f33df 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableActionButtons.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableActionButtons.tsx @@ -1,5 +1,5 @@ import { useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isConfigVariablesInDbEnabledState } from '@/client-config/states/isConfigVariablesInDbEnabledState'; import { @@ -29,7 +29,7 @@ export const ConfigVariableActionButtons = ({ onReset, }: ConfigVariableActionButtonsProps) => { const { t } = useLingui(); - const isConfigVariablesInDbEnabled = useRecoilValueV2( + const isConfigVariablesInDbEnabled = useAtomStateValue( isConfigVariablesInDbEnabledState, ); const isFromDatabase = variable.source === ConfigSource.DATABASE; diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableHelpText.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableHelpText.tsx index d147e65677..b41eb14993 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableHelpText.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableHelpText.tsx @@ -2,7 +2,7 @@ import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { isConfigVariablesInDbEnabledState } from '@/client-config/states/isConfigVariablesInDbEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { ConfigSource, type ConfigVariable, @@ -24,7 +24,7 @@ export const ConfigVariableHelpText = ({ variable, hasValueChanged, }: ConfigVariableHelpTextProps) => { - const isConfigVariablesInDbEnabled = useRecoilValueV2( + const isConfigVariablesInDbEnabled = useAtomStateValue( isConfigVariablesInDbEnabledState, ); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx index cf9dc9789f..757f25ed32 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableOptionsDropdownContent.tsx @@ -10,7 +10,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useTheme } from '@emotion/react'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { IconChevronLeft, IconEye, IconEyeOff } from 'twenty-ui/display'; import { MenuItem, MenuItemSelectTag } from 'twenty-ui/navigation'; @@ -39,7 +39,7 @@ export const ConfigVariableOptionsDropdownContent = ({ }: ConfigVariableOptionsDropdownContentProps) => { const theme = useTheme(); - const isConfigVariablesInDbEnabled = useRecoilValueV2( + const isConfigVariablesInDbEnabled = useAtomStateValue( isConfigVariablesInDbEnabledState, ); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableValueInput.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableValueInput.tsx index 367549efdb..7c5e9898ae 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableValueInput.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/ConfigVariableValueInput.tsx @@ -3,7 +3,7 @@ import { useLingui } from '@lingui/react/macro'; import { isConfigVariablesInDbEnabledState } from '@/client-config/states/isConfigVariablesInDbEnabledState'; import { TextInput } from '@/ui/input/components/TextInput'; import styled from '@emotion/styled'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type ConfigVariableValue } from 'twenty-shared/types'; import { type ConfigVariable } from '~/generated-metadata/graphql'; import { ConfigVariableDatabaseInput } from './ConfigVariableDatabaseInput'; @@ -26,7 +26,7 @@ export const ConfigVariableValueInput = ({ disabled, }: ConfigVariableValueInputProps) => { const { t } = useLingui(); - const isConfigVariablesInDbEnabled = useRecoilValueV2( + const isConfigVariablesInDbEnabled = useAtomStateValue( isConfigVariablesInDbEnabledState, ); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsx b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsx index 57628086d1..244101cfc0 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsx +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/components/SettingsAdminConfigVariables.tsx @@ -17,7 +17,7 @@ import { } from '~/generated-metadata/graphql'; import { normalizeSearchText } from '~/utils/normalizeSearchText'; import { ConfigVariableSearchInput } from './ConfigVariableSearchInput'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; const StyledControlsContainer = styled.div` display: flex; @@ -36,12 +36,13 @@ export const SettingsAdminConfigVariables = () => { }); const [search, setSearch] = useState(''); - const [showHiddenGroupVariables, setShowHiddenGroupVariables] = - useRecoilStateV2(showHiddenGroupVariablesState); + const [showHiddenGroupVariables, setShowHiddenGroupVariables] = useAtomState( + showHiddenGroupVariablesState, + ); const [configVariableSourceFilter, setConfigVariableSourceFilter] = - useRecoilStateV2(configVariableSourceFilterState); + useAtomState(configVariableSourceFilterState); const [configVariableGroupFilter, setConfigVariableGroupFilter] = - useRecoilStateV2(configVariableGroupFilterState); + useAtomState(configVariableGroupFilterState); const allGroups = useMemo( () => configVariables?.getConfigVariablesGrouped.groups ?? [], diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableGroupFilterState.ts b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableGroupFilterState.ts index b6e1a12072..b114f8fffb 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableGroupFilterState.ts +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableGroupFilterState.ts @@ -1,8 +1,8 @@ import { type ConfigVariableGroupFilter } from '@/settings/admin-panel/config-variables/types/ConfigVariableGroupFilter'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const configVariableGroupFilterState = - createStateV2({ + createAtomState({ key: 'configVariableGroupFilterState', defaultValue: 'all', }); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableSourceFilterState.ts b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableSourceFilterState.ts index dcca5b0485..fbe9566665 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableSourceFilterState.ts +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/configVariableSourceFilterState.ts @@ -1,8 +1,8 @@ import { type ConfigVariableSourceFilter } from '@/settings/admin-panel/config-variables/types/ConfigVariableSourceFilter'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const configVariableSourceFilterState = - createStateV2({ + createAtomState({ key: 'configVariableSourceFilterState', defaultValue: 'all', }); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/showHiddenGroupVariablesState.ts b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/showHiddenGroupVariablesState.ts index 3e30690006..b8b6326b2a 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/showHiddenGroupVariablesState.ts +++ b/packages/twenty-front/src/modules/settings/admin-panel/config-variables/states/showHiddenGroupVariablesState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const showHiddenGroupVariablesState = createStateV2({ +export const showHiddenGroupVariablesState = createAtomState({ key: 'showHiddenGroupVariablesState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/hooks/useFeatureFlagState.ts b/packages/twenty-front/src/modules/settings/admin-panel/hooks/useFeatureFlagState.ts index d38456b4cf..5ba4985798 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/hooks/useFeatureFlagState.ts +++ b/packages/twenty-front/src/modules/settings/admin-panel/hooks/useFeatureFlagState.ts @@ -1,10 +1,10 @@ import { userLookupResultStateV2 } from '@/settings/admin-panel/states/userLookupResultStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { type FeatureFlagKey } from '~/generated-metadata/graphql'; import { isDefined } from 'twenty-shared/utils'; export const useFeatureFlagState = () => { - const [userLookupResult, setUserLookupResult] = useRecoilStateV2( + const [userLookupResult, setUserLookupResult] = useAtomState( userLookupResultStateV2, ); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/hooks/useImpersonationAuth.ts b/packages/twenty-front/src/modules/settings/admin-panel/hooks/useImpersonationAuth.ts index 857da0afa7..2584f60408 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/hooks/useImpersonationAuth.ts +++ b/packages/twenty-front/src/modules/settings/admin-panel/hooks/useImpersonationAuth.ts @@ -1,10 +1,10 @@ import { isAppEffectRedirectEnabledState } from '@/app/states/isAppEffectRedirectEnabledState'; import { useAuth } from '@/auth/hooks/useAuth'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useImpersonationAuth = () => { const { getAuthTokensFromLoginToken } = useAuth(); - const setIsAppEffectRedirectEnabled = useSetRecoilStateV2( + const setIsAppEffectRedirectEnabled = useSetAtomState( isAppEffectRedirectEnabledState, ); diff --git a/packages/twenty-front/src/modules/settings/admin-panel/states/userLookupResultStateV2.ts b/packages/twenty-front/src/modules/settings/admin-panel/states/userLookupResultStateV2.ts index b6f325c9bb..859e68274a 100644 --- a/packages/twenty-front/src/modules/settings/admin-panel/states/userLookupResultStateV2.ts +++ b/packages/twenty-front/src/modules/settings/admin-panel/states/userLookupResultStateV2.ts @@ -1,8 +1,8 @@ import { type UserLookup } from '@/settings/admin-panel/types/UserLookup'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const userLookupResultStateV2 = createStateV2({ +export const userLookupResultStateV2 = createAtomState({ key: 'userLookupResultStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsx b/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsx index b763da7146..dffcaf8e3c 100644 --- a/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsx +++ b/packages/twenty-front/src/modules/settings/components/AdvancedSettingsWrapper.tsx @@ -1,7 +1,7 @@ import { AdvancedSettingsContentWrapperWithDot } from '@/settings/components/AdvancedSettingsContentWrapperWithDot'; import { ADVANCED_SETTINGS_ANIMATION_DURATION } from '@/settings/constants/AdvancedSettingsAnimationDurations'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { AnimatedExpandableContainer } from 'twenty-ui/layout'; @@ -24,7 +24,7 @@ export const AdvancedSettingsWrapper = ({ dotPosition = 'centered', animationDimension = 'height', }: AdvancedSettingsWrapperProps) => { - const isAdvancedModeEnabled = useRecoilValueV2(isAdvancedModeEnabledState); + const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState); return ( { const theme = useTheme(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const itemTagInfo = getItemTagInfo({ item: { isCustom, isRemote, applicationId }, workspaceCustomApplicationId: diff --git a/packages/twenty-front/src/modules/settings/components/SettingsMorphRelationMultiSelect.tsx b/packages/twenty-front/src/modules/settings/components/SettingsMorphRelationMultiSelect.tsx index 2af72fb611..fe1c49dc75 100644 --- a/packages/twenty-front/src/modules/settings/components/SettingsMorphRelationMultiSelect.tsx +++ b/packages/twenty-front/src/modules/settings/components/SettingsMorphRelationMultiSelect.tsx @@ -18,7 +18,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { IconBox, useIcons, type IconComponent } from 'twenty-ui/display'; @@ -144,7 +144,7 @@ export const SettingsMorphRelationMultiSelect = ({ const selectableItemIdArray = filteredOptions.map((option) => option.label); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx index 02c3e87fb4..57adaee95b 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx @@ -10,7 +10,7 @@ import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsO import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle'; import { Select } from '@/ui/input/components/Select'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { RelationType } from '~/generated-metadata/graphql'; import { type SettingsDataModelFieldEditFormValues } from '~/pages/settings/data-model/SettingsObjectFieldEdit'; @@ -25,7 +25,7 @@ export const SettingsDataModelFieldRelationJunctionForm = ({ const { watch, setValue } = useFormContext(); - const isAdvancedModeEnabled = useRecoilValueV2(isAdvancedModeEnabledState); + const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState); const { objectMetadataItem: sourceObjectMetadataItem } = useObjectMetadataItem({ objectNameSingular }); diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx index 938522ad26..2f2516413b 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx @@ -28,7 +28,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import { t } from '@lingui/core/macro'; import { useEffect, useState } from 'react'; @@ -166,7 +166,7 @@ export const SettingsDataModelFieldSelectForm = ({ ); const isNullable = fieldMetadataItem?.isNullable; - const isAdvancedModeEnabled = useRecoilValueV2(isAdvancedModeEnabledState); + const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState); const [searchParams] = useSearchParams(); diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetLabelIdentifierRecordEffect.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetLabelIdentifierRecordEffect.tsx index 50ed6ba1b9..9ebcfd8b91 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetLabelIdentifierRecordEffect.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetLabelIdentifierRecordEffect.tsx @@ -1,6 +1,6 @@ import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { usePreviewRecord } from '@/settings/data-model/fields/preview/hooks/usePreviewRecord'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useEffect } from 'react'; type SettingsDataModelSetLabelIdentifierRecordEffectProps = { @@ -16,7 +16,7 @@ export const SettingsDataModelSetLabelIdentifierRecordEffect = ({ objectNameSingular: objectNameSingular, }); - const setRecord = useSetFamilyRecoilStateV2(recordStoreFamilyState, recordId); + const setRecord = useSetAtomFamilyState(recordStoreFamilyState, recordId); useEffect(() => { setRecord(recordPreviewForLabelIdentifier); diff --git a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx index 8583f46375..b3e2a07d79 100644 --- a/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/graph-overview/components/SettingsDataModelOverviewField.tsx @@ -2,7 +2,7 @@ import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { Handle, Position } from '@xyflow/react'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; import { useIcons } from 'twenty-ui/display'; import { RelationType } from '~/generated-metadata/graphql'; @@ -25,7 +25,7 @@ const StyledFieldName = styled.div` `; export const ObjectFieldRow = ({ field }: ObjectFieldRowProps) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { getIcon } = useIcons(); const theme = useTheme(); diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx index e12db89860..5df162e4a3 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx @@ -13,7 +13,7 @@ import { TableRow } from '@/ui/layout/table/components/TableRow'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useMemo } from 'react'; import { FieldMetadataType, SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; @@ -139,7 +139,7 @@ export const SettingsObjectFieldItemTableRow = ({ const { deleteOneFieldMetadataItem } = useDeleteOneFieldMetadataItem(); - const setActiveSettingsObjectFields = useSetFamilyRecoilStateV2( + const setActiveSettingsObjectFields = useSetAtomFamilyState( settingsObjectFieldsFamilyState, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx index e3485475cf..086bcdd6d8 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx @@ -11,7 +11,7 @@ import { TableHeader } from '@/ui/layout/table/components/TableHeader'; import { useSortedArray } from '@/ui/layout/table/hooks/useSortedArray'; import { type TableMetadata } from '@/ui/layout/table/types/TableMetadata'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { msg } from '@lingui/core/macro'; import { useLingui } from '@lingui/react/macro'; @@ -83,7 +83,7 @@ export const SettingsObjectRelationsTable = ({ const [showInactive, setShowInactive] = useState(true); const [showSystemRelations, setShowSystemRelations] = useState(false); - const isAdvancedModeEnabled = useRecoilValueV2(isAdvancedModeEnabledState); + const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState); const tableMetadata = SETTINGS_OBJECT_RELATION_TABLE_METADATA; diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx index fc8079260e..ab06878990 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx @@ -8,7 +8,7 @@ import { settingsDataModelObjectAboutFormSchema, } from '@/settings/data-model/validation-schemas/settingsDataModelObjectAboutFormSchema'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { zodResolver } from '@hookform/resolvers/zod'; import { FormProvider, useForm } from 'react-hook-form'; import { SettingsPath } from 'twenty-shared/types'; @@ -27,10 +27,10 @@ export const SettingsUpdateDataModelObjectAboutForm = ({ objectMetadataItem, }); const navigate = useNavigateSettings(); - const setUpdatedObjectNamePlural = useSetRecoilStateV2( + const setUpdatedObjectNamePlural = useSetAtomState( updatedObjectNamePluralState, ); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectFieldsFamilyState.ts b/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectFieldsFamilyState.ts index 34a6b99a0d..d67caeeba3 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectFieldsFamilyState.ts +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectFieldsFamilyState.ts @@ -1,11 +1,11 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; export type SortedFieldByTableFamilyStateKey = { objectMetadataItemId: string; }; -export const settingsObjectFieldsFamilyState = createFamilyStateV2< +export const settingsObjectFieldsFamilyState = createAtomFamilyState< FieldMetadataItem[] | null, SortedFieldByTableFamilyStateKey >({ diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectIndexesFamilyState.ts b/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectIndexesFamilyState.ts index 6a68a22f12..57727a0c5a 100644 --- a/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectIndexesFamilyState.ts +++ b/packages/twenty-front/src/modules/settings/data-model/object-details/states/settingsObjectIndexesFamilyState.ts @@ -1,11 +1,11 @@ import { type IndexMetadataItem } from '@/object-metadata/types/IndexMetadataItem'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; export type SortedIndexByTableFamilyStateKey = { objectMetadataItemId: string; }; -export const settingsObjectIndexesFamilyState = createFamilyStateV2< +export const settingsObjectIndexesFamilyState = createAtomFamilyState< IndexMetadataItem[] | null, SortedIndexByTableFamilyStateKey >({ diff --git a/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx b/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx index d9d3353bfe..19c6d08657 100644 --- a/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx +++ b/packages/twenty-front/src/modules/settings/developers/components/WebhookEntitySelect.tsx @@ -10,7 +10,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -86,7 +86,7 @@ export const WebhookEntitySelect = ({ const { getIcon } = useIcons(); const { closeDropdown } = useCloseDropdown(); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/settings/developers/states/apiKeyTokenFamilyState.ts b/packages/twenty-front/src/modules/settings/developers/states/apiKeyTokenFamilyState.ts index 32e1879f96..b0e1d662c3 100644 --- a/packages/twenty-front/src/modules/settings/developers/states/apiKeyTokenFamilyState.ts +++ b/packages/twenty-front/src/modules/settings/developers/states/apiKeyTokenFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const apiKeyTokenFamilyState = createFamilyStateV2< +export const apiKeyTokenFamilyState = createAtomFamilyState< string | null, string >({ diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsx index 80d150475f..7ea93a5ac7 100644 --- a/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsx +++ b/packages/twenty-front/src/modules/settings/domains/components/SettingPublicDomain.tsx @@ -19,7 +19,7 @@ import { import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { CheckPublicDomainValidRecordsEffect } from '@/settings/domains/components/CheckPublicDomainValidRecordsEffect'; import { selectedPublicDomainState } from '@/settings/domains/states/selectedPublicDomainState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useState } from 'react'; import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons'; import { getDomainValidationSchema } from '@/settings/domains/utils/get-domain-validation-schema'; @@ -48,7 +48,7 @@ const StyledRecordsWrapper = styled.div` `; export const SettingPublicDomain = () => { - const [selectedPublicDomain, setSelectedPublicDomain] = useRecoilStateV2( + const [selectedPublicDomain, setSelectedPublicDomain] = useAtomState( selectedPublicDomainState, ); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingsCustomDomain.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingsCustomDomain.tsx index c70f63c041..d633a4bdc6 100644 --- a/packages/twenty-front/src/modules/settings/domains/components/SettingsCustomDomain.tsx +++ b/packages/twenty-front/src/modules/settings/domains/components/SettingsCustomDomain.tsx @@ -4,7 +4,7 @@ import { TextInput } from '@/ui/input/components/TextInput'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { Controller, useFormContext } from 'react-hook-form'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { H2Title, IconReload, IconTrash } from 'twenty-ui/display'; import { Button, ButtonGroup } from 'twenty-ui/input'; import { Section } from 'twenty-ui/layout'; @@ -37,13 +37,13 @@ const StyledRecordsWrapper = styled.div` `; export const SettingsCustomDomain = () => { - const { customDomainRecords, isLoading } = useRecoilValueV2( + const { customDomainRecords, isLoading } = useAtomStateValue( customDomainRecordsState, ); const { checkCustomDomainRecords } = useCheckCustomDomainValidRecords(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingsDomainRecords.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingsDomainRecords.tsx index 33982c2bf2..e8910bfa8c 100644 --- a/packages/twenty-front/src/modules/settings/domains/components/SettingsDomainRecords.tsx +++ b/packages/twenty-front/src/modules/settings/domains/components/SettingsDomainRecords.tsx @@ -8,14 +8,14 @@ import { type DomainRecord, type DomainValidRecords, } from '~/generated-metadata/graphql'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const SettingsDomainRecords = ({ records, }: { records: DomainValidRecords['records']; }) => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const rowsDefinitions = [ { name: 'Domain Setup', validationType: 'redirection' as const }, diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingsPublicDomainsListCard.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingsPublicDomainsListCard.tsx index 53c54500b6..ed6e82aa1b 100644 --- a/packages/twenty-front/src/modules/settings/domains/components/SettingsPublicDomainsListCard.tsx +++ b/packages/twenty-front/src/modules/settings/domains/components/SettingsPublicDomainsListCard.tsx @@ -2,7 +2,7 @@ import { SettingsCard } from '@/settings/components/SettingsCard'; import { SettingsListCard } from '@/settings/components/SettingsListCard'; import { SettingPublicDomainRowDropdownMenu } from '@/settings/domains/components/SettingPublicDomainRowDropdownMenu'; import { selectedPublicDomainState } from '@/settings/domains/states/selectedPublicDomainState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useLingui } from '@lingui/react/macro'; import { SettingsPath } from 'twenty-shared/types'; import { IconAt, IconMailCog, Status } from 'twenty-ui/display'; @@ -17,9 +17,7 @@ export const SettingsPublicDomainsListCard = () => { const { t } = useLingui(); - const setSelectedPublicDomain = useSetRecoilStateV2( - selectedPublicDomainState, - ); + const setSelectedPublicDomain = useSetAtomState(selectedPublicDomainState); const { data, loading } = useFindManyPublicDomainsQuery(); diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsx index 6062d412bb..bb56d53d69 100644 --- a/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsx +++ b/packages/twenty-front/src/modules/settings/domains/components/SettingsSubdomain.tsx @@ -8,7 +8,7 @@ import { domainConfigurationState } from '@/domain-manager/states/domainConfigur import { isDefined } from 'twenty-shared/utils'; import { H2Title } from 'twenty-ui/display'; import { Section } from 'twenty-ui/layout'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledDomainFormWrapper = styled.div` align-items: center; @@ -16,10 +16,10 @@ const StyledDomainFormWrapper = styled.div` `; export const SettingsSubdomain = () => { - const domainConfiguration = useRecoilValueV2(domainConfigurationState); + const domainConfiguration = useAtomStateValue(domainConfigurationState); const { t } = useLingui(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { control } = useFormContext<{ subdomain: string; diff --git a/packages/twenty-front/src/modules/settings/domains/components/SettingsWorkspaceDomainCard.tsx b/packages/twenty-front/src/modules/settings/domains/components/SettingsWorkspaceDomainCard.tsx index e7d6e5bfaf..77545aeee4 100644 --- a/packages/twenty-front/src/modules/settings/domains/components/SettingsWorkspaceDomainCard.tsx +++ b/packages/twenty-front/src/modules/settings/domains/components/SettingsWorkspaceDomainCard.tsx @@ -6,14 +6,14 @@ import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; import { IconWorld, Status } from 'twenty-ui/display'; import { UndecoratedLink } from 'twenty-ui/navigation'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const SettingsWorkspaceDomainCard = () => { const { t } = useLingui(); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); if (!isMultiWorkspaceEnabled) { return null; diff --git a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.ts b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.ts index 98019fa846..a426c975ae 100644 --- a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.ts +++ b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckCustomDomainValidRecords.ts @@ -1,18 +1,18 @@ import { useCheckCustomDomainValidRecordsMutation } from '~/generated-metadata/graphql'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { isDefined } from 'twenty-shared/utils'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { customDomainRecordsState } from '@/settings/domains/states/customDomainRecordsState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useCheckCustomDomainValidRecords = () => { const [checkCustomDomainValidRecords] = useCheckCustomDomainValidRecordsMutation(); const { enqueueErrorSnackBar } = useSnackBar(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); - const [{ isLoading }, setCustomDomainRecords] = useRecoilStateV2( + const [{ isLoading }, setCustomDomainRecords] = useAtomState( customDomainRecordsState, ); diff --git a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.ts b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.ts index c31cd982b3..853da2e593 100644 --- a/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.ts +++ b/packages/twenty-front/src/modules/settings/domains/hooks/useCheckPublicDomainValidRecords.ts @@ -2,7 +2,7 @@ import { isDefined } from 'twenty-shared/utils'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { publicDomainRecordsState } from '@/settings/domains/states/publicDomainRecordsState'; import { useCheckPublicDomainValidRecordsMutation } from '~/generated-metadata/graphql'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; export const useCheckPublicDomainValidRecords = () => { const [checkPublicDomainValidRecords] = @@ -10,7 +10,7 @@ export const useCheckPublicDomainValidRecords = () => { const { enqueueErrorSnackBar } = useSnackBar(); const [{ isLoading, publicDomainRecords }, setPublicDomainRecords] = - useRecoilStateV2(publicDomainRecordsState); + useAtomState(publicDomainRecordsState); const checkPublicDomainRecords = (domain: string) => { if (isLoading) { diff --git a/packages/twenty-front/src/modules/settings/domains/states/customDomainRecordsState.ts b/packages/twenty-front/src/modules/settings/domains/states/customDomainRecordsState.ts index ed46edc507..b07ddf9062 100644 --- a/packages/twenty-front/src/modules/settings/domains/states/customDomainRecordsState.ts +++ b/packages/twenty-front/src/modules/settings/domains/states/customDomainRecordsState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type DomainValidRecords } from '~/generated-metadata/graphql'; -export const customDomainRecordsState = createStateV2<{ +export const customDomainRecordsState = createAtomState<{ customDomainRecords: DomainValidRecords | null; isLoading: boolean; }>({ diff --git a/packages/twenty-front/src/modules/settings/domains/states/publicDomainRecordsState.ts b/packages/twenty-front/src/modules/settings/domains/states/publicDomainRecordsState.ts index 22c403bbad..c85ee9c5bd 100644 --- a/packages/twenty-front/src/modules/settings/domains/states/publicDomainRecordsState.ts +++ b/packages/twenty-front/src/modules/settings/domains/states/publicDomainRecordsState.ts @@ -1,7 +1,7 @@ import { type DomainValidRecords } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const publicDomainRecordsState = createStateV2<{ +export const publicDomainRecordsState = createAtomState<{ publicDomainRecords: DomainValidRecords | null; isLoading: boolean; }>({ diff --git a/packages/twenty-front/src/modules/settings/domains/states/selectedPublicDomainState.ts b/packages/twenty-front/src/modules/settings/domains/states/selectedPublicDomainState.ts index e61f627d2e..706ab47e3c 100644 --- a/packages/twenty-front/src/modules/settings/domains/states/selectedPublicDomainState.ts +++ b/packages/twenty-front/src/modules/settings/domains/states/selectedPublicDomainState.ts @@ -1,7 +1,7 @@ import { type PublicDomain } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const selectedPublicDomainState = createStateV2< +export const selectedPublicDomainState = createAtomState< PublicDomain | undefined >({ key: 'selectedPublicDomainState', diff --git a/packages/twenty-front/src/modules/settings/experience/components/FormatPreferencesSettings.tsx b/packages/twenty-front/src/modules/settings/experience/components/FormatPreferencesSettings.tsx index c38b1056db..11a1ee9fcd 100644 --- a/packages/twenty-front/src/modules/settings/experience/components/FormatPreferencesSettings.tsx +++ b/packages/twenty-front/src/modules/settings/experience/components/FormatPreferencesSettings.tsx @@ -1,7 +1,7 @@ import styled from '@emotion/styled'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { DateFormat } from '@/localization/constants/DateFormat'; import { NumberFormat } from '@/localization/constants/NumberFormat'; import { TimeFormat } from '@/localization/constants/TimeFormat'; @@ -26,7 +26,7 @@ const StyledContainer = styled.div` `; export const FormatPreferencesSettings = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { formatPreferences, updateFormatPreference } = useFormatPreferences(); if (!isDefined(currentWorkspaceMember)) return null; diff --git a/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx b/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx index 0fa747e8ed..5174816730 100644 --- a/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx +++ b/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx @@ -11,7 +11,7 @@ import { type NavigationDrawerItemIndentationLevel } from '@/ui/navigation/navig import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { t } from '@lingui/core/macro'; import { isNonEmptyString } from '@sniptt/guards'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { IconApi, // IconApps, // TODO: Re-enable when integrations page is ready @@ -62,13 +62,13 @@ export type SettingsNavigationItem = { }; const useSettingsNavigationItems = (): SettingsNavigationSection[] => { - const billing = useRecoilValueV2(billingState); + const billing = useAtomStateValue(billingState); const { signOut } = useAuth(); - const supportChat = useRecoilValueV2(supportChatState); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const supportChat = useAtomStateValue(supportChatState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const isBillingEnabled = billing?.isBillingEnabled ?? false; - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const isAdminEnabled = (currentUser?.canImpersonate || currentUser?.canAccessFullAdminPanel) ?? false; diff --git a/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx b/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx index ecc990f2f4..780b1371bf 100644 --- a/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx +++ b/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx @@ -5,7 +5,7 @@ import styled from '@emotion/styled'; import { useState } from 'react'; import { Card } from 'twenty-ui/layout'; import { type FeatureFlagKey } from '~/generated-metadata/graphql'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledCardGrid = styled.div` display: grid; @@ -22,7 +22,7 @@ const StyledImage = styled.img` `; export const SettingsLabContent = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { labPublicFeatureFlags, handleLabPublicFeatureFlagUpdate } = useLabPublicFeatureFlags(); const [hasImageLoadingError, setHasImageLoadingError] = useState< diff --git a/packages/twenty-front/src/modules/settings/lab/hooks/useLabPublicFeatureFlags.ts b/packages/twenty-front/src/modules/settings/lab/hooks/useLabPublicFeatureFlags.ts index 25b0b40bb0..47f79fce82 100644 --- a/packages/twenty-front/src/modules/settings/lab/hooks/useLabPublicFeatureFlags.ts +++ b/packages/twenty-front/src/modules/settings/lab/hooks/useLabPublicFeatureFlags.ts @@ -1,9 +1,9 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { labPublicFeatureFlagsStateV2 } from '@/client-config/states/labPublicFeatureFlagsStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { t } from '@lingui/core/macro'; import { useState } from 'react'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { isDefined } from 'twenty-shared/utils'; import { type FeatureFlagKey, @@ -12,10 +12,10 @@ import { export const useLabPublicFeatureFlags = () => { const [error, setError] = useState(null); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); - const labPublicFeatureFlags = useRecoilValueV2(labPublicFeatureFlagsStateV2); + const labPublicFeatureFlags = useAtomStateValue(labPublicFeatureFlagsStateV2); const [updateLabPublicFeatureFlag] = useUpdateLabPublicFeatureFlagMutation({ onCompleted: (data) => { diff --git a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsx b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsx index 9acfe2f05a..862e78dc6c 100644 --- a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsx +++ b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab.tsx @@ -5,7 +5,7 @@ import { import { SETTINGS_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID } from '@/settings/logic-functions/constants/SettingsLogicFunctionTabListComponentId'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { H2Title, IconPlayerPlay } from 'twenty-ui/display'; @@ -27,7 +27,7 @@ export const SettingsLogicFunctionCodeEditorTab = ({ onChange: (value: string) => void; isTesting?: boolean; }) => { - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, SETTINGS_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID, ); diff --git a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTestTab.tsx b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTestTab.tsx index 29d081f633..9c6128ac6b 100644 --- a/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTestTab.tsx +++ b/packages/twenty-front/src/modules/settings/logic-functions/components/tabs/SettingsLogicFunctionTestTab.tsx @@ -1,6 +1,6 @@ import { LogicFunctionExecutionResult } from '@/logic-functions/components/LogicFunctionExecutionResult'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { logicFunctionTestDataFamilyState } from '@/workflow/workflow-steps/workflow-actions/code-action/states/logicFunctionTestDataFamilyState'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; @@ -31,11 +31,11 @@ export const SettingsLogicFunctionTestTab = ({ isTesting?: boolean; }) => { const { t } = useLingui(); - const logicFunctionTestData = useFamilyRecoilValueV2( + const logicFunctionTestData = useAtomFamilyStateValue( logicFunctionTestDataFamilyState, logicFunctionId, ); - const setLogicFunctionTestData = useSetFamilyRecoilStateV2( + const setLogicFunctionTestData = useSetAtomFamilyState( logicFunctionTestDataFamilyState, logicFunctionId, ); diff --git a/packages/twenty-front/src/modules/settings/logic-functions/states/logicFunctionsState.ts b/packages/twenty-front/src/modules/settings/logic-functions/states/logicFunctionsState.ts index 52f4ddb5e9..94acc0a8ac 100644 --- a/packages/twenty-front/src/modules/settings/logic-functions/states/logicFunctionsState.ts +++ b/packages/twenty-front/src/modules/settings/logic-functions/states/logicFunctionsState.ts @@ -1,10 +1,10 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type FindManyLogicFunctionsQuery } from '~/generated-metadata/graphql'; export type LogicFunction = FindManyLogicFunctionsQuery['findManyLogicFunctions'][number]; -export const logicFunctionsState = createStateV2({ +export const logicFunctionsState = createAtomState({ key: 'logicFunctionsState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/settings/members/hooks/useWorkspaceMemberRoles.ts b/packages/twenty-front/src/modules/settings/members/hooks/useWorkspaceMemberRoles.ts index b3f62b7383..fdc73f551d 100644 --- a/packages/twenty-front/src/modules/settings/members/hooks/useWorkspaceMemberRoles.ts +++ b/packages/twenty-front/src/modules/settings/members/hooks/useWorkspaceMemberRoles.ts @@ -1,10 +1,10 @@ import { useSettingsAllRoles } from '@/settings/roles/hooks/useSettingsAllRoles'; import { settingsRolesIsLoadingStateV2 } from '@/settings/roles/states/settingsRolesIsLoadingStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useWorkspaceMemberRoles = (workspaceMemberId: string) => { const settingsAllRoles = useSettingsAllRoles(); - const settingsRolesIsLoading = useRecoilValueV2( + const settingsRolesIsLoading = useAtomStateValue( settingsRolesIsLoadingStateV2, ); diff --git a/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx b/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx index ac5ea65569..59595a7fc9 100644 --- a/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx +++ b/packages/twenty-front/src/modules/settings/playground/components/GraphQLPlayground.tsx @@ -1,6 +1,6 @@ import { playgroundApiKeyState } from '@/settings/playground/states/playgroundApiKeyState'; import { PlaygroundSchemas } from '@/settings/playground/types/PlaygroundSchemas'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { explorerPlugin } from '@graphiql/plugin-explorer'; import '@graphiql/plugin-explorer/dist/style.css'; @@ -35,7 +35,7 @@ export const GraphQLPlayground = ({ onError, schema, }: GraphQLPlaygroundProps) => { - const playgroundApiKey = useRecoilValueV2(playgroundApiKeyState); + const playgroundApiKey = useAtomStateValue(playgroundApiKeyState); const baseUrl = REACT_APP_SERVER_BASE_URL + '/' + schemaToPath[schema]; const { theme } = useContext(ThemeContext); diff --git a/packages/twenty-front/src/modules/settings/playground/components/PlaygroundSetupForm.tsx b/packages/twenty-front/src/modules/settings/playground/components/PlaygroundSetupForm.tsx index 5e3d7300b1..c7dfbe2a7d 100644 --- a/packages/twenty-front/src/modules/settings/playground/components/PlaygroundSetupForm.tsx +++ b/packages/twenty-front/src/modules/settings/playground/components/PlaygroundSetupForm.tsx @@ -4,7 +4,7 @@ import { PlaygroundSchemas } from '@/settings/playground/types/PlaygroundSchemas import { PlaygroundTypes } from '@/settings/playground/types/PlaygroundTypes'; import { Select } from '@/ui/input/components/Select'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import styled from '@emotion/styled'; import { zodResolver } from '@hookform/resolvers/zod'; import { useLingui } from '@lingui/react/macro'; @@ -37,7 +37,7 @@ const StyledForm = styled.form` export const PlaygroundSetupForm = () => { const { t } = useLingui(); const navigateSettings = useNavigateSettings(); - const [playgroundApiKey, setPlaygroundApiKey] = useRecoilStateV2( + const [playgroundApiKey, setPlaygroundApiKey] = useAtomState( playgroundApiKeyState, ); diff --git a/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx b/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx index 6713e84e0e..5c6ffc2759 100644 --- a/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx +++ b/packages/twenty-front/src/modules/settings/playground/components/RestPlayground.tsx @@ -1,6 +1,6 @@ import { playgroundApiKeyState } from '@/settings/playground/states/playgroundApiKeyState'; import { type PlaygroundSchemas } from '@/settings/playground/types/PlaygroundSchemas'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { lazy, Suspense } from 'react'; @@ -51,7 +51,7 @@ type RestPlaygroundProps = { export const RestPlayground = ({ onError, schema }: RestPlaygroundProps) => { const theme = useTheme(); - const playgroundApiKey = useRecoilValueV2(playgroundApiKeyState); + const playgroundApiKey = useAtomStateValue(playgroundApiKeyState); if (!playgroundApiKey) { onError(); diff --git a/packages/twenty-front/src/modules/settings/playground/components/__stories__/GraphQLPlayground.stories.tsx b/packages/twenty-front/src/modules/settings/playground/components/__stories__/GraphQLPlayground.stories.tsx index 4c76cb99b5..cd8df95319 100644 --- a/packages/twenty-front/src/modules/settings/playground/components/__stories__/GraphQLPlayground.stories.tsx +++ b/packages/twenty-front/src/modules/settings/playground/components/__stories__/GraphQLPlayground.stories.tsx @@ -1,6 +1,6 @@ import { GraphQLPlayground } from '@/settings/playground/components/GraphQLPlayground'; import { playgroundApiKeyState } from '@/settings/playground/states/playgroundApiKeyState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type Meta, type StoryObj } from '@storybook/react-vite'; import { useEffect } from 'react'; import { action } from 'storybook/actions'; @@ -11,7 +11,7 @@ import { import { graphqlMocks } from '~/testing/graphqlMocks'; const PlaygroundApiKeySetterEffect = () => { - const setPlaygroundApiKey = useSetRecoilStateV2(playgroundApiKeyState); + const setPlaygroundApiKey = useSetAtomState(playgroundApiKeyState); useEffect(() => { setPlaygroundApiKey('test-api-key-123'); diff --git a/packages/twenty-front/src/modules/settings/playground/components/__stories__/RestPlayground.stories.tsx b/packages/twenty-front/src/modules/settings/playground/components/__stories__/RestPlayground.stories.tsx index 0c7174dd9e..8c66b9211c 100644 --- a/packages/twenty-front/src/modules/settings/playground/components/__stories__/RestPlayground.stories.tsx +++ b/packages/twenty-front/src/modules/settings/playground/components/__stories__/RestPlayground.stories.tsx @@ -1,7 +1,7 @@ import { RestPlayground } from '@/settings/playground/components/RestPlayground'; import { playgroundApiKeyState } from '@/settings/playground/states/playgroundApiKeyState'; import { PlaygroundSchemas } from '@/settings/playground/types/PlaygroundSchemas'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type Meta, type StoryObj } from '@storybook/react-vite'; import { HttpResponse, http } from 'msw'; import { useEffect } from 'react'; @@ -9,7 +9,7 @@ import { action } from 'storybook/actions'; import { ComponentDecorator } from 'twenty-ui/testing'; const PlaygroundApiKeySetterEffect = () => { - const setPlaygroundApiKey = useSetRecoilStateV2(playgroundApiKeyState); + const setPlaygroundApiKey = useSetAtomState(playgroundApiKeyState); useEffect(() => { setPlaygroundApiKey('test-api-key-123'); diff --git a/packages/twenty-front/src/modules/settings/playground/states/openAPIReference.ts b/packages/twenty-front/src/modules/settings/playground/states/openAPIReference.ts index 808337a2d8..0cc22609ac 100644 --- a/packages/twenty-front/src/modules/settings/playground/states/openAPIReference.ts +++ b/packages/twenty-front/src/modules/settings/playground/states/openAPIReference.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const openAPIReferenceState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const openAPIReferenceState = createAtomState({ key: 'OpenAPIReference', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/settings/playground/states/playgroundApiKeyState.ts b/packages/twenty-front/src/modules/settings/playground/states/playgroundApiKeyState.ts index e78626a77e..3ad6d31240 100644 --- a/packages/twenty-front/src/modules/settings/playground/states/playgroundApiKeyState.ts +++ b/packages/twenty-front/src/modules/settings/playground/states/playgroundApiKeyState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const playgroundApiKeyState = createStateV2({ +export const playgroundApiKeyState = createAtomState({ key: 'playgroundApiKeyState', defaultValue: null, useLocalStorage: true, diff --git a/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx b/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx index 21b9b23ac1..2cf54d092f 100644 --- a/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx +++ b/packages/twenty-front/src/modules/settings/profile/components/DeleteAccount.tsx @@ -2,7 +2,7 @@ import { useAuth } from '@/auth/hooks/useAuth'; import { availableWorkspacesState } from '@/auth/states/availableWorkspacesState'; import { currentUserState } from '@/auth/states/currentUserState'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { countAvailableWorkspaces } from '@/auth/utils/availableWorkspacesUtils'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; @@ -31,12 +31,12 @@ export const DeleteAccount = () => { const [deleteUserAccount] = useDeleteUserAccountMutation(); const [deleteUserFromWorkspace] = useDeleteUserWorkspaceMutation(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const userEmail = currentUser?.email; - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const currentWorkspaceMemberId = currentWorkspaceMember?.id; const { signOut } = useAuth(); - const availableWorkspaces = useRecoilValueV2(availableWorkspacesState); + const availableWorkspaces = useAtomStateValue(availableWorkspacesState); const availableWorkspacesCount = countAvailableWorkspaces(availableWorkspaces); diff --git a/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsx b/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsx index 00fb69e287..c5cc85691b 100644 --- a/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsx +++ b/packages/twenty-front/src/modules/settings/profile/components/DeleteWorkspace.tsx @@ -2,7 +2,7 @@ import { Trans, useLingui } from '@lingui/react/macro'; import { useAuth } from '@/auth/hooks/useAuth'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useRedirectToDefaultDomain } from '@/domain-manager/hooks/useRedirectToDefaultDomain'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; @@ -14,7 +14,7 @@ const DELETE_WORKSPACE_MODAL_ID = 'delete-workspace-modal'; export const DeleteWorkspace = () => { const [deleteCurrentWorkspace] = useDeleteCurrentWorkspaceMutation(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const userEmail = currentUser?.email; const { t } = useLingui(); const { openModal } = useModal(); diff --git a/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsx b/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsx index 904a736817..df549d07a6 100644 --- a/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsx +++ b/packages/twenty-front/src/modules/settings/profile/components/EmailField.tsx @@ -2,7 +2,7 @@ import styled from '@emotion/styled'; import { useState } from 'react'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useCanEditProfileField } from '@/settings/profile/hooks/useCanEditProfileField'; import { useUpdateEmail } from '@/settings/profile/hooks/useUpdateEmail'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; @@ -38,7 +38,7 @@ const StyledActionButton = styled(Button)` `; export const EmailField = () => { - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const { canEdit } = useCanEditProfileField('email'); const { updateEmail } = useUpdateEmail(); diff --git a/packages/twenty-front/src/modules/settings/profile/components/NameFields.tsx b/packages/twenty-front/src/modules/settings/profile/components/NameFields.tsx index f10c646ab9..06e802dc17 100644 --- a/packages/twenty-front/src/modules/settings/profile/components/NameFields.tsx +++ b/packages/twenty-front/src/modules/settings/profile/components/NameFields.tsx @@ -5,8 +5,8 @@ import { useDebouncedCallback } from 'use-debounce'; import { currentUserState } from '@/auth/states/currentUserState'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { useCanEditProfileField } from '@/settings/profile/hooks/useCanEditProfileField'; @@ -27,8 +27,8 @@ type NameFieldsProps = { export const NameFields = ({ autoSave = true }: NameFieldsProps) => { const { t } = useLingui(); - const currentUser = useRecoilValueV2(currentUserState); - const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilStateV2( + const currentUser = useAtomStateValue(currentUserState); + const [currentWorkspaceMember, setCurrentWorkspaceMember] = useAtomState( currentWorkspaceMemberState, ); const { canEdit: canEditFirstName } = useCanEditProfileField('firstName'); diff --git a/packages/twenty-front/src/modules/settings/profile/components/SetOrChangePassword.tsx b/packages/twenty-front/src/modules/settings/profile/components/SetOrChangePassword.tsx index 096a9e4807..c6687f556a 100644 --- a/packages/twenty-front/src/modules/settings/profile/components/SetOrChangePassword.tsx +++ b/packages/twenty-front/src/modules/settings/profile/components/SetOrChangePassword.tsx @@ -3,11 +3,11 @@ import { currentUserState } from '@/auth/states/currentUserState'; import { useLingui } from '@lingui/react/macro'; import { H2Title } from 'twenty-ui/display'; import { Button } from 'twenty-ui/input'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const SetOrChangePassword = () => { const { t } = useLingui(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const { handleResetPassword } = useHandleResetPassword(); diff --git a/packages/twenty-front/src/modules/settings/profile/hooks/useCanChangePassword.ts b/packages/twenty-front/src/modules/settings/profile/hooks/useCanChangePassword.ts index ffd5a2dab3..d980edcdd7 100644 --- a/packages/twenty-front/src/modules/settings/profile/hooks/useCanChangePassword.ts +++ b/packages/twenty-front/src/modules/settings/profile/hooks/useCanChangePassword.ts @@ -1,11 +1,11 @@ import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { PermissionFlagType } from '~/generated-metadata/graphql'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useCanChangePassword = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const currentUserWorkspace = useRecoilValueV2(currentUserWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const currentUserWorkspace = useAtomStateValue(currentUserWorkspaceState); const isPasswordAuthEnabled = currentWorkspace?.isPasswordAuthEnabled === true; diff --git a/packages/twenty-front/src/modules/settings/profile/hooks/useCanEditProfileField.ts b/packages/twenty-front/src/modules/settings/profile/hooks/useCanEditProfileField.ts index 1c01f3203a..d6731516b6 100644 --- a/packages/twenty-front/src/modules/settings/profile/hooks/useCanEditProfileField.ts +++ b/packages/twenty-front/src/modules/settings/profile/hooks/useCanEditProfileField.ts @@ -3,7 +3,7 @@ import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceSta import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { countAvailableWorkspaces } from '@/auth/utils/availableWorkspacesUtils'; import { PermissionFlagType } from '~/generated-metadata/graphql'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export type EditableProfileField = | 'email' @@ -12,9 +12,9 @@ export type EditableProfileField = | 'profilePicture'; export const useCanEditProfileField = (field: EditableProfileField) => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const currentUserWorkspace = useRecoilValueV2(currentUserWorkspaceState); - const availableWorkspaces = useRecoilValueV2(availableWorkspacesState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const currentUserWorkspace = useAtomStateValue(currentUserWorkspaceState); + const availableWorkspaces = useAtomStateValue(availableWorkspacesState); if (!currentWorkspace || !currentUserWorkspace) { return { canEdit: false }; diff --git a/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.ts b/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.ts index cf7cb134cc..8c7c89be18 100644 --- a/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.ts +++ b/packages/twenty-front/src/modules/settings/profile/hooks/useUpdateEmail.ts @@ -3,14 +3,14 @@ import { ApolloError } from '@apollo/client'; import { t } from '@lingui/core/macro'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { useUpdateUserEmailMutation } from '~/generated-metadata/graphql'; export const useUpdateEmail = () => { const { enqueueErrorSnackBar, enqueueInfoSnackBar } = useSnackBar(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const [updateUserEmail] = useUpdateUserEmailMutation(); diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesContainer.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesContainer.tsx index 54727a877b..971c3abff5 100644 --- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesContainer.tsx +++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesContainer.tsx @@ -9,7 +9,7 @@ import { SettingsRolesList } from '@/settings/roles/components/SettingsRolesList import { useSettingsAllRoles } from '@/settings/roles/hooks/useSettingsAllRoles'; import { settingsRolesIsLoadingStateV2 } from '@/settings/roles/states/settingsRolesIsLoadingStateV2'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Trans, useLingui } from '@lingui/react/macro'; import { H3Title } from 'twenty-ui/display'; @@ -17,7 +17,7 @@ export const SettingsRolesContainer = () => { const { t } = useLingui(); const settingsAllRoles = useSettingsAllRoles(); - const settingsRolesIsLoading = useRecoilValueV2( + const settingsRolesIsLoading = useAtomStateValue( settingsRolesIsLoadingStateV2, ); diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx index 99555ac0ac..154359ce3e 100644 --- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx +++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx @@ -5,7 +5,7 @@ import { import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect'; import { Select } from '@/ui/input/components/Select'; import { t } from '@lingui/core/macro'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { isDefined } from 'twenty-shared/utils'; import { H2Title, IconUserPin, useIcons } from 'twenty-ui/display'; import { Card, Section } from 'twenty-ui/layout'; @@ -24,7 +24,7 @@ export const SettingsRoleDefaultRole = ({ }: SettingsRoleDefaultRoleProps) => { const [updateWorkspace] = useUpdateWorkspaceMutation(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesQueryEffect.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesQueryEffect.tsx index 5188cacc4e..d587b9eb89 100644 --- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesQueryEffect.tsx +++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesQueryEffect.tsx @@ -3,7 +3,7 @@ import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settin import { settingsRoleIdsState } from '@/settings/roles/states/settingsRoleIdsState'; import { settingsRolesIsLoadingStateV2 } from '@/settings/roles/states/settingsRolesIsLoadingStateV2'; import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useStore } from 'jotai'; import { useCallback, useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -15,7 +15,7 @@ export const SettingsRolesQueryEffect = () => { fetchPolicy: 'network-only', }); - const setSettingsRolesIsLoading = useSetRecoilStateV2( + const setSettingsRolesIsLoading = useSetAtomState( settingsRolesIsLoadingStateV2, ); diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx index 9399c98549..7a07ba9fb8 100644 --- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx +++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesTableRow.tsx @@ -4,7 +4,7 @@ import { TableRow } from '@/ui/layout/table/components/TableRow'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import React from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { @@ -65,7 +65,7 @@ export const SettingsRolesTableRow = ({ role }: SettingsRolesTableRowProps) => { const { getIcon } = useIcons(); const Icon = getIcon(role.icon ?? 'IconUser'); - const currentWorkspaceMembers = useRecoilValueV2( + const currentWorkspaceMembers = useAtomStateValue( currentWorkspaceMembersState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/hooks/useHasPermissionFlag.ts b/packages/twenty-front/src/modules/settings/roles/hooks/useHasPermissionFlag.ts index 71902a0c2f..1debfaec71 100644 --- a/packages/twenty-front/src/modules/settings/roles/hooks/useHasPermissionFlag.ts +++ b/packages/twenty-front/src/modules/settings/roles/hooks/useHasPermissionFlag.ts @@ -4,11 +4,11 @@ import { PermissionFlagType, } from '~/generated-metadata/graphql'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useHasPermissionFlag = (permissionFlag?: PermissionFlagType) => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const currentUserWorkspace = useRecoilValueV2(currentUserWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const currentUserWorkspace = useAtomStateValue(currentUserWorkspaceState); if (!permissionFlag) { return true; diff --git a/packages/twenty-front/src/modules/settings/roles/hooks/usePermissionFlagMap.ts b/packages/twenty-front/src/modules/settings/roles/hooks/usePermissionFlagMap.ts index a224959da7..c6fac51425 100644 --- a/packages/twenty-front/src/modules/settings/roles/hooks/usePermissionFlagMap.ts +++ b/packages/twenty-front/src/modules/settings/roles/hooks/usePermissionFlagMap.ts @@ -1,10 +1,10 @@ import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; import { PermissionFlagType } from '~/generated-metadata/graphql'; import { buildRecordFromKeysWithSameValue } from '~/utils/array/buildRecordFromKeysWithSameValue'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const usePermissionFlagMap = (): Record => { - const currentUserWorkspace = useRecoilValueV2(currentUserWorkspaceState); + const currentUserWorkspace = useAtomStateValue(currentUserWorkspaceState); const currentUserWorkspaceSettingsPermissions = currentUserWorkspace?.permissionFlags; diff --git a/packages/twenty-front/src/modules/settings/roles/hooks/useSettingsAllRoles.ts b/packages/twenty-front/src/modules/settings/roles/hooks/useSettingsAllRoles.ts index dbe21a6db7..3197fa52e2 100644 --- a/packages/twenty-front/src/modules/settings/roles/hooks/useSettingsAllRoles.ts +++ b/packages/twenty-front/src/modules/settings/roles/hooks/useSettingsAllRoles.ts @@ -1,11 +1,11 @@ import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState'; import { settingsRoleIdsState } from '@/settings/roles/states/settingsRoleIdsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useStore } from 'jotai'; import { isDefined } from 'twenty-shared/utils'; export const useSettingsAllRoles = () => { - const roleIds = useRecoilValueV2(settingsRoleIdsState); + const roleIds = useAtomStateValue(settingsRoleIdsState); const store = useStore(); const roles = roleIds diff --git a/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateAgentRole.ts b/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateAgentRole.ts index 6582a0612f..979c85d5bd 100644 --- a/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateAgentRole.ts +++ b/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateAgentRole.ts @@ -1,17 +1,17 @@ import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useAssignRoleToAgentMutation, type Agent, } from '~/generated-metadata/graphql'; export const useUpdateAgentRole = (roleId: string) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateApiKeyRole.ts b/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateApiKeyRole.ts index 820db4e5a9..06532e29e7 100644 --- a/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateApiKeyRole.ts +++ b/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateApiKeyRole.ts @@ -1,17 +1,17 @@ import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useAssignRoleToApiKeyMutation, type ApiKeyForRole, } from '~/generated-metadata/graphql'; export const useUpdateApiKeyRole = (roleId: string) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateWorkspaceMemberRole.ts b/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateWorkspaceMemberRole.ts index 88b50ef4bf..2b72e4edd0 100644 --- a/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateWorkspaceMemberRole.ts +++ b/packages/twenty-front/src/modules/settings/roles/hooks/useUpdateWorkspaceMemberRole.ts @@ -1,8 +1,8 @@ import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState'; import { type PartialWorkspaceMember } from '@/settings/roles/types/RoleWithPartialMembers'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useUpdateWorkspaceMemberRoleMutation } from '~/generated-metadata/graphql'; type AddWorkspaceMemberToRoleAndUpdateStateParams = { @@ -19,15 +19,15 @@ type AddWorkspaceMembersToRoleParams = { }; export const useUpdateWorkspaceMemberRole = (roleId: string) => { - const setSettingsPersistedRole = useSetFamilyRecoilStateV2( + const setSettingsPersistedRole = useSetAtomFamilyState( settingsPersistedRoleFamilyState, roleId, ); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx index 1235b21230..5c1dabe5e5 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignment.tsx @@ -10,11 +10,11 @@ import { useSettingsAllRoles } from '@/settings/roles/hooks/useSettingsAllRoles' import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useState } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { useFindManyAgentsQuery, @@ -40,7 +40,7 @@ export const SettingsRoleAssignment = ({ }: SettingsRoleAssignmentProps) => { const isAiEnabled = useIsFeatureEnabled(FeatureFlagKey.IS_AI_ENABLED); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); @@ -66,10 +66,10 @@ export const SettingsRoleAssignment = ({ null, ); - const currentWorkspaceMembers = useRecoilValueV2( + const currentWorkspaceMembers = useAtomStateValue( currentWorkspaceMembersState, ); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const settingsAllRoles = useSettingsAllRoles(); const roleMaps = buildRoleMaps(settingsAllRoles); @@ -89,7 +89,7 @@ export const SettingsRoleAssignment = ({ setSelectRoleTarget(null); }; - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, ROLE_ASSIGNMENT_CONFIRMATION_MODAL_ID, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx index 9bdabdac95..b1b59b2111 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentConfirmationModalSubtitle.tsx @@ -5,7 +5,7 @@ import { type SettingsRoleAssignmentConfirmationModalSelectedRoleTarget } from ' import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { Avatar } from 'twenty-ui/display'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledSettingsCardContainer = styled.div` margin-top: ${({ theme }) => theme.spacing(6)}; @@ -20,7 +20,7 @@ export const SettingsRoleAssignmentConfirmationModalSubtitle = ({ selectedRoleTarget, onRoleClick, }: SettingsRoleAssignmentConfirmationModalSubtitleProps) => { - const currentWorkspaceMembers = useRecoilValueV2( + const currentWorkspaceMembers = useAtomStateValue( currentWorkspaceMembersState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTable.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTable.tsx index 28bd289e59..e814a44790 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTable.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTable.tsx @@ -4,7 +4,7 @@ import { } from '@/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { TableCell } from '@/ui/layout/table/components/TableCell'; import { TableHeader } from '@/ui/layout/table/components/TableHeader'; import { TableRow } from '@/ui/layout/table/components/TableRow'; @@ -52,7 +52,7 @@ export const SettingsRoleAssignmentTable = ({ roleTargetType, roleId, }: SettingsRoleAssignmentTableProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx index d873053085..99fe5191e2 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentTableRow.tsx @@ -6,7 +6,7 @@ import { useTheme } from '@emotion/react'; import { t } from '@lingui/core/macro'; import styled from '@emotion/styled'; import { useContext } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Avatar, IconKey, @@ -55,12 +55,12 @@ export const SettingsRoleAssignmentTableRow = ({ roleTarget, }: SettingsRoleAssignmentTableRowProps) => { const theme = useTheme(); - const currentWorkspaceMembers = useRecoilValueV2( + const currentWorkspaceMembers = useAtomStateValue( currentWorkspaceMembersState, ); const { getIcon } = useIcons(); const { dateFormat, timeZone } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); const renderIcon = () => { switch (roleTarget.type) { diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx index 1e9b8b5402..71512fe3e3 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent.tsx @@ -4,7 +4,7 @@ import { isDefined } from 'twenty-shared/utils'; import { MenuItem, MenuItemAvatar } from 'twenty-ui/navigation'; import { type SearchRecord } from '~/generated/graphql'; import { type PartialWorkspaceMember } from '@/settings/roles/types/RoleWithPartialMembers'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; type SettingsRoleAssignmentWorkspaceMemberPickerDropdownContentProps = { loading: boolean; @@ -19,7 +19,7 @@ export const SettingsRoleAssignmentWorkspaceMemberPickerDropdownContent = ({ filteredWorkspaceMembers, onSelect, }: SettingsRoleAssignmentWorkspaceMemberPickerDropdownContentProps) => { - const currentWorkspaceMembers = useRecoilValueV2( + const currentWorkspaceMembers = useAtomStateValue( currentWorkspaceMembersState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/stories/SettingsRoleAssignment.stories.tsx b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/stories/SettingsRoleAssignment.stories.tsx index 823e3fe393..0c7fe76c7a 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-assignment/components/stories/SettingsRoleAssignment.stories.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-assignment/components/stories/SettingsRoleAssignment.stories.tsx @@ -1,6 +1,6 @@ import { SettingsRoleAssignment } from '@/settings/roles/role-assignment/components/SettingsRoleAssignment'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { type Meta, type StoryObj } from '@storybook/react-vite'; import { isDefined } from 'twenty-shared/utils'; import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing'; @@ -9,7 +9,7 @@ import { getRolesMock } from '~/testing/mock-data/roles'; const SettingsRoleAssignmentWrapper = ( args: React.ComponentProps, ) => { - const setDraftRole = useSetFamilyRecoilStateV2( + const setDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, args.roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/components/stories/SettingsRolePermissions.stories.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/components/stories/SettingsRolePermissions.stories.tsx index 88008ca2b0..8220a1df14 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/components/stories/SettingsRolePermissions.stories.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/components/stories/SettingsRolePermissions.stories.tsx @@ -1,6 +1,6 @@ import { SettingsRolePermissions } from '@/settings/roles/role-permissions/components/SettingsRolePermissions'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { type Meta, type StoryObj } from '@storybook/react-vite'; import { isDefined } from 'twenty-shared/utils'; import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing'; @@ -9,7 +9,7 @@ import { getRolesMock } from '~/testing/mock-data/roles'; const SettingsRolePermissionsWrapper = ( args: React.ComponentProps, ) => { - const setDraftRole = useSetFamilyRecoilStateV2( + const setDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, args.roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsx index 6eee593f1b..6ebefa6db5 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelOverrideCell.tsx @@ -4,7 +4,7 @@ import { PermissionIcon } from '@/settings/roles/role-permissions/objects-permis import { SETTINGS_ROLE_OBJECT_LEVEL_PERMISSION_TO_ROLE_OBJECT_PERMISSION_MAPPING } from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectLevelPermissionToRoleObjectPermissionMapping'; import { type SettingsRoleObjectPermissionKey } from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectPermissionIconConfig'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; @@ -27,7 +27,7 @@ export const SettingsRolePermissionsObjectLevelOverrideCell = ({ roleId, objectLabel, }: SettingsRolePermissionsObjectLevelOverrideCellProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSection.tsx index 1bc199729c..ebe40bd603 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSection.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSection.tsx @@ -5,7 +5,7 @@ import { useFilterObjectMetadataItemsWithPermissionOverride } from '@/settings/r import { useObjectMetadataItemsThatCanHavePermission } from '@/settings/roles/role-permissions/object-level-permissions/hooks/useObjectMetadataItemsThatCanHavePermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { Table } from '@/ui/layout/table/components/Table'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { TableCell } from '@/ui/layout/table/components/TableCell'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -49,7 +49,7 @@ export const SettingsRolePermissionsObjectLevelSection = ({ }: SettingsRolePermissionsObjectLevelSectionProps) => { const navigateSettings = useNavigateSettings(); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx index 57395f6f81..128ac13018 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelSeeFieldsValueForObject.tsx @@ -2,7 +2,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField'; import { useObjectPermissionDerivedStates } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useObjectPermissionDerivedStates'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useLingui } from '@lingui/react/macro'; type SettingsRolePermissionsObjectLevelSeeFieldsValueForObjectProps = { @@ -16,7 +16,7 @@ export const SettingsRolePermissionsObjectLevelSeeFieldsValueForObject = ({ }: SettingsRolePermissionsObjectLevelSeeFieldsValueForObjectProps) => { const { t } = useLingui(); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelUpdateFieldsValueForObject.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelUpdateFieldsValueForObject.tsx index 808ab4fa4c..ccaae9a530 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelUpdateFieldsValueForObject.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelUpdateFieldsValueForObject.tsx @@ -2,7 +2,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { filterUserFacingFieldMetadataItems } from '@/object-metadata/utils/filterUserFacingFieldMetadataItems'; import { useObjectPermissionDerivedStates } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useObjectPermissionDerivedStates'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useLingui } from '@lingui/react/macro'; type SettingsRolePermissionsObjectLevelUpdateFieldsValueForObjectProps = { @@ -16,7 +16,7 @@ export const SettingsRolePermissionsObjectLevelUpdateFieldsValueForObject = ({ }: SettingsRolePermissionsObjectLevelUpdateFieldsValueForObjectProps) => { const { t } = useLingui(); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTable.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTable.tsx index 3eda23872f..c60352ea70 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTable.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTable.tsx @@ -14,7 +14,7 @@ import { Table } from '@/ui/layout/table/components/Table'; import { TableHeader } from '@/ui/layout/table/components/TableHeader'; import { TableHeaderText } from '@/ui/layout/table/components/TableHeaderText'; import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFieldByTableFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; @@ -45,7 +45,7 @@ export const SettingsRolePermissionsObjectLevelObjectFieldPermissionTable = ({ const { t } = useLingui(); const [searchTerm, setSearchTerm] = useState(''); - const sortedFieldByTable = useFamilyRecoilValueV2( + const sortedFieldByTable = useAtomFamilyStateValue( sortedFieldByTableFamilyState, { tableId: SETTINGS_ROLE_PERMISSION_OBJECT_LEVEL_FIELD_PERMISSION_TABLE_ID, @@ -69,7 +69,7 @@ export const SettingsRolePermissionsObjectLevelObjectFieldPermissionTable = ({ ), ); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableAllHeaderRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableAllHeaderRow.tsx index cbd4a7311c..1ce000c84b 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableAllHeaderRow.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/components/SettingsRolePermissionsObjectLevelObjectFieldPermissionTableAllHeaderRow.tsx @@ -7,7 +7,7 @@ import { useRestrictReadOnAllFieldsOfObject } from '@/settings/roles/role-permis import { useRestrictUpdateOnAllFieldsOfObject } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictUpdateOnAllFieldsOfObject'; import { OverridableCheckbox } from '@/settings/roles/role-permissions/object-level-permissions/object-form/components/OverridableCheckbox'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { Label } from 'twenty-ui/display'; @@ -40,7 +40,7 @@ export const SettingsRolePermissionsObjectLevelObjectFieldPermissionTableAllHead }) => { const { t } = useLingui(); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useGetObjectPermissionDerivedStates.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useGetObjectPermissionDerivedStates.ts index d5e680ef72..62d12a16a7 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useGetObjectPermissionDerivedStates.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useGetObjectPermissionDerivedStates.ts @@ -1,5 +1,5 @@ import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; export const useGetObjectPermissionDerivedStates = ({ @@ -7,7 +7,7 @@ export const useGetObjectPermissionDerivedStates = ({ }: { roleId: string; }) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveReadOverrideOnAllFieldsOfObject.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveReadOverrideOnAllFieldsOfObject.ts index b0dd56bda9..7970d0a5d4 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveReadOverrideOnAllFieldsOfObject.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveReadOverrideOnAllFieldsOfObject.ts @@ -1,14 +1,14 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { useUpsertFieldPermissionInDraftRole } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; export const useRemoveReadOverrideOnAllFieldsOfObject = ({ roleId, }: { roleId: string; }) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveUpdateOverrideOnAllFieldsOfObject.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveUpdateOverrideOnAllFieldsOfObject.ts index 65ab4bb922..809f90d735 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveUpdateOverrideOnAllFieldsOfObject.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRemoveUpdateOverrideOnAllFieldsOfObject.ts @@ -1,14 +1,14 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { useUpsertFieldPermissionInDraftRole } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; export const useRemoveUpdateOverrideOnAllFieldsOfObject = ({ roleId, }: { roleId: string; }) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictReadOnAllFieldsOfObject.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictReadOnAllFieldsOfObject.ts index c55403c22d..f4b4b32192 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictReadOnAllFieldsOfObject.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictReadOnAllFieldsOfObject.ts @@ -2,7 +2,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { filterUserFacingFieldMetadataItems } from '@/object-metadata/utils/filterUserFacingFieldMetadataItems'; import { useUpsertFieldPermissionInDraftRole } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; import { v4 } from 'uuid'; @@ -11,7 +11,7 @@ export const useRestrictReadOnAllFieldsOfObject = ({ }: { roleId: string; }) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictUpdateOnAllFieldsOfObject.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictUpdateOnAllFieldsOfObject.ts index 4fba6f7a39..98ec96664e 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictUpdateOnAllFieldsOfObject.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useRestrictUpdateOnAllFieldsOfObject.ts @@ -2,7 +2,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { filterUserFacingFieldMetadataItems } from '@/object-metadata/utils/filterUserFacingFieldMetadataItems'; import { useUpsertFieldPermissionInDraftRole } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; import { v4 } from 'uuid'; @@ -11,7 +11,7 @@ export const useRestrictUpdateOnAllFieldsOfObject = ({ }: { roleId: string; }) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole.ts index 130fff1bbe..4f9bd5d94a 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/field-permissions/hooks/useUpsertFieldPermissionInDraftRole.ts @@ -1,10 +1,10 @@ import { getRoleWithUpsertedFieldPermission } from '@/settings/roles/role-permissions/object-level-permissions/field-permissions/utils/getRoleWithUpsertedFieldPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { type FieldPermission } from '~/generated-metadata/graphql'; export const useUpsertFieldPermissionInDraftRole = (roleId: string) => { - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useResetObjectPermission.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useResetObjectPermission.ts index de570229b6..691751966e 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useResetObjectPermission.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useResetObjectPermission.ts @@ -2,7 +2,7 @@ import { useUpsertFieldPermissionInDraftRole } from '@/settings/roles/role-permi import { useUpsertObjectPermissionInDraftRole } from '@/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermissionInDraftRole'; import { type SettingsRoleObjectPermissionKey } from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectPermissionIconConfig'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; import { type FieldPermission, @@ -17,7 +17,7 @@ const OBJECT_PERMISSION_KEYS: SettingsRoleObjectPermissionKey[] = [ ]; export const useResetObjectPermission = (roleId: string) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermission.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermission.ts index 41afe0b0a2..e29b4439f4 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermission.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermission.ts @@ -1,12 +1,12 @@ import { useUpsertObjectPermissionInDraftRole } from '@/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermissionInDraftRole'; import { type SettingsRoleObjectPermissionKey } from '@/settings/roles/role-permissions/objects-permissions/constants/SettingsRoleObjectPermissionIconConfig'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; import { type ObjectPermission } from '~/generated-metadata/graphql'; export const useUpsertObjectPermission = ({ roleId }: { roleId: string }) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermissionInDraftRole.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermissionInDraftRole.ts index f1ee318a71..e2c49c3fdf 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermissionInDraftRole.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/hooks/useUpsertObjectPermissionInDraftRole.ts @@ -1,10 +1,10 @@ import { getRoleWithUpsertedObjectPermission } from '@/settings/roles/role-permissions/object-level-permissions/hooks/getRoleWithUpsertedObjectPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { type ObjectPermission } from '~/generated-metadata/graphql'; export const useUpsertObjectPermissionInDraftRole = (roleId: string) => { - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsx index e62f72dc3d..9242f13372 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectForm.tsx @@ -7,11 +7,11 @@ import { SettingsRolePermissionsObjectLevelObjectFormObjectLevel } from '@/setti import { SettingsRolePermissionsObjectLevelRecordLevelSection } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelSection'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useFeatureFlagsMap } from '@/workspace/hooks/useFeatureFlagsMap'; import { t } from '@lingui/core/macro'; import { useSearchParams } from 'react-router-dom'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath, type ViewFilterOperand } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { Button } from 'twenty-ui/input'; @@ -34,9 +34,9 @@ export const SettingsRolePermissionsObjectLevelObjectForm = ({ const [searchParams] = useSearchParams(); const fromAgentId = searchParams.get('fromAgent'); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevel.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevel.tsx index 4c03bb7713..17e7cf4ce0 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevel.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevel.tsx @@ -3,7 +3,7 @@ import { SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableHeader } fr import { SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRow } from '@/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRow'; import { type SettingsRolePermissionsObjectLevelPermission } from '@/settings/roles/role-permissions/objects-permissions/types/SettingsRolePermissionsObjectPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { H2Title } from 'twenty-ui/display'; @@ -27,7 +27,7 @@ export const SettingsRolePermissionsObjectLevelObjectFormObjectLevel = ({ roleId, objectMetadataItem, }: SettingsRolePermissionsObjectLevelObjectFormObjectLevelProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRow.tsx index d5dac3bb30..d4f35fb62a 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRow.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/object-form/components/SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRow.tsx @@ -7,7 +7,7 @@ import { type SettingsRoleObjectPermissionKey } from '@/settings/roles/role-perm import { type SettingsRolePermissionsObjectLevelPermission } from '@/settings/roles/role-permissions/objects-permissions/types/SettingsRolePermissionsObjectPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { TableCell } from '@/ui/layout/table/components/TableCell'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { TableRow } from '@/ui/layout/table/components/TableRow'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -70,7 +70,7 @@ export const SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRow = settingsDraftRoleObjectPermissions, roleId, }: SettingsRolePermissionsObjectLevelObjectFormObjectLevelTableRowProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelect.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelect.tsx index 041d13346f..c2bbccc501 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelect.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelect.tsx @@ -9,7 +9,7 @@ import { objectFilterDropdownIsSelectingCompositeFieldComponentState } from '@/o import { SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectFieldMenu } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectFieldMenu'; import { SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenu } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenu'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; const StyledContainer = styled.div` flex: 2; @@ -28,7 +28,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelect useAdvancedFilterFieldSelectDropdown(recordFilterId); const [objectFilterDropdownIsSelectingCompositeField] = - useRecoilComponentStateV2( + useAtomComponentState( objectFilterDropdownIsSelectingCompositeFieldComponentState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectFieldMenu.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectFieldMenu.tsx index 24eaae5f47..da6c0a6b92 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectFieldMenu.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectFieldMenu.tsx @@ -24,8 +24,8 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Gene import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useContext } from 'react'; import { FieldMetadataType } from 'twenty-shared/types'; @@ -45,7 +45,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectF advancedFilterFieldSelectDropdownId, } = useAdvancedFilterFieldSelectDropdown(recordFilterId); - const [objectFilterDropdownSearchInput] = useRecoilComponentStateV2( + const [objectFilterDropdownSearchInput] = useAtomComponentState( objectFilterDropdownSearchInputComponentState, ); @@ -77,17 +77,16 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectF const { selectFieldUsedInAdvancedFilterDropdown } = useSelectFieldUsedInAdvancedFilterDropdown(); - const [, setObjectFilterDropdownSubMenuFieldType] = - useRecoilComponentStateV2( - objectFilterDropdownSubMenuFieldTypeComponentState, - ); + const [, setObjectFilterDropdownSubMenuFieldType] = useAtomComponentState( + objectFilterDropdownSubMenuFieldTypeComponentState, + ); const [, setObjectFilterDropdownIsSelectingCompositeField] = - useRecoilComponentStateV2( + useAtomComponentState( objectFilterDropdownIsSelectingCompositeFieldComponentState, ); - const setFieldMetadataItemIdUsedInDropdown = useSetRecoilComponentStateV2( + const setFieldMetadataItemIdUsedInDropdown = useSetAtomComponentState( fieldMetadataItemIdUsedInDropdownComponentState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenu.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenu.tsx index 455bc11c04..9ec48ac47c 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenu.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenu.tsx @@ -27,9 +27,9 @@ import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/Gene import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; type SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenuProps = { @@ -42,19 +42,19 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectS }: SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectSubFieldMenuProps) => { const { getIcon } = useIcons(); - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); const [, setObjectFilterDropdownIsSelectingCompositeField] = - useRecoilComponentStateV2( + useAtomComponentState( objectFilterDropdownIsSelectingCompositeFieldComponentState, ); const [ objectFilterDropdownSubMenuFieldType, setObjectFilterDropdownSubMenuFieldType, - ] = useRecoilComponentStateV2( + ] = useAtomComponentState( objectFilterDropdownSubMenuFieldTypeComponentState, ); @@ -89,7 +89,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFieldSelectS const { advancedFilterFieldSelectDropdownId } = useAdvancedFilterFieldSelectDropdown(recordFilterId); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, advancedFilterFieldSelectDropdownId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilderContent.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilderContent.tsx index 13286dd8a0..246d0bdc8b 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilderContent.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilderContent.tsx @@ -22,10 +22,10 @@ import { useRecordLevelPermissionFilterActions } from '@/settings/roles/role-per import { useRecordLevelPermissionFilterInitialization } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionFilterInitialization'; import { useRecordLevelPermissionSyncToDraftRole } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionSyncToDraftRole'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; const StyledContainer = styled.div` align-items: start; @@ -56,7 +56,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilde roleId, objectMetadataItem, }: SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilderContentProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); @@ -65,26 +65,26 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilde objectMetadataItem.id, ); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, ); - const setCurrentRecordFilterGroups = useSetRecoilComponentStateV2( + const setCurrentRecordFilterGroups = useSetAtomComponentState( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); const { setRecordFilterUsedInAdvancedFilterDropdownRow } = useSetRecordFilterUsedInAdvancedFilterDropdownRow(); - const rootRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionMeValueSelect.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionMeValueSelect.tsx index 50bc46f7e8..6f174fd9c0 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionMeValueSelect.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionMeValueSelect.tsx @@ -29,8 +29,8 @@ import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; const StyledSearchInput = styled.input` background: transparent; @@ -77,11 +77,11 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionMeValueSelec objectNameSingular: CoreObjectNameSingular.WorkspaceMember, }); - const selectedFieldMetadataItem = useRecoilComponentSelectorValueV2( + const selectedFieldMetadataItem = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx index 994ccb0d4b..62138bcbde 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput.tsx @@ -25,7 +25,7 @@ import { FormMultiSelectFieldInput } from '@/object-record/record-field/ui/form- import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type CompositeFieldType } from '@/settings/data-model/types/CompositeFieldType'; import { createRecordLevelPermissionVariablePicker } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionVariablePicker'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; const StyledContainer = styled.div` align-items: stretch; @@ -102,7 +102,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelPermissionValueInput = const { objectMetadataItem } = useContext(AdvancedFilterContext); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelSection.tsx index 1c858e903c..761c865b90 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelSection.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelSection.tsx @@ -10,7 +10,7 @@ import { billingState } from '@/client-config/states/billingState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { SettingsOptionCardContentButton } from '@/settings/components/SettingsOptions/SettingsOptionCardContentButton'; import { SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilder } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/components/SettingsRolePermissionsObjectLevelRecordLevelPermissionFilterBuilder'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { Button } from 'twenty-ui/input'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; @@ -46,7 +46,7 @@ export const SettingsRolePermissionsObjectLevelRecordLevelSection = ({ hasOrganizationPlan, }: SettingsRolePermissionsObjectLevelRecordLevelSectionProps) => { const navigateSettings = useNavigateSettings(); - const billing = useRecoilValueV2(billingState); + const billing = useAtomStateValue(billingState); const isBillingEnabled = billing?.isBillingEnabled ?? false; if (!hasOrganizationPlan) { diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionFilterActions.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionFilterActions.ts index ff242cd31c..b91b13a620 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionFilterActions.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionFilterActions.ts @@ -23,8 +23,8 @@ import { type RecordFilter } from '@/object-record/record-filter/types/RecordFil import { getDefaultSubFieldNameForCompositeFilterableFieldType } from '@/object-record/record-filter/utils/getDefaultSubFieldNameForCompositeFilterableFieldType'; import { getRecordFilterOperands } from '@/object-record/record-filter/utils/getRecordFilterOperands'; import { RECORD_LEVEL_PERMISSION_PREDICATE_FIELD_TYPES } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/constants/RecordLevelPermissionPredicateFieldTypes'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; type UseRecordLevelPermissionFilterActionsProps = { objectMetadataItem: ObjectMetadataItem; @@ -42,14 +42,14 @@ export const useRecordLevelPermissionFilterActions = ({ const { setRecordFilterUsedInAdvancedFilterDropdownRow } = useSetRecordFilterUsedInAdvancedFilterDropdownRow(); - const availableFieldMetadataItemsForFilter = useFamilySelectorValueV2( + const availableFieldMetadataItemsForFilter = useAtomFamilySelectorValue( availableFieldMetadataItemsForFilterFamilySelector, { objectMetadataItemId: objectMetadataItem.id, }, ); - const rootRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionSyncToDraftRole.ts b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionSyncToDraftRole.ts index 999341a6b8..6767b62124 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionSyncToDraftRole.ts +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/object-level-permissions/record-level-permissions/hooks/useRecordLevelPermissionSyncToDraftRole.ts @@ -11,7 +11,7 @@ import { convertRecordFilterToPredicate, } from '@/settings/roles/role-permissions/object-level-permissions/record-level-permissions/utils/recordLevelPermissionPredicateConversion'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; type UseRecordLevelPermissionSyncToDraftRoleProps = { roleId: string; @@ -28,7 +28,7 @@ export const useRecordLevelPermissionSyncToDraftRole = ({ currentRecordFilterGroups, hasInitialized, }: UseRecordLevelPermissionSyncToDraftRoleProps) => { - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsSection.tsx index 057577ae9f..65ee8e345e 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsSection.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsSection.tsx @@ -2,8 +2,8 @@ import { SettingsRolePermissionsObjectsTableHeader } from '@/settings/roles/role import { SettingsRolePermissionsObjectsTableRow } from '@/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableRow'; import { type SettingsRolePermissionsObjectPermission } from '@/settings/roles/role-permissions/objects-permissions/types/SettingsRolePermissionsObjectPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { H2Title } from 'twenty-ui/display'; @@ -27,11 +27,11 @@ export const SettingsRolePermissionsObjectsSection = ({ roleId, isEditable, }: SettingsRolePermissionsObjectsSectionProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsx index 471f70f8c8..a017b6d8f2 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/objects-permissions/components/SettingsRolePermissionsObjectsTableHeader.tsx @@ -1,8 +1,8 @@ import { type SettingsRolePermissionsObjectPermission } from '@/settings/roles/role-permissions/objects-permissions/types/SettingsRolePermissionsObjectPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { TableHeader } from '@/ui/layout/table/components/TableHeader'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { TableRow } from '@/ui/layout/table/components/TableRow'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -30,11 +30,11 @@ export const SettingsRolePermissionsObjectsTableHeader = ({ objectPermissionsConfig, isEditable, }: SettingsRolePermissionsObjectsTableHeaderProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx index e13c43b513..80828d5191 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx @@ -3,8 +3,8 @@ import { SettingsRolePermissionsSettingsTableHeader } from '@/settings/roles/rol import { SettingsRolePermissionsSettingsTableRow } from '@/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow'; import { useSettingsRolePermissionFlagConfig } from '@/settings/roles/role-permissions/permission-flags/hooks/useSettingsRolePermissionFlagConfig'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { H2Title, IconSettings } from 'twenty-ui/display'; @@ -32,11 +32,11 @@ export const SettingsRolePermissionsSettingsSection = ({ roleId, isEditable, }: SettingsRolePermissionsSettingsSectionProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsx index 1dee75b999..06a8a02bd3 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader.tsx @@ -6,8 +6,8 @@ import { Checkbox } from 'twenty-ui/input'; import { type SettingsRolePermissionsSettingPermission } from '@/settings/roles/role-permissions/permission-flags/types/SettingsRolePermissionsSettingPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { v4 } from 'uuid'; type SettingsRolePermissionsSettingsTableHeaderProps = { @@ -28,11 +28,11 @@ export const SettingsRolePermissionsSettingsTableHeader = ({ settingsPermissionsConfig, isEditable, }: SettingsRolePermissionsSettingsTableHeaderProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx index 04af8e384b..335a895191 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow.tsx @@ -1,8 +1,8 @@ import { type SettingsRolePermissionsSettingPermission } from '@/settings/roles/role-permissions/permission-flags/types/SettingsRolePermissionsSettingPermission'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { TableCell } from '@/ui/layout/table/components/TableCell'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { TableRow } from '@/ui/layout/table/components/TableRow'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; @@ -54,11 +54,11 @@ export const SettingsRolePermissionsSettingsTableRow = ({ isEditable, }: SettingsRolePermissionsSettingsTableRowProps) => { const theme = useTheme(); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx index 0820decbc9..009a34e24e 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx @@ -3,8 +3,8 @@ import { SettingsRolePermissionsSettingsTableHeader } from '@/settings/roles/rol import { SettingsRolePermissionsSettingsTableRow } from '@/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow'; import { useActionRolePermissionFlagConfig } from '@/settings/roles/role-permissions/permission-flags/hooks/useActionRolePermissionFlagConfig'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -33,11 +33,11 @@ export const SettingsRolePermissionsToolSection = ({ roleId, isEditable, }: SettingsRolePermissionsToolSectionProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx index 2544dd1861..19fe76e14c 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx @@ -6,8 +6,8 @@ import { SettingsRoleSettingsDeleteRoleConfirmationModal } from '@/settings/role import { ROLE_SETTINGS_DELETE_ROLE_CONFIRMATION_MODAL_ID } from '@/settings/roles/role-settings/components/constants/RoleSettingsDeleteRoleConfirmationModalId'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { IconPicker } from '@/ui/input/components/IconPicker'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; import { TextArea } from '@/ui/input/components/TextArea'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; @@ -38,11 +38,11 @@ export const SettingsRoleSettings = ({ isEditable, isCreateMode, }: SettingsRoleSettingsProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle.tsx index c8134e0a81..ffa1b37fc0 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle.tsx @@ -1,5 +1,5 @@ import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { t } from '@lingui/core/macro'; type SettingsRoleSettingsDeleteRoleConfirmationModalSubtitleProps = { @@ -9,7 +9,7 @@ type SettingsRoleSettingsDeleteRoleConfirmationModalSubtitleProps = { export const SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle = ({ roleId, }: SettingsRoleSettingsDeleteRoleConfirmationModalSubtitleProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role-settings/components/stories/SettingsRoleSettings.stories.tsx b/packages/twenty-front/src/modules/settings/roles/role-settings/components/stories/SettingsRoleSettings.stories.tsx index b450d77c09..3b32289aa0 100644 --- a/packages/twenty-front/src/modules/settings/roles/role-settings/components/stories/SettingsRoleSettings.stories.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role-settings/components/stories/SettingsRoleSettings.stories.tsx @@ -1,6 +1,6 @@ import { SettingsRoleSettings } from '@/settings/roles/role-settings/components/SettingsRoleSettings'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { type Meta, type StoryObj } from '@storybook/react-vite'; import { isDefined } from 'twenty-shared/utils'; import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing'; @@ -9,7 +9,7 @@ import { getRolesMock } from '~/testing/mock-data/roles'; const SettingsRoleSettingsWrapper = ( args: React.ComponentProps, ) => { - const setDraftRole = useSetFamilyRecoilStateV2( + const setDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, args.roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx index 350e1dea6b..8efff4561a 100644 --- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx @@ -14,12 +14,12 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useLoadCurrentUser } from '@/users/hooks/useLoadCurrentUser'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useState } from 'react'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; @@ -36,7 +36,7 @@ type SettingsRoleProps = { export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => { const { refreshObjectMetadataItems } = useRefreshObjectMetadataItems(); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, SETTINGS_ROLE_DETAIL_TABS.COMPONENT_INSTANCE_ID + '-' + roleId, ); @@ -45,20 +45,20 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => { const [isSaving, setIsSaving] = useState(false); - const settingsRolesIsLoading = useRecoilValueV2( + const settingsRolesIsLoading = useAtomStateValue( settingsRolesIsLoadingStateV2, ); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); - const settingsPersistedRole = useFamilyRecoilValueV2( + const settingsPersistedRole = useAtomFamilyStateValue( settingsPersistedRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleCreateEffect.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleCreateEffect.tsx index 846f242fcf..43ce4d8ad0 100644 --- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleCreateEffect.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleCreateEffect.tsx @@ -2,8 +2,8 @@ import { SETTINGS_ROLE_DETAIL_TABS } from '@/settings/roles/role/constants/Setti import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { t } from '@lingui/core/macro'; import { useEffect, useState } from 'react'; @@ -14,17 +14,17 @@ type SettingsRoleCreateEffectProps = { export const SettingsRoleCreateEffect = ({ roleId, }: SettingsRoleCreateEffectProps) => { - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); - const setSettingsPersistedRole = useSetFamilyRecoilStateV2( + const setSettingsPersistedRole = useSetAtomFamilyState( settingsPersistedRoleFamilyState, roleId, ); - const setActiveTabId = useSetRecoilComponentStateV2( + const setActiveTabId = useSetAtomComponentState( activeTabIdComponentState, SETTINGS_ROLE_DETAIL_TABS.COMPONENT_INSTANCE_ID + '-' + roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleEditEffect.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleEditEffect.tsx index f0ca58b2ff..92449c1682 100644 --- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleEditEffect.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleEditEffect.tsx @@ -3,8 +3,8 @@ import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDr import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState'; import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useStore } from 'jotai'; import { useCallback, useEffect, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -19,8 +19,11 @@ export const SettingsRoleEditEffect = ({ }: SettingsRoleEditEffectProps) => { const [isInitialized, setIsInitialized] = useState(false); - const role = useFamilyRecoilValueV2(settingsPersistedRoleFamilyState, roleId); - const setActiveTabId = useSetRecoilComponentStateV2( + const role = useAtomFamilyStateValue( + settingsPersistedRoleFamilyState, + roleId, + ); + const setActiveTabId = useSetAtomComponentState( activeTabIdComponentState, SETTINGS_ROLE_DETAIL_TABS.COMPONENT_INSTANCE_ID + '-' + roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx index 079c0628f9..e78e11811f 100644 --- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx +++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRoleLabelContainer.tsx @@ -1,6 +1,6 @@ import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { TitleInput } from '@/ui/input/components/TitleInput'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -23,11 +23,11 @@ type SettingsRoleLabelContainerProps = { export const SettingsRoleLabelContainer = ({ roleId, }: SettingsRoleLabelContainerProps) => { - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/role/hooks/useSaveDraftRoleToDB.ts b/packages/twenty-front/src/modules/settings/roles/role/hooks/useSaveDraftRoleToDB.ts index aa5dad7691..a4c2d6d1b8 100644 --- a/packages/twenty-front/src/modules/settings/roles/role/hooks/useSaveDraftRoleToDB.ts +++ b/packages/twenty-front/src/modules/settings/roles/role/hooks/useSaveDraftRoleToDB.ts @@ -7,7 +7,7 @@ import { useRemoveFieldPermissionInDraftRole } from '@/settings/roles/role-permi import { newFieldPermissionsFilter } from '@/settings/roles/role/hooks/utils/newFieldPermissionsFilter.util'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { settingsPersistedRoleFamilyState } from '@/settings/roles/states/settingsPersistedRoleFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { getOperationName } from '@apollo/client/utilities'; import { isDefined, isNonEmptyArray } from 'twenty-shared/utils'; import { @@ -57,12 +57,12 @@ export const useSaveDraftRoleToDB = ({ const { addAgentsToRole } = useUpdateAgentRole(roleId); const { addApiKeysToRole } = useUpdateApiKeyRole(roleId); - const settingsPersistedRole = useFamilyRecoilValueV2( + const settingsPersistedRole = useAtomFamilyStateValue( settingsPersistedRoleFamilyState, roleId, ); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId, ); diff --git a/packages/twenty-front/src/modules/settings/roles/states/settingsDraftRoleFamilyState.ts b/packages/twenty-front/src/modules/settings/roles/states/settingsDraftRoleFamilyState.ts index 298815a085..7e44e2b566 100644 --- a/packages/twenty-front/src/modules/settings/roles/states/settingsDraftRoleFamilyState.ts +++ b/packages/twenty-front/src/modules/settings/roles/states/settingsDraftRoleFamilyState.ts @@ -1,7 +1,7 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers'; -export const settingsDraftRoleFamilyState = createFamilyStateV2< +export const settingsDraftRoleFamilyState = createAtomFamilyState< RoleWithPartialMembers, string >({ diff --git a/packages/twenty-front/src/modules/settings/roles/states/settingsPersistedRoleFamilyState.ts b/packages/twenty-front/src/modules/settings/roles/states/settingsPersistedRoleFamilyState.ts index 033fb75cb0..81e1010bcd 100644 --- a/packages/twenty-front/src/modules/settings/roles/states/settingsPersistedRoleFamilyState.ts +++ b/packages/twenty-front/src/modules/settings/roles/states/settingsPersistedRoleFamilyState.ts @@ -1,7 +1,7 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers'; -export const settingsPersistedRoleFamilyState = createFamilyStateV2< +export const settingsPersistedRoleFamilyState = createAtomFamilyState< RoleWithPartialMembers | undefined, string >({ diff --git a/packages/twenty-front/src/modules/settings/roles/states/settingsRoleIdsState.ts b/packages/twenty-front/src/modules/settings/roles/states/settingsRoleIdsState.ts index c95a8e9933..4f16b7580d 100644 --- a/packages/twenty-front/src/modules/settings/roles/states/settingsRoleIdsState.ts +++ b/packages/twenty-front/src/modules/settings/roles/states/settingsRoleIdsState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const settingsRoleIdsState = createStateV2({ +export const settingsRoleIdsState = createAtomState({ key: 'settingsRoleIdsState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/settings/roles/states/settingsRolesIsLoadingStateV2.ts b/packages/twenty-front/src/modules/settings/roles/states/settingsRolesIsLoadingStateV2.ts index bc41773175..fc4d4f4a1c 100644 --- a/packages/twenty-front/src/modules/settings/roles/states/settingsRolesIsLoadingStateV2.ts +++ b/packages/twenty-front/src/modules/settings/roles/states/settingsRolesIsLoadingStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const settingsRolesIsLoadingStateV2 = createStateV2({ +export const settingsRolesIsLoadingStateV2 = createAtomState({ key: 'settingsRolesIsLoadingStateV2', defaultValue: true, }); diff --git a/packages/twenty-front/src/modules/settings/roles/states/settingsValidateRoleFamilyState.ts b/packages/twenty-front/src/modules/settings/roles/states/settingsValidateRoleFamilyState.ts index 072d5b6c84..5a4990b780 100644 --- a/packages/twenty-front/src/modules/settings/roles/states/settingsValidateRoleFamilyState.ts +++ b/packages/twenty-front/src/modules/settings/roles/states/settingsValidateRoleFamilyState.ts @@ -1,7 +1,7 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { type Role } from '~/generated-metadata/graphql'; -export const settingsValidateRoleFamilyState = createFamilyStateV2< +export const settingsValidateRoleFamilyState = createAtomFamilyState< Record, boolean>, string >({ diff --git a/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCard.tsx b/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCard.tsx index 8dcd05d040..91d236fb09 100644 --- a/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCard.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCard.tsx @@ -13,8 +13,8 @@ import { type ApolloError } from '@apollo/client'; import isPropValid from '@emotion/is-prop-valid'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getSettingsPath } from 'twenty-shared/utils'; import { IconKey } from 'twenty-ui/display'; import { useGetSsoIdentityProvidersQuery } from '~/generated-metadata/graphql'; @@ -29,11 +29,11 @@ const StyledLink = styled(Link, { export const SettingsSSOIdentitiesProvidersListCard = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { t } = useLingui(); - const [SSOIdentitiesProviders, setSSOIdentitiesProviders] = useRecoilStateV2( + const [SSOIdentitiesProviders, setSSOIdentitiesProviders] = useAtomState( SSOIdentitiesProvidersState, ); diff --git a/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCardWrapper.tsx b/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCardWrapper.tsx index 01d41693e6..bc14275d20 100644 --- a/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCardWrapper.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCardWrapper.tsx @@ -5,14 +5,14 @@ import { SettingsListCard } from '@/settings/components/SettingsListCard'; import { SettingsSSOIdentityProviderRowRightContainer } from '@/settings/security/components/SSO/SettingsSSOIdentityProviderRowRightContainer'; import { SSOIdentitiesProvidersState } from '@/settings/security/states/SSOIdentitiesProvidersState'; import { guessSSOIdentityProviderIconByUrl } from '@/settings/security/utils/guessSSOIdentityProviderIconByUrl'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; export const SettingsSSOIdentitiesProvidersListCardWrapper = () => { const navigate = useNavigateSettings(); - const SSOIdentitiesProviders = useRecoilValueV2(SSOIdentitiesProvidersState); + const SSOIdentitiesProviders = useAtomStateValue(SSOIdentitiesProvidersState); return ( { const { t } = useLingui(); const { enqueueErrorSnackBar } = useSnackBar(); - const authProviders = useRecoilValueV2(authProvidersState); + const authProviders = useAtomStateValue(authProvidersState); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx index 380d6ea6ae..3eb2cfda47 100644 --- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx @@ -6,7 +6,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ApolloError } from '@apollo/client'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { ConnectedAccountProvider } from 'twenty-shared/types'; import { capitalize } from 'twenty-shared/utils'; import { @@ -22,7 +22,7 @@ import { } from '~/generated-metadata/graphql'; import { Toggle2FA } from './Toggle2FA'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledSettingsSecurityOptionsList = styled.div` display: flex; @@ -34,10 +34,10 @@ export const SettingsSecurityAuthProvidersOptionsList = () => { const { t } = useLingui(); const { enqueueErrorSnackBar } = useSnackBar(); - const SSOIdentitiesProviders = useRecoilValueV2(SSOIdentitiesProvidersState); - const authProviders = useRecoilValueV2(authProvidersState); + const SSOIdentitiesProviders = useAtomStateValue(SSOIdentitiesProvidersState); + const authProviders = useAtomStateValue(authProvidersState); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsx index f590374606..f1d05c7674 100644 --- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityEditableProfileFields.tsx @@ -8,7 +8,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { ApolloError } from '@apollo/client'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { isDefined } from 'twenty-shared/utils'; import { IconMail, @@ -37,7 +37,7 @@ export const SettingsSecurityEditableProfileFields = () => { const { t } = useLingui(); const { enqueueErrorSnackBar } = useSnackBar(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); const [updateWorkspace] = useUpdateWorkspaceMutation(); diff --git a/packages/twenty-front/src/modules/settings/security/components/Toggle2FA.tsx b/packages/twenty-front/src/modules/settings/security/components/Toggle2FA.tsx index 7afd69ca33..454e4e0eec 100644 --- a/packages/twenty-front/src/modules/settings/security/components/Toggle2FA.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/Toggle2FA.tsx @@ -1,5 +1,5 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ApolloError } from '@apollo/client'; @@ -9,7 +9,7 @@ import { useUpdateWorkspaceMutation } from '~/generated-metadata/graphql'; export const Toggle2FA = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsx b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsx index 037de9999b..ac1a17eb4c 100644 --- a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsApprovedAccessDomainsListCard.tsx @@ -11,8 +11,8 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ApolloError } from '@apollo/client'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getSettingsPath } from 'twenty-shared/utils'; import { IconAt, IconMailCog, Status } from 'twenty-ui/display'; import { useGetApprovedAccessDomainsQuery } from '~/generated-metadata/graphql'; @@ -27,9 +27,9 @@ export const SettingsApprovedAccessDomainsListCard = () => { const { enqueueErrorSnackBar } = useSnackBar(); const navigate = useNavigate(); const { t } = useLingui(); - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); - const [approvedAccessDomains, setApprovedAccessDomains] = useRecoilStateV2( + const [approvedAccessDomains, setApprovedAccessDomains] = useAtomState( approvedAccessDomainsState, ); diff --git a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsx index 7e0c18f1c2..6232140a84 100644 --- a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu.tsx @@ -4,7 +4,7 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; import { IconDotsVertical, IconTrash } from 'twenty-ui/display'; @@ -24,9 +24,7 @@ export const SettingsSecurityApprovedAccessDomainRowDropdownMenu = ({ }: SettingsSecurityApprovedAccessDomainRowDropdownMenuProps) => { const dropdownId = `settings-approved-access-domain-row-${approvedAccessDomain.id}`; - const setApprovedAccessDomains = useSetRecoilStateV2( - approvedAccessDomainsState, - ); + const setApprovedAccessDomains = useSetAtomState(approvedAccessDomainsState); const { enqueueErrorSnackBar } = useSnackBar(); diff --git a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsx b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsx index 53d8898179..3824bbb2e2 100644 --- a/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsx +++ b/packages/twenty-front/src/modules/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect.tsx @@ -3,7 +3,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { t } from '@lingui/core/macro'; import { useEffect } from 'react'; import { useSearchParams } from 'react-router-dom'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; import { useValidateApprovedAccessDomainMutation } from '~/generated-metadata/graphql'; @@ -14,9 +14,7 @@ export const SettingsSecurityApprovedAccessDomainValidationEffect = () => { const [searchParams] = useSearchParams(); const approvedAccessDomainId = searchParams.get('wtdId'); const validationToken = searchParams.get('validationToken'); - const setApprovedAccessDomains = useSetRecoilStateV2( - approvedAccessDomainsState, - ); + const setApprovedAccessDomains = useSetAtomState(approvedAccessDomainsState); useEffect(() => { if (isDefined(validationToken) && isDefined(approvedAccessDomainId)) { diff --git a/packages/twenty-front/src/modules/settings/security/hooks/useCreateSSOIdentityProvider.ts b/packages/twenty-front/src/modules/settings/security/hooks/useCreateSSOIdentityProvider.ts index 54f8bca7b7..e983132c66 100644 --- a/packages/twenty-front/src/modules/settings/security/hooks/useCreateSSOIdentityProvider.ts +++ b/packages/twenty-front/src/modules/settings/security/hooks/useCreateSSOIdentityProvider.ts @@ -1,7 +1,7 @@ /* @license Enterprise */ import { SSOIdentitiesProvidersState } from '@/settings/security/states/SSOIdentitiesProvidersState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type CreateOidcIdentityProviderMutationVariables, type CreateSamlIdentityProviderMutationVariables, @@ -15,7 +15,7 @@ export const useCreateSSOIdentityProvider = () => { const [createSamlIdentityProviderMutation] = useCreateSamlIdentityProviderMutation(); - const setSSOIdentitiesProviders = useSetRecoilStateV2( + const setSSOIdentitiesProviders = useSetAtomState( SSOIdentitiesProvidersState, ); diff --git a/packages/twenty-front/src/modules/settings/security/hooks/useDeleteSSOIdentityProvider.ts b/packages/twenty-front/src/modules/settings/security/hooks/useDeleteSSOIdentityProvider.ts index 725022c3fe..effe49d644 100644 --- a/packages/twenty-front/src/modules/settings/security/hooks/useDeleteSSOIdentityProvider.ts +++ b/packages/twenty-front/src/modules/settings/security/hooks/useDeleteSSOIdentityProvider.ts @@ -1,7 +1,7 @@ /* @license Enterprise */ import { SSOIdentitiesProvidersState } from '@/settings/security/states/SSOIdentitiesProvidersState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type DeleteSsoIdentityProviderMutationVariables, useDeleteSsoIdentityProviderMutation, @@ -11,7 +11,7 @@ export const useDeleteSSOIdentityProvider = () => { const [deleteSsoIdentityProviderMutation] = useDeleteSsoIdentityProviderMutation(); - const setSSOIdentitiesProviders = useSetRecoilStateV2( + const setSSOIdentitiesProviders = useSetAtomState( SSOIdentitiesProvidersState, ); diff --git a/packages/twenty-front/src/modules/settings/security/hooks/useUpdateSSOIdentityProvider.ts b/packages/twenty-front/src/modules/settings/security/hooks/useUpdateSSOIdentityProvider.ts index 964c4ba0a3..8d1ed47a16 100644 --- a/packages/twenty-front/src/modules/settings/security/hooks/useUpdateSSOIdentityProvider.ts +++ b/packages/twenty-front/src/modules/settings/security/hooks/useUpdateSSOIdentityProvider.ts @@ -1,7 +1,7 @@ /* @license Enterprise */ import { SSOIdentitiesProvidersState } from '@/settings/security/states/SSOIdentitiesProvidersState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type EditSsoIdentityProviderMutationVariables, useEditSsoIdentityProviderMutation, @@ -11,7 +11,7 @@ export const useUpdateSSOIdentityProvider = () => { const [editSsoIdentityProviderMutation] = useEditSsoIdentityProviderMutation(); - const setSSOIdentitiesProviders = useSetRecoilStateV2( + const setSSOIdentitiesProviders = useSetAtomState( SSOIdentitiesProvidersState, ); diff --git a/packages/twenty-front/src/modules/settings/security/states/ApprovedAccessDomainsState.ts b/packages/twenty-front/src/modules/settings/security/states/ApprovedAccessDomainsState.ts index 6710a65f02..e55cf5b181 100644 --- a/packages/twenty-front/src/modules/settings/security/states/ApprovedAccessDomainsState.ts +++ b/packages/twenty-front/src/modules/settings/security/states/ApprovedAccessDomainsState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type ApprovedAccessDomain } from '~/generated-metadata/graphql'; -export const approvedAccessDomainsState = createStateV2< +export const approvedAccessDomainsState = createAtomState< Omit[] >({ key: 'ApprovedAccessDomainsState', diff --git a/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.ts b/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.ts index 92c2f2b90a..da85b5849d 100644 --- a/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.ts +++ b/packages/twenty-front/src/modules/settings/security/states/SSOIdentitiesProvidersState.ts @@ -1,9 +1,9 @@ /* @license Enterprise */ import { type SSOIdentityProvider } from '@/settings/security/types/SSOIdentityProvider'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const SSOIdentitiesProvidersState = createStateV2< +export const SSOIdentitiesProvidersState = createAtomState< Omit[] >({ key: 'SSOIdentitiesProvidersState', diff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx index daf4220dea..67ae5aea8e 100644 --- a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx +++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/DeleteTwoFactorAuthenticationMethod.tsx @@ -1,6 +1,6 @@ import { useAuth } from '@/auth/hooks/useAuth'; import { currentUserState } from '@/auth/states/currentUserState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; @@ -27,7 +27,7 @@ export const DeleteTwoFactorAuthentication = () => { const { loadCurrentUser } = useLoadCurrentUser(); const [deleteTwoFactorAuthenticationMethod] = useDeleteTwoFactorAuthenticationMethodMutation(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const userEmail = currentUser?.email; const navigate = useNavigateSettings(); const twoFactorAuthenticationStrategy = diff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsx b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsx index 9bd441875e..6f86786e3e 100644 --- a/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsx +++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/components/TwoFactorAuthenticationSetupForSettingsEffect.tsx @@ -5,8 +5,8 @@ import { gql, useMutation } from '@apollo/client'; import { useLingui } from '@lingui/react/macro'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const INITIATE_OTP_PROVISIONING_FOR_AUTHENTICATED_USER = gql` mutation initiateOTPProvisioningForAuthenticatedUser { @@ -18,8 +18,8 @@ const INITIATE_OTP_PROVISIONING_FOR_AUTHENTICATED_USER = gql` export const TwoFactorAuthenticationSetupForSettingsEffect = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const [qrCode, setQrCode] = useRecoilStateV2(qrCodeState); - const currentUser = useRecoilValueV2(currentUserState); + const [qrCode, setQrCode] = useAtomState(qrCodeState); + const currentUser = useAtomStateValue(currentUserState); const { t } = useLingui(); diff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication.ts b/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication.ts index ce01679283..c0f08e1e85 100644 --- a/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication.ts +++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication.ts @@ -4,10 +4,10 @@ import { type TwoFactorAuthenticationMethodDto, useInitiateOtpProvisioningMutation, } from '~/generated-metadata/graphql'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useCurrentUserWorkspaceTwoFactorAuthentication = () => { - const currentUserWorkspace = useRecoilValueV2(currentUserWorkspaceState); + const currentUserWorkspace = useAtomStateValue(currentUserWorkspaceState); const [initiateCurrentUserWorkspaceOtpProvisioning] = useInitiateOtpProvisioningMutation(); diff --git a/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useWorkspaceTwoFactorAuthenticationPolicy.ts b/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useWorkspaceTwoFactorAuthenticationPolicy.ts index 858753198f..fa757d5376 100644 --- a/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useWorkspaceTwoFactorAuthenticationPolicy.ts +++ b/packages/twenty-front/src/modules/settings/two-factor-authentication/hooks/useWorkspaceTwoFactorAuthenticationPolicy.ts @@ -1,8 +1,8 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useCurrentWorkspaceTwoFactorAuthenticationPolicy = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); return { isEnforced: currentWorkspace?.isTwoFactorAuthenticationEnforced ?? false, diff --git a/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsx b/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsx index 82f489d0c9..2c2a423217 100644 --- a/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsx +++ b/packages/twenty-front/src/modules/settings/workspace-member/components/WorkspaceMemberPictureUploader.tsx @@ -2,7 +2,7 @@ import { t } from '@lingui/core/macro'; import { useState } from 'react'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { useCanEditProfileField } from '@/settings/profile/hooks/useCanEditProfileField'; @@ -39,7 +39,7 @@ export const WorkspaceMemberPictureUploader = ({ const [uploadController, setUploadController] = useState(null); - const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilStateV2( + const [currentWorkspaceMember, setCurrentWorkspaceMember] = useAtomState( currentWorkspaceMemberState, ); diff --git a/packages/twenty-front/src/modules/settings/workspace/components/NameField.tsx b/packages/twenty-front/src/modules/settings/workspace/components/NameField.tsx index 50df604016..1682724f7a 100644 --- a/packages/twenty-front/src/modules/settings/workspace/components/NameField.tsx +++ b/packages/twenty-front/src/modules/settings/workspace/components/NameField.tsx @@ -3,8 +3,8 @@ import { useCallback, useEffect, useState } from 'react'; import { useDebouncedCallback } from 'use-debounce'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; import { useLingui } from '@lingui/react/macro'; import isEmpty from 'lodash.isempty'; @@ -31,8 +31,8 @@ export const NameField = ({ onNameUpdate, }: NameFieldProps) => { const { t } = useLingui(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const setCurrentWorkspace = useSetRecoilStateV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const setCurrentWorkspace = useSetAtomState(currentWorkspaceState); const [displayName, setDisplayName] = useState( currentWorkspace?.displayName ?? '', diff --git a/packages/twenty-front/src/modules/settings/workspace/components/ToggleImpersonate.tsx b/packages/twenty-front/src/modules/settings/workspace/components/ToggleImpersonate.tsx index b0cd5b9c03..4ede8f2871 100644 --- a/packages/twenty-front/src/modules/settings/workspace/components/ToggleImpersonate.tsx +++ b/packages/twenty-front/src/modules/settings/workspace/components/ToggleImpersonate.tsx @@ -1,5 +1,5 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { ApolloError } from '@apollo/client'; @@ -11,7 +11,7 @@ import { useUpdateWorkspaceMutation } from '~/generated-metadata/graphql'; export const ToggleImpersonate = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/modules/settings/workspace/components/WorkspaceLogoUploader.tsx b/packages/twenty-front/src/modules/settings/workspace/components/WorkspaceLogoUploader.tsx index 11a4a016cd..ca77bcace8 100644 --- a/packages/twenty-front/src/modules/settings/workspace/components/WorkspaceLogoUploader.tsx +++ b/packages/twenty-front/src/modules/settings/workspace/components/WorkspaceLogoUploader.tsx @@ -1,5 +1,5 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { ImageInput } from '@/ui/input/components/ImageInput'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { buildSignedPath } from 'twenty-shared/utils'; @@ -18,7 +18,7 @@ export const WorkspaceLogoUploader = () => { const [uploadLogoLegacy] = useUploadWorkspaceLogoLegacyMutation(); const [uploadLogo] = useUploadWorkspaceLogoMutation(); const [updateWorkspace] = useUpdateWorkspaceMutation(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInAppNavigationDrawerMock.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInAppNavigationDrawerMock.tsx index d17d07158b..a3b25307ce 100644 --- a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInAppNavigationDrawerMock.tsx +++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInAppNavigationDrawerMock.tsx @@ -5,7 +5,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem'; import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection'; import { DEFAULT_WORKSPACE_NAME } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceName'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { SettingsPath } from 'twenty-shared/types'; @@ -34,7 +34,7 @@ export const SignInAppNavigationDrawerMock = ({ }: SignInAppNavigationDrawerMockProps) => { const isMobile = useIsMobile(); const { t } = useLingui(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); return ( diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainer.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainer.tsx index 93524ec8c9..a3329ee035 100644 --- a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainer.tsx +++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainer.tsx @@ -10,10 +10,10 @@ import { RecordIndexContextProvider } from '@/object-record/record-index/context import { useRecordIndexFieldMetadataDerivedStates } from '@/object-record/record-index/hooks/useRecordIndexFieldMetadataDerivedStates'; import { RecordTableWithWrappers } from '@/object-record/record-table/components/RecordTableWithWrappers'; import { SignInBackgroundMockContainerEffect } from '@/sign-in-background-mock/components/SignInBackgroundMockContainerEffect'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewBar } from '@/views/components/ViewBar'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; const StyledContainer = styled.div` @@ -29,9 +29,9 @@ export const SignInBackgroundMockContainer = () => { const recordIndexId = 'sign-up-mock-record-table-id'; const viewBarId = 'companies-mock'; - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); - const objectMetadataItemId = useRecoilComponentValueV2( + const objectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx index b2fabcf338..4eeba7bd84 100644 --- a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx +++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx @@ -8,8 +8,8 @@ import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObje import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; import { type RecordField } from '@/object-record/record-field/types/RecordField'; import { SIGN_IN_BACKGROUND_MOCK_COLUMN_DEFINITIONS } from '@/sign-in-background-mock/constants/SignInBackgroundMockColumnDefinitions'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useInitViewBar } from '@/views/hooks/useInitViewBar'; type SignInBackgroundMockContainerEffectProps = { @@ -26,12 +26,12 @@ export const SignInBackgroundMockContainerEffect = ({ const [ contextStoreCurrentObjectMetadataItemId, setContextStoreCurrentObjectMetadataItemId, - ] = useRecoilComponentStateV2( + ] = useAtomComponentState( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const setCurrentRecordFields = useSetRecoilComponentStateV2( + const setCurrentRecordFields = useSetAtomComponentState( currentRecordFieldsComponentState, recordTableId, ); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.ts b/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.ts index 3d8b118d84..5090d5cc0e 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.ts +++ b/packages/twenty-front/src/modules/spreadsheet-import/hooks/useOpenSpreadsheetImportDialog.ts @@ -2,12 +2,10 @@ import { SPREADSHEET_IMPORT_MODAL_ID } from '@/spreadsheet-import/constants/Spre import { spreadsheetImportDialogState } from '@/spreadsheet-import/states/spreadsheetImportDialogState'; import { type SpreadsheetImportDialogOptions } from '@/spreadsheet-import/types'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useOpenSpreadsheetImportDialog = () => { - const setSpreadSheetImport = useSetRecoilStateV2( - spreadsheetImportDialogState, - ); + const setSpreadSheetImport = useSetAtomState(spreadsheetImportDialogState); const { openModal } = useModal(); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx b/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx index 3c80fa7e34..568efa6b81 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx +++ b/packages/twenty-front/src/modules/spreadsheet-import/provider/components/SpreadsheetImportProvider.tsx @@ -7,8 +7,8 @@ import { SPREADSHEET_IMPORT_MODAL_ID } from '@/spreadsheet-import/constants/Spre import { spreadsheetImportDialogState } from '@/spreadsheet-import/states/spreadsheetImportDialogState'; import { matchColumnsState } from '@/spreadsheet-import/steps/components/MatchColumnsStep/components/states/initialComputedColumnsState'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; const SpreadsheetImport = React.lazy(() => import('./SpreadsheetImport').then((module) => ({ @@ -35,10 +35,11 @@ type SpreadsheetImportProviderProps = React.PropsWithChildren; export const SpreadsheetImportProvider = ( props: SpreadsheetImportProviderProps, ) => { - const [spreadsheetImportDialog, setSpreadsheetImportDialog] = - useRecoilStateV2(spreadsheetImportDialogState); + const [spreadsheetImportDialog, setSpreadsheetImportDialog] = useAtomState( + spreadsheetImportDialogState, + ); - const setMatchColumnsState = useSetRecoilStateV2(matchColumnsState); + const setMatchColumnsState = useSetAtomState(matchColumnsState); const { closeModal } = useModal(); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState.ts b/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState.ts index a84f6e4854..62be826868 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState.ts +++ b/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const spreadsheetImportCreatedRecordsProgressState = createStateV2({ +export const spreadsheetImportCreatedRecordsProgressState = createAtomState({ key: 'spreadsheetImportCreatedRecordsProgressState', defaultValue: 0, }); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.ts b/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.ts index 833355f9f0..106205ca68 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.ts +++ b/packages/twenty-front/src/modules/spreadsheet-import/states/spreadsheetImportDialogState.ts @@ -1,5 +1,5 @@ import { type SpreadsheetImportDialogOptions } from '@/spreadsheet-import/types'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export type SpreadsheetImportDialogState = { isOpen: boolean; @@ -8,7 +8,7 @@ export type SpreadsheetImportDialogState = { }; export const spreadsheetImportDialogState = - createStateV2({ + createAtomState({ key: 'spreadsheetImportDialogState', defaultValue: { isOpen: false, diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsx index 35e024df5d..27fbd5ed68 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsx +++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ImportDataStep.tsx @@ -2,7 +2,7 @@ import { useNumberFormat } from '@/localization/hooks/useNumberFormat'; import { StepNavigationButton } from '@/spreadsheet-import/components/StepNavigationButton'; import { useSpreadsheetImportInternal } from '@/spreadsheet-import/hooks/useSpreadsheetImportInternal'; import { spreadsheetImportCreatedRecordsProgressState } from '@/spreadsheet-import/states/spreadsheetImportCreatedRecordsProgressState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Modal } from '@/ui/layout/modal/components/Modal'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; @@ -37,7 +37,7 @@ export const ImportDataStep = ({ recordsToImportCount, }: ImportDataStepProps) => { const { onClose } = useSpreadsheetImportInternal(); - const spreadsheetImportCreatedRecordsProgress = useRecoilValueV2( + const spreadsheetImportCreatedRecordsProgress = useAtomStateValue( spreadsheetImportCreatedRecordsProgressState, ); const { formatNumber } = useNumberFormat(); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx index 4a530de0d5..3e68bf43e1 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx +++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/MatchColumnsStep.tsx @@ -28,7 +28,7 @@ import { type SpreadsheetColumn } from '@/spreadsheet-import/types/SpreadsheetCo import { SpreadsheetColumnType } from '@/spreadsheet-import/types/SpreadsheetColumnType'; import { type SpreadsheetColumns } from '@/spreadsheet-import/types/SpreadsheetColumns'; import { type SpreadsheetImportField } from '@/spreadsheet-import/types/SpreadsheetImportField'; -import { useFamilySelectorStateV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2'; +import { useAtomFamilySelectorState } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; import { Trans, useLingui } from '@lingui/react/macro'; @@ -81,7 +81,7 @@ export const MatchColumnsStep = ({ const dataExample = data.slice(0, 2); const { spreadsheetImportFields: fields } = useSpreadsheetImportInternal(); const [isLoading, setIsLoading] = useState(false); - const [columns, setColumns] = useFamilySelectorStateV2( + const [columns, setColumns] = useAtomFamilySelectorState( initialComputedColumnsSelector, headerValues, ); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/TemplateColumn.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/TemplateColumn.tsx index a64ff874e2..e7a1e18c22 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/TemplateColumn.tsx +++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/TemplateColumn.tsx @@ -7,7 +7,7 @@ import { suggestedFieldsByColumnHeaderState } from '@/spreadsheet-import/steps/c import { SpreadsheetColumnType } from '@/spreadsheet-import/types/SpreadsheetColumnType'; import { type SpreadsheetColumns } from '@/spreadsheet-import/types/SpreadsheetColumns'; import { spreadsheetImportBuildFieldOptions } from '@/spreadsheet-import/utils/spreadsheetImportBuildFieldOptions'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { IconForbid } from 'twenty-ui/display'; @@ -37,7 +37,7 @@ export const TemplateColumn = ({ onChange, }: TemplateColumnProps) => { const { spreadsheetImportFields: fields } = useSpreadsheetImportInternal(); - const suggestedFieldsByColumnHeader = useRecoilValueV2( + const suggestedFieldsByColumnHeader = useAtomStateValue( suggestedFieldsByColumnHeaderState, ); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/initialComputedColumnsState.ts b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/initialComputedColumnsState.ts index 65a0e5b01d..ce22d3fa0a 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/initialComputedColumnsState.ts +++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/initialComputedColumnsState.ts @@ -1,15 +1,15 @@ import { type ImportedRow } from '@/spreadsheet-import/types'; import { type SpreadsheetColumns } from '@/spreadsheet-import/types/SpreadsheetColumns'; import { SpreadsheetColumnType } from '@/spreadsheet-import/types/SpreadsheetColumnType'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -import { createWritableFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createWritableFamilySelectorV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +import { createAtomWritableFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomWritableFamilySelector'; -export const matchColumnsState = createStateV2({ +export const matchColumnsState = createAtomState({ key: 'MatchColumnsState', defaultValue: [] as SpreadsheetColumns, }); -export const initialComputedColumnsSelector = createWritableFamilySelectorV2< +export const initialComputedColumnsSelector = createAtomWritableFamilySelector< SpreadsheetColumns, ImportedRow >({ diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/suggestedFieldsByColumnHeaderState.ts b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/suggestedFieldsByColumnHeaderState.ts index a3a6414b0f..62c666bca3 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/suggestedFieldsByColumnHeaderState.ts +++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/states/suggestedFieldsByColumnHeaderState.ts @@ -1,7 +1,7 @@ import { type SpreadsheetImportField } from '@/spreadsheet-import/types'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const suggestedFieldsByColumnHeaderState = createStateV2({ +export const suggestedFieldsByColumnHeaderState = createAtomState({ key: 'suggestedFieldsByColumnHeaderState', defaultValue: {} as Record, }); diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsx index 66ab86fb6d..be540b46a1 100644 --- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsx +++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/SpreadsheetImportStepperContainer.tsx @@ -8,7 +8,7 @@ import { useStepBar } from '@/ui/navigation/step-bar/hooks/useStepBar'; import { spreadsheetImportDialogState } from '@/spreadsheet-import/states/spreadsheetImportDialogState'; import { Modal } from '@/ui/layout/modal/components/Modal'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useLingui } from '@lingui/react/macro'; import { MOBILE_VIEWPORT } from 'twenty-ui/theme'; import { SpreadsheetImportStepper } from './SpreadsheetImportStepper'; @@ -28,7 +28,7 @@ const StyledHeader = styled(Modal.Header)` export const SpreadsheetImportStepperContainer = () => { const { t } = useLingui(); - const spreadsheetImportDialog = useRecoilValueV2( + const spreadsheetImportDialog = useAtomStateValue( spreadsheetImportDialogState, ); diff --git a/packages/twenty-front/src/modules/sse-db-event/components/SSEClientEffect.tsx b/packages/twenty-front/src/modules/sse-db-event/components/SSEClientEffect.tsx index 032283c1b8..16a3ef5ce4 100644 --- a/packages/twenty-front/src/modules/sse-db-event/components/SSEClientEffect.tsx +++ b/packages/twenty-front/src/modules/sse-db-event/components/SSEClientEffect.tsx @@ -3,8 +3,8 @@ import { tokenPairState } from '@/auth/states/tokenPairState'; import { useHandleSseClientConnectionRetry } from '@/sse-db-event/hooks/useHandleSseClientConnectionRetry'; import { activeQueryListenersState } from '@/sse-db-event/states/activeQueryListenersState'; import { sseClientState } from '@/sse-db-event/states/sseClientState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isNonEmptyArray } from '@sniptt/guards'; import { createClient } from 'graphql-sse'; import { useCallback, useEffect } from 'react'; @@ -15,8 +15,8 @@ import { useStore } from 'jotai'; export const SSEClientEffect = () => { const store = useStore(); const isLoggedIn = useIsLogged(); - const [sseClient, setSseClient] = useRecoilStateV2(sseClientState); - const tokenPair = useRecoilValueV2(tokenPairState); + const [sseClient, setSseClient] = useAtomState(sseClientState); + const tokenPair = useAtomStateValue(tokenPairState); const handleSSEClientConnected = useCallback(() => { const currentActiveQueryListeners = store.get( diff --git a/packages/twenty-front/src/modules/sse-db-event/components/SSEEventStreamEffect.tsx b/packages/twenty-front/src/modules/sse-db-event/components/SSEEventStreamEffect.tsx index f3722a2cb5..5d0b7af7fc 100644 --- a/packages/twenty-front/src/modules/sse-db-event/components/SSEEventStreamEffect.tsx +++ b/packages/twenty-front/src/modules/sse-db-event/components/SSEEventStreamEffect.tsx @@ -7,7 +7,7 @@ import { isCreatingSseEventStreamState } from '@/sse-db-event/states/isCreatingS import { isDestroyingEventStreamState } from '@/sse-db-event/states/isDestroyingEventStreamState'; import { shouldDestroyEventStreamState } from '@/sse-db-event/states/shouldDestroyEventStreamState'; import { sseEventStreamIdState } from '@/sse-db-event/states/sseEventStreamIdState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isNonEmptyArray } from '@apollo/client/utilities'; import { isNonEmptyString } from '@sniptt/guards'; import { useEffect } from 'react'; @@ -15,21 +15,21 @@ import { isDefined } from 'twenty-shared/utils'; import { OnboardingStatus } from '~/generated-metadata/graphql'; export const SSEEventStreamEffect = () => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); - const sseEventStreamId = useRecoilValueV2(sseEventStreamIdState); - const isCreatingSseEventStream = useRecoilValueV2( + const sseEventStreamId = useAtomStateValue(sseEventStreamIdState); + const isCreatingSseEventStream = useAtomStateValue( isCreatingSseEventStreamState, ); - const shouldDestroyEventStream = useRecoilValueV2( + const shouldDestroyEventStream = useAtomStateValue( shouldDestroyEventStreamState, ); - const isDestroyingEventStream = useRecoilValueV2( + const isDestroyingEventStream = useAtomStateValue( isDestroyingEventStreamState, ); const isLoggedIn = useIsLogged(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const { triggerEventStreamCreation } = useTriggerEventStreamCreation(); const { triggerEventStreamDestroy } = useTriggerEventStreamDestroy(); diff --git a/packages/twenty-front/src/modules/sse-db-event/components/SSEQuerySubscribeEffect.tsx b/packages/twenty-front/src/modules/sse-db-event/components/SSEQuerySubscribeEffect.tsx index 0b7ebab529..0af12639b1 100644 --- a/packages/twenty-front/src/modules/sse-db-event/components/SSEQuerySubscribeEffect.tsx +++ b/packages/twenty-front/src/modules/sse-db-event/components/SSEQuerySubscribeEffect.tsx @@ -5,7 +5,7 @@ import { requiredQueryListenersState } from '@/sse-db-event/states/requiredQuery import { shouldDestroyEventStreamState } from '@/sse-db-event/states/shouldDestroyEventStreamState'; import { sseEventStreamIdState } from '@/sse-db-event/states/sseEventStreamIdState'; import { sseEventStreamReadyState } from '@/sse-db-event/states/sseEventStreamReadyState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { ApolloError, useMutation } from '@apollo/client'; import { isNonEmptyString } from '@sniptt/guards'; import { useCallback, useEffect } from 'react'; @@ -22,8 +22,8 @@ import { useStore } from 'jotai'; export const SSEQuerySubscribeEffect = () => { const store = useStore(); - const sseEventStreamId = useRecoilValueV2(sseEventStreamIdState); - const sseEventStreamReady = useRecoilValueV2(sseEventStreamReadyState); + const sseEventStreamId = useAtomStateValue(sseEventStreamIdState); + const sseEventStreamReady = useAtomStateValue(sseEventStreamReadyState); const [addQueryToEventStream] = useMutation< boolean, @@ -35,8 +35,8 @@ export const SSEQuerySubscribeEffect = () => { { input: RemoveQueryFromEventStreamInput } >(REMOVE_QUERY_FROM_EVENT_STREAM_MUTATION); - const requiredQueryListeners = useRecoilValueV2(requiredQueryListenersState); - const activeQueryListeners = useRecoilValueV2(activeQueryListenersState); + const requiredQueryListeners = useAtomStateValue(requiredQueryListenersState); + const activeQueryListeners = useAtomStateValue(activeQueryListenersState); const updateQueryListeners = useCallback(async () => { if (!isDefined(sseEventStreamId)) { diff --git a/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamCreation.ts b/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamCreation.ts index 27b8347c6e..7ba5f2af9e 100644 --- a/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamCreation.ts +++ b/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamCreation.ts @@ -9,7 +9,7 @@ import { shouldDestroyEventStreamState } from '@/sse-db-event/states/shouldDestr import { sseClientState } from '@/sse-db-event/states/sseClientState'; import { sseEventStreamIdState } from '@/sse-db-event/states/sseEventStreamIdState'; import { sseEventStreamReadyState } from '@/sse-db-event/states/sseEventStreamReadyState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { captureException } from '@sentry/react'; import { isNonEmptyString } from '@sniptt/guards'; import { print, type ExecutionResult } from 'graphql'; @@ -22,7 +22,7 @@ import { useStore } from 'jotai'; export const useTriggerEventStreamCreation = () => { const store = useStore(); - const setIsCreatingSseEventStream = useSetRecoilStateV2( + const setIsCreatingSseEventStream = useSetAtomState( isCreatingSseEventStreamState, ); diff --git a/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamDestroy.ts b/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamDestroy.ts index a107b9cb15..f3d836f308 100644 --- a/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamDestroy.ts +++ b/packages/twenty-front/src/modules/sse-db-event/hooks/useTriggerEventStreamDestroy.ts @@ -4,14 +4,14 @@ import { isDestroyingEventStreamState } from '@/sse-db-event/states/isDestroying import { shouldDestroyEventStreamState } from '@/sse-db-event/states/shouldDestroyEventStreamState'; import { sseEventStreamIdState } from '@/sse-db-event/states/sseEventStreamIdState'; import { sseEventStreamReadyState } from '@/sse-db-event/states/sseEventStreamReadyState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isNonEmptyString } from '@sniptt/guards'; import { useCallback } from 'react'; import { useStore } from 'jotai'; export const useTriggerEventStreamDestroy = () => { const store = useStore(); - const setIsDestroyingEventStream = useSetRecoilStateV2( + const setIsDestroyingEventStream = useSetAtomState( isDestroyingEventStreamState, ); diff --git a/packages/twenty-front/src/modules/sse-db-event/states/activeQueryListenersState.ts b/packages/twenty-front/src/modules/sse-db-event/states/activeQueryListenersState.ts index 044cd85121..6ae237769a 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/activeQueryListenersState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/activeQueryListenersState.ts @@ -1,10 +1,10 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type MetadataGqlOperationSignature, type RecordGqlOperationSignature, } from 'twenty-shared/types'; -export const activeQueryListenersState = createStateV2< +export const activeQueryListenersState = createAtomState< { queryId: string; operationSignature: diff --git a/packages/twenty-front/src/modules/sse-db-event/states/disposeFunctionByEventStreamMapState.ts b/packages/twenty-front/src/modules/sse-db-event/states/disposeFunctionByEventStreamMapState.ts index 45f4f7f3de..7c3115040d 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/disposeFunctionByEventStreamMapState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/disposeFunctionByEventStreamMapState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const disposeFunctionForEventStreamState = createStateV2<{ +export const disposeFunctionForEventStreamState = createAtomState<{ dispose: () => void; } | null>({ key: 'disposeFunctionForEventStreamState', diff --git a/packages/twenty-front/src/modules/sse-db-event/states/isCreatingSseEventStreamState.ts b/packages/twenty-front/src/modules/sse-db-event/states/isCreatingSseEventStreamState.ts index 66b8299bdb..14b978077f 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/isCreatingSseEventStreamState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/isCreatingSseEventStreamState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isCreatingSseEventStreamState = createStateV2({ +export const isCreatingSseEventStreamState = createAtomState({ key: 'isCreatingSseEventStreamState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/sse-db-event/states/isDestroyingEventStreamState.ts b/packages/twenty-front/src/modules/sse-db-event/states/isDestroyingEventStreamState.ts index 92ade571d5..04ae3dfd8b 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/isDestroyingEventStreamState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/isDestroyingEventStreamState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isDestroyingEventStreamState = createStateV2({ +export const isDestroyingEventStreamState = createAtomState({ key: 'isDestroyingEventStreamState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/sse-db-event/states/requiredQueryListenersState.ts b/packages/twenty-front/src/modules/sse-db-event/states/requiredQueryListenersState.ts index 9969bd5ac8..4aaa07a84b 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/requiredQueryListenersState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/requiredQueryListenersState.ts @@ -1,10 +1,10 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type MetadataGqlOperationSignature, type RecordGqlOperationSignature, } from 'twenty-shared/types'; -export const requiredQueryListenersState = createStateV2< +export const requiredQueryListenersState = createAtomState< { queryId: string; operationSignature: diff --git a/packages/twenty-front/src/modules/sse-db-event/states/shouldDestroyEventStreamState.ts b/packages/twenty-front/src/modules/sse-db-event/states/shouldDestroyEventStreamState.ts index 9f5eb4efbc..bfc6910f21 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/shouldDestroyEventStreamState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/shouldDestroyEventStreamState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const shouldDestroyEventStreamState = createStateV2({ +export const shouldDestroyEventStreamState = createAtomState({ key: 'shouldDestroyEventStreamState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/sse-db-event/states/sseClientState.ts b/packages/twenty-front/src/modules/sse-db-event/states/sseClientState.ts index d575add50c..cc5dd79119 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/sseClientState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/sseClientState.ts @@ -1,7 +1,7 @@ import { type Client } from 'graphql-sse'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const sseClientState = createStateV2({ +export const sseClientState = createAtomState({ key: 'sseClientState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamIdState.ts b/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamIdState.ts index 0c4b2cab57..318edfd1af 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamIdState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const sseEventStreamIdState = createStateV2({ +export const sseEventStreamIdState = createAtomState({ key: 'sseEventStreamIdState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamReadyState.ts b/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamReadyState.ts index c11a70fe34..d0f8d559da 100644 --- a/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamReadyState.ts +++ b/packages/twenty-front/src/modules/sse-db-event/states/sseEventStreamReadyState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const sseEventStreamReadyState = createStateV2({ +export const sseEventStreamReadyState = createAtomState({ key: 'sseEventStreamReadyState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/support/hooks/useInstantiateSupportChat.ts b/packages/twenty-front/src/modules/support/hooks/useInstantiateSupportChat.ts index 15ac0c168c..738345031a 100644 --- a/packages/twenty-front/src/modules/support/hooks/useInstantiateSupportChat.ts +++ b/packages/twenty-front/src/modules/support/hooks/useInstantiateSupportChat.ts @@ -2,7 +2,7 @@ import { currentUserState } from '@/auth/states/currentUserState'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { supportChatState } from '@/client-config/states/supportChatState'; import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isNonEmptyString } from '@sniptt/guards'; import { useCallback, useEffect, useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -28,9 +28,9 @@ const insertScript = ({ }; export const useInstantiateSupportChat = () => { - const currentUser = useRecoilValueV2(currentUserState); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); - const supportChat = useRecoilValueV2(supportChatState); + const currentUser = useAtomStateValue(currentUserState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); + const supportChat = useAtomStateValue(supportChatState); const [isFrontChatLoaded, setIsFrontChatLoaded] = useState(false); const loading = useIsPrefetchLoading(); diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManager.tsx b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManager.tsx index cabd454088..823cd6b91b 100644 --- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManager.tsx +++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManager.tsx @@ -1,12 +1,12 @@ import { dialogInternalComponentState } from '@/ui/feedback/dialog-manager/states/dialogInternalComponentState'; import { useDialogManager } from '@/ui/feedback/dialog-manager/hooks/useDialogManager'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { Dialog } from './Dialog'; import { DialogManagerEffect } from './DialogManagerEffect'; export const DialogManager = ({ children }: React.PropsWithChildren) => { - const dialogInternal = useRecoilComponentValueV2( + const dialogInternal = useAtomComponentStateValue( dialogInternalComponentState, ); const { closeDialog } = useDialogManager(); diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx index 6a474d7dba..ddb9712370 100644 --- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx +++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/components/DialogManagerEffect.tsx @@ -5,10 +5,10 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePush import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; import { dialogInternalComponentState } from '@/ui/feedback/dialog-manager/states/dialogInternalComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const DialogManagerEffect = () => { - const dialogInternal = useRecoilComponentValueV2( + const dialogInternal = useAtomComponentStateValue( dialogInternalComponentState, ); diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/hooks/__tests__/useDialogManager.test.tsx b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/hooks/__tests__/useDialogManager.test.tsx index a719482150..e78631b142 100644 --- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/hooks/__tests__/useDialogManager.test.tsx +++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/hooks/__tests__/useDialogManager.test.tsx @@ -7,7 +7,7 @@ import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/con import { useDialogManager } from '@/ui/feedback/dialog-manager/hooks/useDialogManager'; import { dialogInternalComponentState } from '@/ui/feedback/dialog-manager/states/dialogInternalComponentState'; import { type DialogOptions } from '@/ui/feedback/dialog-manager/types/DialogOptions'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore, resetJotaiStore, @@ -84,7 +84,7 @@ const renderHooks = () => { const { result } = renderHook( () => ({ dialogManager: useDialogManager(), - dialogInternal: useRecoilComponentValueV2(dialogInternalComponentState), + dialogInternal: useAtomComponentStateValue(dialogInternalComponentState), }), renderHookConfig, ); diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalComponentState.ts b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalComponentState.ts index d84f46874c..4044f3da32 100644 --- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalComponentState.ts +++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalComponentState.ts @@ -1,5 +1,5 @@ import { DialogComponentInstanceContext } from '@/ui/feedback/dialog-manager/contexts/DialogComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type DialogOptions } from '@/ui/feedback/dialog-manager/types/DialogOptions'; type DialogState = { @@ -7,13 +7,12 @@ type DialogState = { queue: DialogOptions[]; }; -export const dialogInternalComponentState = createComponentStateV2( - { +export const dialogInternalComponentState = + createAtomComponentState({ key: 'dialogInternalComponentState', defaultValue: { maxQueue: 2, queue: [], }, componentInstanceContext: DialogComponentInstanceContext, - }, -); + }); diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsx b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsx index b834e7809c..aacfb55132 100644 --- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsx +++ b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsx @@ -6,7 +6,7 @@ import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; import { snackBarInternalComponentState } from '@/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState'; import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { MOBILE_VIEWPORT } from 'twenty-ui/theme'; import { SnackBar } from './SnackBar'; @@ -27,7 +27,7 @@ const StyledSnackBarContainer = styled.div` `; export const SnackBarProvider = ({ children }: React.PropsWithChildren) => { - const snackBarInternal = useRecoilComponentValueV2( + const snackBarInternal = useAtomComponentStateValue( snackBarInternalComponentState, ); diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState.ts index ce3cd3ed64..6c18541da1 100644 --- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState.ts +++ b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalComponentState.ts @@ -1,5 +1,5 @@ import { SnackBarComponentInstanceContext } from '@/ui/feedback/snack-bar-manager/contexts/SnackBarComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type SnackBarProps } from '@/ui/feedback/snack-bar-manager/components/SnackBar'; export type SnackBarOptions = SnackBarProps & { @@ -12,7 +12,7 @@ export type SnackBarState = { }; export const snackBarInternalComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'snackBarState', defaultValue: { maxQueue: 3, diff --git a/packages/twenty-front/src/modules/ui/field/display/components/DateDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/DateDisplay.tsx index 549fb48adf..6f00ae6c1e 100644 --- a/packages/twenty-front/src/modules/ui/field/display/components/DateDisplay.tsx +++ b/packages/twenty-front/src/modules/ui/field/display/components/DateDisplay.tsx @@ -1,5 +1,5 @@ import { type FieldDateMetadataSettings } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import { useContext } from 'react'; import { dateLocaleState } from '~/localization/states/dateLocaleState'; @@ -12,7 +12,7 @@ type DateDisplayProps = { }; export const DateDisplay = ({ value, dateFieldSettings }: DateDisplayProps) => { const { dateFormat } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); const formattedDate = formatDateString({ value, diff --git a/packages/twenty-front/src/modules/ui/field/display/components/DateTimeDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/DateTimeDisplay.tsx index d75bb2f442..412eef8ac3 100644 --- a/packages/twenty-front/src/modules/ui/field/display/components/DateTimeDisplay.tsx +++ b/packages/twenty-front/src/modules/ui/field/display/components/DateTimeDisplay.tsx @@ -1,6 +1,6 @@ import { type FieldDateMetadataSettings } from '@/object-record/record-field/ui/types/FieldMetadata'; import { TimeZoneAbbreviation } from '@/ui/input/components/internal/date/components/TimeZoneAbbreviation'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { UserContext } from '@/users/contexts/UserContext'; import styled from '@emotion/styled'; import { isNonEmptyString } from '@sniptt/guards'; @@ -24,7 +24,7 @@ export const DateTimeDisplay = ({ dateFieldSettings, }: DateTimeDisplayProps) => { const { dateFormat, timeFormat, timeZone } = useContext(UserContext); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); const formattedDate = formatDateTimeString({ value, diff --git a/packages/twenty-front/src/modules/ui/field/display/components/FilesDisplay.tsx b/packages/twenty-front/src/modules/ui/field/display/components/FilesDisplay.tsx index 8bdfe2ac92..e96f02f23f 100644 --- a/packages/twenty-front/src/modules/ui/field/display/components/FilesDisplay.tsx +++ b/packages/twenty-front/src/modules/ui/field/display/components/FilesDisplay.tsx @@ -5,8 +5,8 @@ import { FileChip } from '@/ui/field/display/components/FileChip'; import { UploadFileChip } from '@/ui/field/display/components/UploadFileChip'; import { filePreviewStateV2 } from '@/ui/field/display/states/filePreviewStateV2'; import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { isDefined } from 'twenty-shared/utils'; type FilesDisplayProps = { @@ -22,8 +22,8 @@ export const FilesDisplay = ({ isUploadWindowOpen = false, isFileUploading = false, }: FilesDisplayProps) => { - const setFilePreview = useSetRecoilStateV2(filePreviewStateV2); - const isAttachmentPreviewEnabled = useRecoilValueV2( + const setFilePreview = useSetAtomState(filePreviewStateV2); + const isAttachmentPreviewEnabled = useAtomStateValue( isAttachmentPreviewEnabledStateV2, ); diff --git a/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx index 4dff5d7b3d..3a747ff007 100644 --- a/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx +++ b/packages/twenty-front/src/modules/ui/field/display/components/GlobalFilePreviewModal.tsx @@ -2,7 +2,7 @@ import { downloadFile } from '@/activities/files/utils/downloadFile'; import { filePreviewStateV2 } from '@/ui/field/display/states/filePreviewStateV2'; import { Modal } from '@/ui/layout/modal/components/Modal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; @@ -72,7 +72,7 @@ const StyledLoadingText = styled.div` export const GlobalFilePreviewModal = (): JSX.Element | null => { const { t } = useLingui(); - const [filePreview, setFilePreview] = useRecoilStateV2(filePreviewStateV2); + const [filePreview, setFilePreview] = useAtomState(filePreviewStateV2); const { openModal, closeModal } = useModal(); useEffect(() => { diff --git a/packages/twenty-front/src/modules/ui/field/display/states/filePreviewState.ts b/packages/twenty-front/src/modules/ui/field/display/states/filePreviewState.ts index 272c2cc016..f66eb3dc56 100644 --- a/packages/twenty-front/src/modules/ui/field/display/states/filePreviewState.ts +++ b/packages/twenty-front/src/modules/ui/field/display/states/filePreviewState.ts @@ -1,7 +1,7 @@ import { type FieldFilesValue } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const filePreviewState = createStateV2({ +export const filePreviewState = createAtomState({ key: 'filePreviewState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ui/field/display/states/filePreviewStateV2.ts b/packages/twenty-front/src/modules/ui/field/display/states/filePreviewStateV2.ts index 7d56a73fac..dfe1c5262d 100644 --- a/packages/twenty-front/src/modules/ui/field/display/states/filePreviewStateV2.ts +++ b/packages/twenty-front/src/modules/ui/field/display/states/filePreviewStateV2.ts @@ -1,7 +1,7 @@ import { type FieldFilesValue } from '@/object-record/record-field/ui/types/FieldMetadata'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const filePreviewStateV2 = createStateV2({ +export const filePreviewStateV2 = createAtomState({ key: 'filePreviewStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx index b788bf5292..0a0207972d 100644 --- a/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx +++ b/packages/twenty-front/src/modules/ui/field/input/components/AddressInput.tsx @@ -13,7 +13,7 @@ import { SELECT_COUNTRY_DROPDOWN_ID } from '@/ui/input/components/internal/count import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { activeDropdownFocusIdState } from '@/ui/layout/dropdown/states/activeDropdownFocusIdState'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { MOBILE_VIEWPORT } from 'twenty-ui/theme'; import { v4 } from 'uuid'; @@ -236,7 +236,7 @@ export const AddressInput = ({ onShiftTab: handleShiftTab, }); - const activeDropdownFocusId = useRecoilValueV2(activeDropdownFocusIdState); + const activeDropdownFocusId = useAtomStateValue(activeDropdownFocusIdState); useListenClickOutside({ refs: [wrapperRef], diff --git a/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx index bc22a9eb19..8391bf08e5 100644 --- a/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx +++ b/packages/twenty-front/src/modules/ui/field/input/components/MultiSelectInput.tsx @@ -14,7 +14,7 @@ import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectab import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; import { type SelectOption } from 'twenty-ui/input'; @@ -47,7 +47,7 @@ export const MultiSelectInput = ({ selectableListComponentInstanceId, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, selectableListComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx b/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx index 8a303bb1f4..e9b33f5e2c 100644 --- a/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx @@ -16,12 +16,12 @@ import { } from '@/ui/input/states/iconPickerVisibleCountState'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { type DropdownOffset } from '@/ui/layout/dropdown/types/DropdownOffset'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { useStore } from 'jotai'; import { IconApps, type IconComponent, useIcons } from 'twenty-ui/display'; @@ -103,7 +103,7 @@ const IconPickerIcon = ({ Icon, focusedIconKey, }: IconPickerIconProps) => { - const isSelectedItemId = useRecoilComponentValueV2( + const isSelectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, iconKey, ); @@ -163,7 +163,7 @@ export const IconPicker = ({ const store = useStore(); const iconPickerVisibleCount = - useFamilyRecoilValueV2(iconPickerVisibleCountState, dropdownId) ?? + useAtomFamilyStateValue(iconPickerVisibleCountState, dropdownId) ?? maxIconsVisible; const resetIconPickerVisibleCount = useCallback(() => { @@ -252,7 +252,7 @@ export const IconPicker = ({ const selectableListInstanceId = 'icon-list'; const focusedIconKey = - useRecoilComponentValueV2( + useAtomComponentStateValue( selectedItemIdComponentState, selectableListInstanceId, ) ?? undefined; diff --git a/packages/twenty-front/src/modules/ui/input/components/Select.tsx b/packages/twenty-front/src/modules/ui/input/components/Select.tsx index 482d5a0f69..9c6a86a0fc 100644 --- a/packages/twenty-front/src/modules/ui/input/components/Select.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/Select.tsx @@ -16,7 +16,7 @@ import { SelectableList } from '@/ui/layout/selectable-list/components/Selectabl import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isNonEmptyArray, isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { type IconComponent } from 'twenty-ui/display'; @@ -140,7 +140,7 @@ export const Select = ({ const selectableItemIdArray = filteredOptions.map((option) => option.label); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/ui/input/components/SelectInput.tsx b/packages/twenty-front/src/modules/ui/input/components/SelectInput.tsx index 198ae0e5e4..f9f93f9d55 100644 --- a/packages/twenty-front/src/modules/ui/input/components/SelectInput.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/SelectInput.tsx @@ -8,7 +8,7 @@ import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-l import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/component-state/hooks/useAvailableComponentInstanceIdOrThrow'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useEffect, useMemo, useRef, useState } from 'react'; import { t } from '@lingui/core/macro'; import { isDefined } from 'twenty-shared/utils'; @@ -46,7 +46,7 @@ export const SelectInput = ({ SelectableListComponentInstanceContext, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, selectableListInstanceId, ); diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx index c78987c38a..a92f8171da 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePicker.tsx @@ -17,7 +17,7 @@ import { t } from '@lingui/core/macro'; import 'react-datepicker/dist/react-datepicker.css'; import { useUserTimezone } from '@/ui/input/components/internal/date/hooks/useUserTimezone'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Temporal } from 'temporal-polyfill'; import { type Nullable } from 'twenty-shared/types'; import { @@ -356,7 +356,7 @@ export const DatePicker = ({ const { closeDropdown: closeDropdownMonthSelect } = useCloseDropdown(); const { closeDropdown: closeDropdownYearSelect } = useCloseDropdown(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const handleClear = () => { closeDropdowns(); onClear?.(); diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerHeader.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerHeader.tsx index b0fc6b5057..36f983fb4f 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerHeader.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerHeader.tsx @@ -13,7 +13,7 @@ import { } from './DateTimePicker'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Temporal } from 'temporal-polyfill'; import { SOURCE_LOCALE } from 'twenty-shared/translations'; import { isDefined } from 'twenty-shared/utils'; @@ -57,7 +57,7 @@ export const DatePickerHeader = ({ nextMonthButtonDisabled, hideInput = false, }: DatePickerHeaderProps) => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const userLocale = currentWorkspaceMember?.locale ?? SOURCE_LOCALE; const dateParsed = isDefined(date) ? Temporal.PlainDate.from(date) : null; diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx index 8936590c6a..de212d43ff 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DatePickerWithoutCalendar.tsx @@ -13,7 +13,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useTheme } from '@emotion/react'; import 'react-datepicker/dist/react-datepicker.css'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Temporal } from 'temporal-polyfill'; import { type Nullable } from 'twenty-shared/types'; import { isDefined, turnJSDateToPlainDate } from 'twenty-shared/utils'; @@ -328,7 +328,7 @@ export const DatePickerWithoutCalendar = ({ const { closeDropdown: closeDropdownMonthSelect } = useCloseDropdown(); const { closeDropdown: closeDropdownYearSelect } = useCloseDropdown(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const closeDropdowns = () => { closeDropdownYearSelect(MONTH_AND_YEAR_DROPDOWN_YEAR_SELECT_ID); diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePickerHeader.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePickerHeader.tsx index 6500188fef..2286832bc9 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePickerHeader.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/DateTimePickerHeader.tsx @@ -1,7 +1,7 @@ import styled from '@emotion/styled'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Select } from '@/ui/input/components/Select'; import { DateTimePickerInput } from '@/ui/input/components/internal/date/components/DateTimePickerInput'; @@ -61,7 +61,7 @@ export const DateTimePickerHeader = ({ nextMonthButtonDisabled, hideInput = false, }: DateTimePickerHeaderProps) => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const userLocale = currentWorkspaceMember?.locale ?? SOURCE_LOCALE; return ( diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserDateFormat.ts b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserDateFormat.ts index a5fbe92f98..329ab0aae1 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserDateFormat.ts +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserDateFormat.ts @@ -1,9 +1,9 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { WorkspaceMemberDateFormatEnum } from '~/generated-metadata/graphql'; export const useUserDateFormat = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const userDateFormat = currentWorkspaceMember?.dateFormat ?? WorkspaceMemberDateFormatEnum.SYSTEM; diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek.ts b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek.ts index 39fc9f9285..66904b01d9 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek.ts +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserFirstDayOfTheWeek.ts @@ -1,6 +1,6 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { detectCalendarStartDay } from '@/localization/utils/detection/detectCalendarStartDay'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CalendarStartDay } from 'twenty-shared/constants'; import { convertCalendarStartDayNonIsoNumberToFirstDayOfTheWeek, @@ -8,7 +8,7 @@ import { } from 'twenty-shared/utils'; export const useUserFirstDayOfTheWeek = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const systemFirstDayOfTheWeek = detectCalendarStartDay(); const isSystemFirstDayOfTheWeek = diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimeFormat.ts b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimeFormat.ts index bb6613ec58..862811a255 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimeFormat.ts +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimeFormat.ts @@ -1,9 +1,9 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { WorkspaceMemberTimeFormatEnum } from '~/generated-metadata/graphql'; export const useUserTimeFormat = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const userTimeFormat = currentWorkspaceMember?.timeFormat ?? WorkspaceMemberTimeFormatEnum.SYSTEM; diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimezone.ts b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimezone.ts index 5c0635754f..577eec4271 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimezone.ts +++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/hooks/useUserTimezone.ts @@ -1,8 +1,8 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useUserTimezone = () => { - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const systemTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; const userTimezone = diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx index 7d71264bee..22fc278932 100644 --- a/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx +++ b/packages/twenty-front/src/modules/ui/input/components/internal/phone/components/PhoneCountryPickerDropdownButton.tsx @@ -10,7 +10,7 @@ import { PhoneCountryPickerDropdownSelect } from './PhoneCountryPickerDropdownSe import { PHONE_COUNTRY_CODE_PICKER_DROPDOWN_ID } from '@/ui/input/components/internal/phone/constants/PhoneCountryCodePickerDropdownId'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import 'react-phone-number-input/style.css'; import { isDefined } from 'twenty-shared/utils'; import { IconChevronDown, IconWorld } from 'twenty-ui/display'; @@ -78,7 +78,7 @@ export const PhoneCountryPickerDropdownButton = ({ const [selectedCountry, setSelectedCountry] = useState(); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, PHONE_COUNTRY_CODE_PICKER_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/ui/input/hooks/IconPickerScrollEffect.tsx b/packages/twenty-front/src/modules/ui/input/hooks/IconPickerScrollEffect.tsx index b200a24b2e..819a0faee6 100644 --- a/packages/twenty-front/src/modules/ui/input/hooks/IconPickerScrollEffect.tsx +++ b/packages/twenty-front/src/modules/ui/input/hooks/IconPickerScrollEffect.tsx @@ -1,5 +1,5 @@ import { iconPickerVisibleCountState } from '@/ui/input/states/iconPickerVisibleCountState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useScrollWrapperHTMLElement } from '@/ui/utilities/scroll/hooks/useScrollWrapperHTMLElement'; import { useEffect } from 'react'; @@ -14,7 +14,7 @@ export const IconPickerScrollEffect = ({ }: IconPickerScrollEffectProps) => { const { scrollWrapperHTMLElement } = useScrollWrapperHTMLElement(); - const setIconPickerVisibleCount = useSetFamilyRecoilStateV2( + const setIconPickerVisibleCount = useSetAtomFamilyState( iconPickerVisibleCountState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/ui/input/hooks/useIconPicker.ts b/packages/twenty-front/src/modules/ui/input/hooks/useIconPicker.ts index 4476ad19c4..de9d3dc98a 100644 --- a/packages/twenty-front/src/modules/ui/input/hooks/useIconPicker.ts +++ b/packages/twenty-front/src/modules/ui/input/hooks/useIconPicker.ts @@ -1,8 +1,8 @@ import { iconPickerState } from '@/ui/input/states/iconPickerState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; export const useIconPicker = () => { - const [iconPicker, setIconPicker] = useRecoilStateV2(iconPickerState); + const [iconPicker, setIconPicker] = useAtomState(iconPickerState); return { Icon: iconPicker.Icon, diff --git a/packages/twenty-front/src/modules/ui/input/states/iconPickerState.ts b/packages/twenty-front/src/modules/ui/input/states/iconPickerState.ts index 51e0282f89..bc8e587d23 100644 --- a/packages/twenty-front/src/modules/ui/input/states/iconPickerState.ts +++ b/packages/twenty-front/src/modules/ui/input/states/iconPickerState.ts @@ -1,4 +1,4 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { IconApps, type IconComponent } from 'twenty-ui/display'; type IconPickerState = { @@ -6,7 +6,7 @@ type IconPickerState = { iconKey: string; }; -export const iconPickerState = createStateV2({ +export const iconPickerState = createAtomState({ key: 'iconPickerState', defaultValue: { Icon: IconApps, iconKey: 'IconApps' }, }); diff --git a/packages/twenty-front/src/modules/ui/input/states/iconPickerVisibleCountState.ts b/packages/twenty-front/src/modules/ui/input/states/iconPickerVisibleCountState.ts index 3a4401eb6d..62658ff90f 100644 --- a/packages/twenty-front/src/modules/ui/input/states/iconPickerVisibleCountState.ts +++ b/packages/twenty-front/src/modules/ui/input/states/iconPickerVisibleCountState.ts @@ -1,8 +1,11 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; export const ICON_PICKER_DEFAULT_VISIBLE_COUNT = 25; -export const iconPickerVisibleCountState = createFamilyStateV2({ +export const iconPickerVisibleCountState = createAtomFamilyState< + number, + string +>({ key: 'iconPickerVisibleCountState', defaultValue: ICON_PICKER_DEFAULT_VISIBLE_COUNT, }); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx index 1e2cbd4011..f1809fa30f 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/Dropdown.tsx @@ -13,8 +13,8 @@ import { dropdownYPositionComponentState } from '@/ui/layout/dropdown/states/int import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; import { type DropdownOffset } from '@/ui/layout/dropdown/types/DropdownOffset'; import { type GlobalHotkeysConfig } from '@/ui/utilities/hotkey/types/GlobalHotkeysConfig'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { type Placement, @@ -88,7 +88,7 @@ export const Dropdown = ({ disableClickForClickableComponent = false, middlewareBoundaryPadding = {}, }: DropdownProps) => { - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); @@ -107,17 +107,17 @@ export const Dropdown = ({ ] : []; - const setDropdownMaxHeight = useSetRecoilComponentStateV2( + const setDropdownMaxHeight = useSetAtomComponentState( dropdownMaxHeightComponentState, dropdownId, ); - const setDropdownMaxWidth = useSetRecoilComponentStateV2( + const setDropdownMaxWidth = useSetAtomComponentState( dropdownMaxWidthComponentState, dropdownId, ); - const setDropdownYPosition = useSetRecoilComponentStateV2( + const setDropdownYPosition = useSetAtomComponentState( dropdownYPositionComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownOnToggleEffect.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownOnToggleEffect.tsx index 6a451e3a77..eb77b05627 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownOnToggleEffect.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/DropdownOnToggleEffect.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; export const DropdownOnToggleEffect = ({ onDropdownClose, @@ -10,7 +10,7 @@ export const DropdownOnToggleEffect = ({ onDropdownClose?: () => void; onDropdownOpen?: () => void; }) => { - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx index 8f1a160e0d..e1063f6b0f 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/components/internal/DropdownInternalContainer.tsx @@ -11,9 +11,9 @@ import { HotkeyEffect } from '@/ui/utilities/hotkey/components/HotkeyEffect'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { ClickOutsideListenerContext } from '@/ui/utilities/pointer-event/contexts/ClickOutsideListenerContext'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import styled from '@emotion/styled'; import { FloatingPortal, @@ -70,25 +70,25 @@ export const DropdownInternalContainer = ({ excludedClickOutsideIds, isDropdownInModal = false, }: DropdownInternalContainerProps) => { - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); const { closeDropdown } = useCloseDropdown(); - const activeDropdownFocusId = useRecoilValueV2(activeDropdownFocusIdState); + const activeDropdownFocusId = useAtomStateValue(activeDropdownFocusIdState); - const dropdownMaxHeight = useRecoilComponentValueV2( + const dropdownMaxHeight = useAtomComponentStateValue( dropdownMaxHeightComponentState, dropdownId, ); - const dropdownMaxWidth = useRecoilComponentValueV2( + const dropdownMaxWidth = useAtomComponentStateValue( dropdownMaxWidthComponentState, dropdownId, ); - const setDropdownPlacement = useSetRecoilComponentStateV2( + const setDropdownPlacement = useSetAtomComponentState( dropdownPlacementComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseAnyOpenDropdown.test.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseAnyOpenDropdown.test.tsx index 08f45a9e15..401068949a 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseAnyOpenDropdown.test.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseAnyOpenDropdown.test.tsx @@ -7,7 +7,7 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/ import { useCloseAnyOpenDropdown } from '@/ui/layout/dropdown/hooks/useCloseAnyOpenDropdown'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; const dropdownId = 'test-dropdown-id'; @@ -37,7 +37,7 @@ describe('useCloseAnyOpenDropdown', () => { it('should open dropdown and then close it with closeAnyOpenDropdown', async () => { const { result } = renderHook( () => { - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseDropdown.test.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseDropdown.test.tsx index fc0480e23f..a4e816d9f3 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseDropdown.test.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useCloseDropdown.test.tsx @@ -7,7 +7,7 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; const dropdownId = 'test-dropdown-id'; @@ -47,12 +47,12 @@ describe('useCloseDropdown', () => { it('should close dropdown from inside component instance context', async () => { const { result } = renderHook( () => { - const isOutsideDropdownOpen = useRecoilComponentValueV2( + const isOutsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, outsideDropdownId, ); - const isInsideDropdownOpen = useRecoilComponentValueV2( + const isInsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); @@ -89,12 +89,12 @@ describe('useCloseDropdown', () => { it('should close dropdown from outside component instance context', async () => { const { result } = renderHook( () => { - const isOutsideDropdownOpen = useRecoilComponentValueV2( + const isOutsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, outsideDropdownId, ); - const isInsideDropdownOpen = useRecoilComponentValueV2( + const isInsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useOpenDropdown.test.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useOpenDropdown.test.tsx index 29c043dae5..72752b2b71 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useOpenDropdown.test.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useOpenDropdown.test.tsx @@ -6,7 +6,7 @@ import { RecoilRoot } from 'recoil'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; const dropdownId = 'test-dropdown-id'; @@ -46,12 +46,12 @@ describe('useOpenDropdown', () => { it('should open dropdown from inside component instance context', async () => { const { result } = renderHook( () => { - const isOutsideDropdownOpen = useRecoilComponentValueV2( + const isOutsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, outsideDropdownId, ); - const isInsideDropdownOpen = useRecoilComponentValueV2( + const isInsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); @@ -78,12 +78,12 @@ describe('useOpenDropdown', () => { it('should open dropdown from outside component instance context', async () => { const { result } = renderHook( () => { - const isOutsideDropdownOpen = useRecoilComponentValueV2( + const isOutsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, outsideDropdownId, ); - const isInsideDropdownOpen = useRecoilComponentValueV2( + const isInsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useToggleDropdown.test.tsx b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useToggleDropdown.test.tsx index 3042ae7d21..69219d1ee4 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useToggleDropdown.test.tsx +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/hooks/__tests__/useToggleDropdown.test.tsx @@ -6,7 +6,7 @@ import { RecoilRoot } from 'recoil'; import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; import { useToggleDropdown } from '@/ui/layout/dropdown/hooks/useToggleDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; const dropdownId = 'test-dropdown-id'; @@ -46,12 +46,12 @@ describe('useToggleDropdown', () => { it('should toggle dropdown from inside component instance context', async () => { const { result } = renderHook( () => { - const isOutsideDropdownOpen = useRecoilComponentValueV2( + const isOutsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, outsideDropdownId, ); - const isInsideDropdownOpen = useRecoilComponentValueV2( + const isInsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); const { toggleDropdown } = useToggleDropdown(); @@ -91,12 +91,12 @@ describe('useToggleDropdown', () => { it('should toggle dropdown from outside component instance context', async () => { const { result } = renderHook( () => { - const isOutsideDropdownOpen = useRecoilComponentValueV2( + const isOutsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, outsideDropdownId, ); - const isInsideDropdownOpen = useRecoilComponentValueV2( + const isInsideDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ); const { toggleDropdown } = useToggleDropdown(); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.ts index 23fbdfb283..5abc61e4e7 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.ts +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/activeDropdownFocusIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const activeDropdownFocusIdState = createStateV2({ +export const activeDropdownFocusIdState = createAtomState({ key: 'activeDropdownFocusIdState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownPlacementComponentState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownPlacementComponentState.ts index 06fb55bc28..4c710ef957 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownPlacementComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownPlacementComponentState.ts @@ -1,10 +1,10 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type Placement } from '@floating-ui/react'; export const dropdownPlacementComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'dropdownPlacementComponentState', componentInstanceContext: DropdownComponentInstanceContext, defaultValue: null, diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxHeightComponentState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxHeightComponentState.ts index 6edc2856f2..0b07910150 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxHeightComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxHeightComponentState.ts @@ -1,7 +1,7 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const dropdownMaxHeightComponentState = createComponentStateV2< +export const dropdownMaxHeightComponentState = createAtomComponentState< number | undefined >({ key: 'dropdownMaxHeightComponentState', diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxWidthComponentState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxWidthComponentState.ts index 56c671e034..c42b8ee623 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxWidthComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownMaxWidthComponentState.ts @@ -1,7 +1,7 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const dropdownMaxWidthComponentState = createComponentStateV2< +export const dropdownMaxWidthComponentState = createAtomComponentState< number | undefined >({ key: 'dropdownMaxWidthComponentState', diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownYPositionComponentState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownYPositionComponentState.ts index 49741a9ce6..2014ffe3d3 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownYPositionComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/internal/dropdownYPositionComponentState.ts @@ -1,7 +1,7 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const dropdownYPositionComponentState = createComponentStateV2< +export const dropdownYPositionComponentState = createAtomComponentState< number | undefined >({ key: 'dropdownYPositionComponentState', diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenComponentState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenComponentState.ts index abc068d920..6b558a90c1 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenComponentState.ts @@ -1,7 +1,7 @@ import { DropdownComponentInstanceContext } from '@/ui/layout/dropdown/contexts/DropdownComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const isDropdownOpenComponentState = createComponentStateV2({ +export const isDropdownOpenComponentState = createAtomComponentState({ key: 'isDropdownOpenComponentState', defaultValue: false, componentInstanceContext: DropdownComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.ts index 9131957c46..043f4e6f2f 100644 --- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.ts +++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/previousDropdownFocusIdState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const previousDropdownFocusIdState = createStateV2({ +export const previousDropdownFocusIdState = createAtomState({ key: 'previousDropdownFocusIdState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx b/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx index 65cfc6869a..4882a94db0 100644 --- a/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx +++ b/packages/twenty-front/src/modules/ui/layout/modal/components/Modal.tsx @@ -9,7 +9,7 @@ import { MODAL_CLICK_OUTSIDE_LISTENER_EXCLUDED_ID } from '@/ui/layout/modal/cons import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { ClickOutsideListenerContext } from '@/ui/utilities/pointer-event/contexts/ClickOutsideListenerContext'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { css, useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { AnimatePresence, motion } from 'framer-motion'; @@ -243,7 +243,7 @@ export const Modal = ({ e.stopPropagation(); }; - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.tsx b/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.tsx index 555bb6521b..7862152ebc 100644 --- a/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.tsx +++ b/packages/twenty-front/src/modules/ui/layout/modal/hooks/__tests__/useModal.spec.tsx @@ -5,7 +5,7 @@ import { RecoilRoot } from 'recoil'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { isModalOpenedComponentState } from '@/ui/layout/modal/states/isModalOpenedComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; const modalId = 'test-modal-id'; @@ -26,7 +26,7 @@ describe('useModal', () => { const { result } = renderHook( () => { const modal = useModal(); - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); @@ -48,7 +48,7 @@ describe('useModal', () => { const { result } = renderHook( () => { const modal = useModal(); - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); @@ -75,7 +75,7 @@ describe('useModal', () => { const { result } = renderHook( () => { const modal = useModal(); - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); @@ -99,7 +99,7 @@ describe('useModal', () => { const { result } = renderHook( () => { const modal = useModal(); - const isModalOpened = useRecoilComponentValueV2( + const isModalOpened = useAtomComponentStateValue( isModalOpenedComponentState, modalId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/modal/states/isModalOpenedComponentState.ts b/packages/twenty-front/src/modules/ui/layout/modal/states/isModalOpenedComponentState.ts index 3bd62e0761..52af1986db 100644 --- a/packages/twenty-front/src/modules/ui/layout/modal/states/isModalOpenedComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/modal/states/isModalOpenedComponentState.ts @@ -1,7 +1,7 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ModalComponentInstanceContext } from '@/ui/layout/modal/contexts/ModalComponentInstanceContext'; -export const isModalOpenedComponentState = createComponentStateV2({ +export const isModalOpenedComponentState = createAtomComponentState({ key: 'isModalOpenedComponentState', defaultValue: false, componentInstanceContext: ModalComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx index 4480001752..a23987fc33 100644 --- a/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx +++ b/packages/twenty-front/src/modules/ui/layout/page-header/components/PageHeaderToggleCommandMenuButton.tsx @@ -4,7 +4,7 @@ import { isCommandMenuOpenedStateV2 } from '@/command-menu/states/isCommandMenuO import { isNavigationMenuInEditModeStateV2 } from '@/navigation-menu-item/states/isNavigationMenuInEditModeStateV2'; import { RootStackingContextZIndices } from '@/ui/layout/constants/RootStackingContextZIndices'; import { PAGE_HEADER_COMMAND_MENU_BUTTON_CLICK_OUTSIDE_ID } from '@/ui/layout/page-header/constants/PageHeaderCommandMenuButtonClickOutsideId'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { css, useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { i18n } from '@lingui/core'; @@ -122,8 +122,8 @@ const AnimatedIcon = ({ export const PageHeaderToggleCommandMenuButton = () => { const { toggleCommandMenu } = useCommandMenu(); - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); - const isNavigationMenuInEditMode = useRecoilValueV2( + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); + const isNavigationMenuInEditMode = useAtomStateValue( isNavigationMenuInEditModeStateV2, ); diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx index 44ec9b2213..2a59339ab0 100644 --- a/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx +++ b/packages/twenty-front/src/modules/ui/layout/page/components/PageHeader.tsx @@ -7,7 +7,7 @@ import { NavigationDrawerCollapseButton } from '@/ui/navigation/navigation-drawe import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constants/PageActionContainerClickOutsideId'; import { PAGE_BAR_MIN_HEIGHT } from '@/ui/layout/page/constants/PageBarMinHeight'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; import { AnimatePresence } from 'framer-motion'; import { @@ -96,7 +96,7 @@ export const PageHeader = ({ }: PageHeaderProps) => { const isMobile = useIsMobile(); const theme = useTheme(); - const isNavigationDrawerExpanded = useRecoilValueV2( + const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, ); diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx index 63f3e860cf..3cb927874d 100644 --- a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx +++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableList.tsx @@ -4,7 +4,7 @@ import { useSelectableListHotKeys } from '@/ui/layout/selectable-list/hooks/inte import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext'; import { SelectableListContextProvider } from '@/ui/layout/selectable-list/states/contexts/SelectableListContext'; import { selectableItemIdsComponentState } from '@/ui/layout/selectable-list/states/selectableItemIdsComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isDefined } from 'twenty-shared/utils'; import { arrayToChunks } from '~/utils/array/arrayToChunks'; @@ -27,7 +27,7 @@ export const SelectableList = ({ }: SelectableListProps) => { useSelectableListHotKeys(selectableListInstanceId, focusId, onSelect); - const setSelectableItemIds = useSetRecoilComponentStateV2( + const setSelectableItemIds = useSetAtomComponentState( selectableItemIdsComponentState, selectableListInstanceId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItem.tsx b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItem.tsx index 84ed1e0d67..8d0b697356 100644 --- a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItem.tsx +++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableListItem.tsx @@ -2,7 +2,7 @@ import { type ReactNode, useEffect, useRef } from 'react'; import { SelectableListItemHotkeyEffect } from '@/ui/layout/selectable-list/components/SelectableListItemHotkeyEffect'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; @@ -25,7 +25,7 @@ export const SelectableListItem = ({ children, onEnter, }: SelectableListItemProps) => { - const isSelectedItemId = useRecoilComponentFamilyValueV2( + const isSelectedItemId = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, itemId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/__tests__/useSelectableList.test.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/__tests__/useSelectableList.test.ts index dce72fc242..bdd4ceb4d8 100644 --- a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/__tests__/useSelectableList.test.ts +++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/__tests__/useSelectableList.test.ts @@ -5,8 +5,8 @@ import { Provider } from 'jotai'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { selectableItemIdsComponentState } from '@/ui/layout/selectable-list/states/selectableItemIdsComponentState'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; const selectableListComponentInstanceId = 'testId'; const testArr = [['1'], ['2'], ['3']]; @@ -16,12 +16,12 @@ describe('useSelectableList', () => { it('Should setSelectableItemIds', async () => { const { result } = renderHook( () => { - const setSelectableItemIds = useSetRecoilComponentStateV2( + const setSelectableItemIds = useSetAtomComponentState( selectableItemIdsComponentState, selectableListComponentInstanceId, ); - const selectableItemIds = useRecoilComponentValueV2( + const selectableItemIds = useAtomComponentStateValue( selectableItemIdsComponentState, selectableListComponentInstanceId, ); @@ -52,11 +52,11 @@ describe('useSelectableList', () => { selectableListComponentInstanceId, ); - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, selectableListComponentInstanceId, ); - const setSelectedItemId = useSetRecoilComponentStateV2( + const setSelectedItemId = useSetAtomComponentState( selectedItemIdComponentState, selectableListComponentInstanceId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState.ts index ef0f7a41c4..a09186ad2a 100644 --- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState.ts @@ -1,8 +1,8 @@ import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const isSelectedItemIdComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'isSelectedItemIdComponentFamilyState', defaultValue: false, componentInstanceContext: SelectableListComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsComponentState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsComponentState.ts index e32610377a..e7944da030 100644 --- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsComponentState.ts @@ -1,7 +1,7 @@ import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const selectableItemIdsComponentState = createComponentStateV2< +export const selectableItemIdsComponentState = createAtomComponentState< string[][] >({ key: 'selectableItemIdsComponentState', diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdComponentState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdComponentState.ts index 4110ecf155..8fdced8c6b 100644 --- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdComponentState.ts @@ -1,7 +1,7 @@ import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const selectedItemIdComponentState = createComponentStateV2< +export const selectedItemIdComponentState = createAtomComponentState< string | null >({ key: 'selectedItemIdComponentState', diff --git a/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx b/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx index 32a4a41c77..6151cfe717 100644 --- a/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx +++ b/packages/twenty-front/src/modules/ui/layout/show-page/components/FieldRichTextCard.tsx @@ -7,7 +7,7 @@ import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { lazy, Suspense } from 'react'; import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { isDefined } from 'twenty-shared/utils'; const ActivityRichTextEditor = lazy(() => @@ -48,10 +48,13 @@ const LoadingSkeleton = () => { export const FieldRichTextCard = () => { const targetRecord = useTargetRecord(); - const activityBodyV2 = useFamilySelectorValueV2(recordStoreFamilySelectorV2, { - recordId: targetRecord.id, - fieldName: 'bodyV2', - }); + const activityBodyV2 = useAtomFamilySelectorValue( + recordStoreFamilySelectorV2, + { + recordId: targetRecord.id, + fieldName: 'bodyV2', + }, + ); const activityObjectNameSingular = targetRecord.targetObjectNameSingular as | CoreObjectNameSingular.Note diff --git a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx index c76d07b68c..6d59551818 100644 --- a/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx +++ b/packages/twenty-front/src/modules/ui/layout/show-page/components/ShowPageSummaryCard.tsx @@ -11,7 +11,7 @@ import { type AvatarType, type IconComponent, } from 'twenty-ui/display'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { v4 as uuidV4 } from 'uuid'; import { dateLocaleState } from '~/localization/states/dateLocaleState'; import { @@ -123,7 +123,7 @@ export const ShowPageSummaryCard = ({ loading, isMobile = false, }: ShowPageSummaryCardProps) => { - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const beautifiedCreatedAt = date !== '' ? beautifyPastDateRelativeToNow(date, localeCatalog) : ''; const exactCreatedAt = date !== '' ? beautifyExactDateTime(date) : ''; diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx index 01801e3d84..536354b52f 100644 --- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx +++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabList.tsx @@ -6,7 +6,7 @@ import { type TabListProps } from '@/ui/layout/tab-list/types/TabListProps'; import { NodeDimension } from '@/ui/utilities/dimensions/components/NodeDimension'; import { TabListHiddenMeasurements } from '@/ui/layout/tab-list/components/TabListHiddenMeasurements'; import { useTabListMeasurements } from '@/ui/layout/tab-list/hooks/useTabListMeasurements'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import styled from '@emotion/styled'; import { useCallback, useEffect, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; @@ -53,7 +53,7 @@ export const TabList = ({ const visibleTabs = tabs.filter((tab) => !tab.hide); const navigate = useNavigate(); - const [activeTabId, setActiveTabId] = useRecoilComponentStateV2( + const [activeTabId, setActiveTabId] = useAtomComponentState( activeTabIdComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx index bf8951c735..5f843789c2 100644 --- a/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx +++ b/packages/twenty-front/src/modules/ui/layout/tab-list/components/TabListFromUrlOptionalEffect.tsx @@ -1,6 +1,6 @@ import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useEffect } from 'react'; import { useLocation } from 'react-router-dom'; @@ -14,10 +14,8 @@ export const TabListFromUrlOptionalEffect = ({ isInRightDrawer, }: TabListFromUrlOptionalEffectProps) => { const location = useLocation(); - const activeTabId = useRecoilComponentValueV2(activeTabIdComponentState); - const setActiveTabId = useSetRecoilComponentStateV2( - activeTabIdComponentState, - ); + const activeTabId = useAtomComponentStateValue(activeTabIdComponentState); + const setActiveTabId = useSetAtomComponentState(activeTabIdComponentState); const hash = location.hash.replace('#', ''); diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/states/activeTabIdComponentState.ts b/packages/twenty-front/src/modules/ui/layout/tab-list/states/activeTabIdComponentState.ts index c486a93f57..9e872ed659 100644 --- a/packages/twenty-front/src/modules/ui/layout/tab-list/states/activeTabIdComponentState.ts +++ b/packages/twenty-front/src/modules/ui/layout/tab-list/states/activeTabIdComponentState.ts @@ -1,7 +1,9 @@ import { TabListComponentInstanceContext } from '@/ui/layout/tab-list/states/contexts/TabListComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; -export const activeTabIdComponentState = createComponentStateV2({ +export const activeTabIdComponentState = createAtomComponentState< + string | null +>({ key: 'activeTabIdComponentState', defaultValue: null, componentInstanceContext: TabListComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/layout/table/components/SortableTableHeader.tsx b/packages/twenty-front/src/modules/ui/layout/table/components/SortableTableHeader.tsx index ebb2a1b471..0b6fdc31c9 100644 --- a/packages/twenty-front/src/modules/ui/layout/table/components/SortableTableHeader.tsx +++ b/packages/twenty-front/src/modules/ui/layout/table/components/SortableTableHeader.tsx @@ -2,8 +2,8 @@ import { TableHeader } from '@/ui/layout/table/components/TableHeader'; import { TableHeaderText } from '@/ui/layout/table/components/TableHeaderText'; import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFieldByTableFamilyState'; import { type TableSortValue } from '@/ui/layout/table/types/TableSortValue'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { IconArrowDown, IconArrowUp, @@ -25,11 +25,13 @@ export const SortableTableHeader = ({ initialSort?: TableSortValue; Icon?: IconComponent; }) => { - const sortedFieldByTable = useFamilyRecoilValueV2( + const sortedFieldByTable = useAtomFamilyStateValue( sortedFieldByTableFamilyState, - { tableId }, + { + tableId, + }, ); - const setSortedFieldByTable = useSetFamilyRecoilStateV2( + const setSortedFieldByTable = useSetAtomFamilyState( sortedFieldByTableFamilyState, { tableId }, ); diff --git a/packages/twenty-front/src/modules/ui/layout/table/hooks/useSortedArray.ts b/packages/twenty-front/src/modules/ui/layout/table/hooks/useSortedArray.ts index 72623a23e6..a9ecdb214a 100644 --- a/packages/twenty-front/src/modules/ui/layout/table/hooks/useSortedArray.ts +++ b/packages/twenty-front/src/modules/ui/layout/table/hooks/useSortedArray.ts @@ -1,6 +1,6 @@ import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFieldByTableFamilyState'; import { type TableMetadata } from '@/ui/layout/table/types/TableMetadata'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { useMemo } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -8,9 +8,11 @@ export const useSortedArray = ( arrayToSort: T[], tableMetadata: TableMetadata, ): T[] => { - const sortedFieldByTable = useFamilyRecoilValueV2( + const sortedFieldByTable = useAtomFamilyStateValue( sortedFieldByTableFamilyState, - { tableId: tableMetadata.tableId }, + { + tableId: tableMetadata.tableId, + }, ); const initialSort = tableMetadata.initialSort; diff --git a/packages/twenty-front/src/modules/ui/layout/table/states/sortedFieldByTableFamilyState.ts b/packages/twenty-front/src/modules/ui/layout/table/states/sortedFieldByTableFamilyState.ts index 0c7df64e72..4c9a522bf6 100644 --- a/packages/twenty-front/src/modules/ui/layout/table/states/sortedFieldByTableFamilyState.ts +++ b/packages/twenty-front/src/modules/ui/layout/table/states/sortedFieldByTableFamilyState.ts @@ -1,11 +1,11 @@ import { type TableSortValue } from '@/ui/layout/table/types/TableSortValue'; -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; export type SortedFieldByTableFamilyStateKey = { tableId: string; }; -export const sortedFieldByTableFamilyState = createFamilyStateV2< +export const sortedFieldByTableFamilyState = createAtomFamilyState< TableSortValue | null, SortedFieldByTableFamilyStateKey >({ diff --git a/packages/twenty-front/src/modules/ui/navigation/components/NavigationDrawerWidthEffect.tsx b/packages/twenty-front/src/modules/ui/navigation/components/NavigationDrawerWidthEffect.tsx index 3d81da0a1c..d6ae29748f 100644 --- a/packages/twenty-front/src/modules/ui/navigation/components/NavigationDrawerWidthEffect.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/components/NavigationDrawerWidthEffect.tsx @@ -4,10 +4,10 @@ import { NAVIGATION_DRAWER_WIDTH_VAR, navigationDrawerWidthState, } from '@/ui/navigation/states/navigationDrawerWidthState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const NavigationDrawerWidthEffect = () => { - const navigationDrawerWidth = useRecoilValueV2(navigationDrawerWidthState); + const navigationDrawerWidth = useAtomStateValue(navigationDrawerWidthState); useEffect(() => { document.documentElement.style.setProperty( diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/MultiWorkspaceDropdownButton.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/MultiWorkspaceDropdownButton.tsx index a267d89348..099a573d54 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/MultiWorkspaceDropdownButton.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/MultiWorkspaceDropdownButton.tsx @@ -5,11 +5,11 @@ import { MultiWorkspaceDropdownThemesComponents } from '@/ui/navigation/navigati import { MultiWorkspaceDropdownWorkspacesListComponents } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownWorkspacesListComponents'; import { MULTI_WORKSPACE_DROPDOWN_ID } from '@/ui/navigation/navigation-drawer/constants/MultiWorkspaceDropdownId'; import { multiWorkspaceDropdownStateV2 } from '@/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useMemo } from 'react'; export const MultiWorkspaceDropdownButton = () => { - const [multiWorkspaceDropdown, setMultiWorkspaceDropdown] = useRecoilStateV2( + const [multiWorkspaceDropdown, setMultiWorkspaceDropdown] = useAtomState( multiWorkspaceDropdownStateV2, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx index 4b41f99e66..e5ecd8d4b4 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownClickableComponent.tsx @@ -6,16 +6,16 @@ import { StyledLabel, } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspacesDropdownStyles'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; import { Avatar } from 'twenty-ui/display'; export const MultiWorkspaceDropdownClickableComponent = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const theme = useTheme(); - const isNavigationDrawerExpanded = useRecoilValueV2( + const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, ); return ( diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx index 247bb98c46..f70bb6f9c8 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownDefaultComponents.tsx @@ -20,10 +20,10 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { MULTI_WORKSPACE_DROPDOWN_ID } from '@/ui/navigation/navigation-drawer/constants/MultiWorkspaceDropdownId'; import { multiWorkspaceDropdownStateV2 } from '@/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2'; import { useColorScheme } from '@/ui/theme/hooks/useColorScheme'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type ApolloError } from '@apollo/client'; import styled from '@emotion/styled'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isNonEmptyString } from '@sniptt/guards'; import { useLingui } from '@lingui/react/macro'; import { AppPath, SettingsPath } from 'twenty-shared/types'; @@ -56,11 +56,11 @@ const StyledDescription = styled.div` `; export const MultiWorkspaceDropdownDefaultComponents = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { t } = useLingui(); const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain(); - const availableWorkspaces = useRecoilValueV2(availableWorkspacesState); + const availableWorkspaces = useAtomStateValue(availableWorkspacesState); const availableWorkspacesCount = countAvailableWorkspaces(availableWorkspaces); const { buildWorkspaceUrl } = useBuildWorkspaceUrl(); @@ -68,14 +68,14 @@ export const MultiWorkspaceDropdownDefaultComponents = () => { const { signOut } = useAuth(); const { enqueueErrorSnackBar } = useSnackBar(); const { colorScheme, colorSchemeList } = useColorScheme(); - const supportChat = useRecoilValueV2(supportChatState); + const supportChat = useAtomStateValue(supportChatState); const isSupportChatConfigured = supportChat?.supportDriver === 'FRONT' && isNonEmptyString(supportChat.supportFrontChatId); const [signUpInNewWorkspaceMutation] = useSignUpInNewWorkspaceMutation(); - const setMultiWorkspaceDropdownState = useSetRecoilStateV2( + const setMultiWorkspaceDropdownState = useSetAtomState( multiWorkspaceDropdownStateV2, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownThemesComponents.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownThemesComponents.tsx index 1d29f87e41..312d0c54e2 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownThemesComponents.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownThemesComponents.tsx @@ -4,7 +4,7 @@ import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { multiWorkspaceDropdownStateV2 } from '@/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2'; import { useColorScheme } from '@/ui/theme/hooks/useColorScheme'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useLingui } from '@lingui/react/macro'; import { IconCheck, IconChevronLeft } from 'twenty-ui/display'; import { MenuItem } from 'twenty-ui/navigation'; @@ -14,7 +14,7 @@ export const MultiWorkspaceDropdownThemesComponents = () => { const { setColorScheme, colorScheme, colorSchemeList } = useColorScheme(); - const setMultiWorkspaceDropdownState = useSetRecoilStateV2( + const setMultiWorkspaceDropdownState = useSetAtomState( multiWorkspaceDropdownStateV2, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownWorkspacesListComponents.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownWorkspacesListComponents.tsx index b903c43de3..0fdd385a42 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownWorkspacesListComponents.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspaceDropdownWorkspacesListComponents.tsx @@ -5,8 +5,8 @@ import { DropdownMenuSearchInput } from '@/ui/layout/dropdown/components/Dropdow import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { multiWorkspaceDropdownStateV2 } from '@/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useState } from 'react'; import { IconChevronLeft } from 'twenty-ui/display'; @@ -17,9 +17,9 @@ import { availableWorkspacesState } from '@/auth/states/availableWorkspacesState export const MultiWorkspaceDropdownWorkspacesListComponents = () => { const { t } = useLingui(); - const availableWorkspaces = useRecoilValueV2(availableWorkspacesState); + const availableWorkspaces = useAtomStateValue(availableWorkspacesState); - const setMultiWorkspaceDropdownState = useSetRecoilStateV2( + const setMultiWorkspaceDropdownState = useSetAtomState( multiWorkspaceDropdownStateV2, ); const [searchValue, setSearchValue] = useState(''); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignIn.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignIn.tsx index 3ece498e6f..5bc830139e 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignIn.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignIn.tsx @@ -3,7 +3,7 @@ import { StyledDropdownMenuSubheader } from '@/ui/layout/dropdown/components/Sty import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useFilteredAvailableWorkspaces } from '@/ui/navigation/navigation-drawer/hooks/useFilteredAvailableWorkspaces'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { availableWorkspacesState } from '@/auth/states/availableWorkspacesState'; import { AvailableWorkspaceItem } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/AvailableWorkspaceItem'; @@ -14,8 +14,8 @@ export const WorkspacesForSignIn = ({ }) => { const { t } = useLingui(); - const availableWorkspaces = useRecoilValueV2(availableWorkspacesState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const availableWorkspaces = useAtomStateValue(availableWorkspacesState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { searchAvailableWorkspaces } = useFilteredAvailableWorkspaces(); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignUp.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignUp.tsx index d2a7bc4b58..4ea2fc4556 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignUp.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/WorkspacesForSignUp.tsx @@ -5,7 +5,7 @@ import { useFilteredAvailableWorkspaces } from '@/ui/navigation/navigation-drawe import { AvailableWorkspaceItem } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/components/AvailableWorkspaceItem'; import { availableWorkspacesState } from '@/auth/states/availableWorkspacesState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const WorkspacesForSignUp = ({ searchValue, @@ -14,8 +14,8 @@ export const WorkspacesForSignUp = ({ }) => { const { t } = useLingui(); - const availableWorkspaces = useRecoilValueV2(availableWorkspacesState); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const availableWorkspaces = useAtomStateValue(availableWorkspacesState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { searchAvailableWorkspaces } = useFilteredAvailableWorkspaces(); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx index a600e1e024..34f6c621df 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx @@ -3,8 +3,8 @@ import { type ReactNode, useState } from 'react'; import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer'; import { tableWidthResizeIsActiveState } from '@/object-record/record-table/states/tableWidthResizeIsActivedState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { ResizablePanelEdge } from '@/ui/layout/resizable-panel/components/ResizablePanelEdge'; import { NAVIGATION_DRAWER_COLLAPSED_WIDTH } from '@/ui/layout/resizable-panel/constants/NavigationDrawerCollapsedWidth'; import { NAVIGATION_DRAWER_CONSTRAINTS } from '@/ui/layout/resizable-panel/constants/NavigationDrawerConstraints'; @@ -78,11 +78,11 @@ export const NavigationDrawer = ({ const isSettingsDrawer = useIsSettingsDrawer(); const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] = - useRecoilStateV2(isNavigationDrawerExpandedState); - const [navigationDrawerWidth, setNavigationDrawerWidth] = useRecoilStateV2( + useAtomState(isNavigationDrawerExpandedState); + const [navigationDrawerWidth, setNavigationDrawerWidth] = useAtomState( navigationDrawerWidthState, ); - const setTableWidthResizeIsActive = useSetRecoilStateV2( + const setTableWidthResizeIsActive = useSetAtomState( tableWidthResizeIsActiveState, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx index 6f3137f43c..0828630aea 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx @@ -1,6 +1,6 @@ import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { @@ -20,7 +20,7 @@ export const NavigationDrawerAnimatedCollapseWrapper = ({ }) => { const theme = useTheme(); const isSettingsPage = useIsSettingsPage(); - const isNavigationDrawerExpanded = useRecoilValueV2( + const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx index 963992d26c..793dcc222e 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerBackButton.tsx @@ -4,8 +4,8 @@ import styled from '@emotion/styled'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; import { navigationDrawerExpandedMemorizedStateV2 } from '@/ui/navigation/states/navigationDrawerExpandedMemorizedStateV2'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useIsWorkspaceActivationStatusEqualsTo } from '@/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo'; import { WorkspaceActivationStatus } from 'twenty-shared/workspace'; import { IconX } from 'twenty-ui/display'; @@ -47,12 +47,12 @@ export const NavigationDrawerBackButton = ({ title, }: NavigationDrawerBackButtonProps) => { const theme = useTheme(); - const navigationMemorizedUrl = useRecoilValueV2(navigationMemorizedUrlState); + const navigationMemorizedUrl = useAtomStateValue(navigationMemorizedUrlState); - const setIsNavigationDrawerExpanded = useSetRecoilStateV2( + const setIsNavigationDrawerExpanded = useSetAtomState( isNavigationDrawerExpandedState, ); - const navigationDrawerExpandedMemorized = useRecoilValueV2( + const navigationDrawerExpandedMemorized = useAtomStateValue( navigationDrawerExpandedMemorizedStateV2, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx index 976b5168c0..2b134d34d8 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton.tsx @@ -1,5 +1,5 @@ import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import styled from '@emotion/styled'; import { IconLayoutSidebarLeftCollapse, @@ -26,7 +26,7 @@ export const NavigationDrawerCollapseButton = ({ className, direction = 'left', }: NavigationDrawerCollapseButtonProps) => { - const setIsNavigationDrawerExpanded = useSetRecoilStateV2( + const setIsNavigationDrawerExpanded = useSetAtomState( isNavigationDrawerExpandedState, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx index 9af4d64941..12f3ca1924 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx @@ -5,7 +5,7 @@ import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; import { PAGE_BAR_MIN_HEIGHT } from '@/ui/layout/page/constants/PageBarMinHeight'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { NavigationDrawerCollapseButton } from './NavigationDrawerCollapseButton'; const StyledContainer = styled.div` @@ -36,7 +36,7 @@ export const NavigationDrawerHeader = ({ }: NavigationDrawerHeaderProps) => { const isMobile = useIsMobile(); - const isNavigationDrawerExpanded = useRecoilValueV2( + const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx index c70a5de372..bfa2c20e91 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx @@ -6,7 +6,7 @@ import { useNavigationDrawerTooltip } from '@/ui/navigation/navigation-drawer/ho import { type NavigationDrawerSubItemState } from '@/ui/navigation/navigation-drawer/types/NavigationDrawerSubItemState'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import isPropValid from '@emotion/is-prop-valid'; import { css, useTheme } from '@emotion/react'; import styled from '@emotion/styled'; @@ -305,7 +305,7 @@ export const NavigationDrawerItem = ({ const isMobile = useIsMobile(); const isSettingsPage = useIsSettingsPage(); const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] = - useRecoilStateV2(isNavigationDrawerExpandedState); + useAtomState(isNavigationDrawerExpandedState); const { navigationItemId } = useNavigationDrawerTooltip(label, to); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx index ba987e9547..fffb551155 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx @@ -1,6 +1,6 @@ import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { @@ -23,7 +23,7 @@ export const NavigationDrawerItemsCollapsableContainer = ({ }: NavigationDrawerItemsCollapsableContainerProps) => { const theme = useTheme(); const isSettingsPage = useIsSettingsPage(); - const isNavigationDrawerExpanded = useRecoilValueV2( + const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, ); const isExpanded = isNavigationDrawerExpanded || isSettingsPage; diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx index fb3e810ffd..4880266cc2 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx @@ -4,7 +4,7 @@ import { useIsPrefetchLoading } from '@/prefetch/hooks/useIsPrefetchLoading'; import { NavigationDrawerSectionTitleSkeletonLoader } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitleSkeletonLoader'; import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded'; import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import React from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -60,11 +60,11 @@ export const NavigationDrawerSectionTitle = ({ alwaysShowRightIcon = false, }: NavigationDrawerSectionTitleProps) => { const isMobile = useIsMobile(); - const isNavigationDrawerExpanded = useRecoilValueV2( + const isNavigationDrawerExpanded = useAtomStateValue( isNavigationDrawerExpandedState, ); const isSettingsPage = useIsSettingsPage(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const loading = useIsPrefetchLoading(); const handleTitleClick = (e: React.MouseEvent) => { e.stopPropagation(); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx index 0ca1550f46..86089511dc 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx @@ -5,7 +5,7 @@ import { expect, within } from 'storybook/test'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { SettingsPath } from 'twenty-shared/types'; import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWithRouterDecorator'; import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator'; @@ -53,7 +53,7 @@ const meta: Meta = { ObjectMetadataItemsDecorator, PrefetchLoadedDecorator, (Story) => { - const setCurrentWorkspaceMember = useSetRecoilStateV2( + const setCurrentWorkspaceMember = useSetAtomState( currentWorkspaceMemberState, ); useEffect(() => { diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useFilteredAvailableWorkspaces.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useFilteredAvailableWorkspaces.ts index f6a990b858..60d0ea7617 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useFilteredAvailableWorkspaces.ts +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useFilteredAvailableWorkspaces.ts @@ -1,9 +1,9 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type AvailableWorkspace } from '~/generated-metadata/graphql'; export const useFilteredAvailableWorkspaces = () => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const searchAvailableWorkspaces = ( searchValue: string, diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useNavigationSection.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useNavigationSection.ts index 68d072c369..6471927850 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useNavigationSection.ts +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/hooks/useNavigationSection.ts @@ -2,11 +2,11 @@ import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isNavigationSectionOpenFamilyState } from '@/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; export const useNavigationSection = (navigationSectionId: string) => { const store = useStore(); - const isNavigationSectionOpen = useFamilyRecoilValueV2( + const isNavigationSectionOpen = useAtomFamilyStateValue( isNavigationSectionOpenFamilyState, navigationSectionId, ); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdStateV2.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdStateV2.ts index baa4386b0f..9a978666ad 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdStateV2.ts +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentFavoriteFolderIdStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentFavoriteFolderIdStateV2 = createStateV2({ +export const currentFavoriteFolderIdStateV2 = createAtomState({ key: 'currentFavoriteFolderIdStateV2', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2.ts index 675d62e63c..c02fcd545f 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2.ts +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/currentNavigationMenuItemFolderIdStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentNavigationMenuItemFolderIdStateV2 = createStateV2< +export const currentNavigationMenuItemFolderIdStateV2 = createAtomState< string | null >({ key: 'currentNavigationMenuItemFolderIdStateV2', diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState.ts index dbe1928ac5..315e8e9be4 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState.ts +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isAdvancedModeEnabledState = createStateV2({ +export const isAdvancedModeEnabledState = createAtomState({ key: 'isAdvancedModeEnabledAtom', defaultValue: false, useLocalStorage: true, diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState.ts index c8c7a647b6..7da618176c 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState.ts +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const isNavigationSectionOpenFamilyState = createFamilyStateV2< +export const isNavigationSectionOpenFamilyState = createAtomFamilyState< boolean, string >({ diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2.ts index 42f024370f..9c8476d5b7 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2.ts +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/states/multiWorkspaceDropdownStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const multiWorkspaceDropdownStateV2 = createStateV2< +export const multiWorkspaceDropdownStateV2 = createAtomState< 'default' | 'workspaces-list' | 'themes' >({ key: 'multiWorkspaceDropdownStateV2', diff --git a/packages/twenty-front/src/modules/ui/navigation/states/isNavigationDrawerExpanded.ts b/packages/twenty-front/src/modules/ui/navigation/states/isNavigationDrawerExpanded.ts index 93be66aa8f..c35b9031a6 100644 --- a/packages/twenty-front/src/modules/ui/navigation/states/isNavigationDrawerExpanded.ts +++ b/packages/twenty-front/src/modules/ui/navigation/states/isNavigationDrawerExpanded.ts @@ -1,9 +1,9 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { MOBILE_VIEWPORT } from 'twenty-ui/theme'; const isMobile = window.innerWidth <= MOBILE_VIEWPORT; -export const isNavigationDrawerExpandedState = createStateV2({ +export const isNavigationDrawerExpandedState = createAtomState({ key: 'isNavigationDrawerExpanded', defaultValue: !isMobile, useLocalStorage: true, diff --git a/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerExpandedMemorizedStateV2.ts b/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerExpandedMemorizedStateV2.ts index 423768192a..7293a509d4 100644 --- a/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerExpandedMemorizedStateV2.ts +++ b/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerExpandedMemorizedStateV2.ts @@ -1,10 +1,11 @@ import { MOBILE_VIEWPORT } from 'twenty-ui/theme'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; const isMobile = window.innerWidth <= MOBILE_VIEWPORT; -export const navigationDrawerExpandedMemorizedStateV2 = createStateV2({ - key: 'navigationDrawerExpandedMemorizedStateV2', - defaultValue: !isMobile, -}); +export const navigationDrawerExpandedMemorizedStateV2 = + createAtomState({ + key: 'navigationDrawerExpandedMemorizedStateV2', + defaultValue: !isMobile, + }); diff --git a/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerWidthState.ts b/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerWidthState.ts index d32d6500b2..52a0b0adf4 100644 --- a/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerWidthState.ts +++ b/packages/twenty-front/src/modules/ui/navigation/states/navigationDrawerWidthState.ts @@ -1,9 +1,9 @@ import { NAVIGATION_DRAWER_CONSTRAINTS } from '@/ui/layout/resizable-panel/constants/NavigationDrawerConstraints'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const NAVIGATION_DRAWER_WIDTH_VAR = '--navigation-drawer-width'; -export const navigationDrawerWidthState = createStateV2({ +export const navigationDrawerWidthState = createAtomState({ key: 'navigationDrawerWidth', defaultValue: NAVIGATION_DRAWER_CONSTRAINTS.default, useLocalStorage: true, diff --git a/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.ts b/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.ts index dd71c9aa62..dec3894e57 100644 --- a/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.ts +++ b/packages/twenty-front/src/modules/ui/navigation/states/navigationMemorizedUrlState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const navigationMemorizedUrlState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const navigationMemorizedUrlState = createAtomState({ key: 'navigationMemorizedUrlState', defaultValue: '/', }); diff --git a/packages/twenty-front/src/modules/ui/navigation/states/shouldNavigateBackToMemorizedUrlOnSaveState.ts b/packages/twenty-front/src/modules/ui/navigation/states/shouldNavigateBackToMemorizedUrlOnSaveState.ts index 583ab10552..7b0ea58feb 100644 --- a/packages/twenty-front/src/modules/ui/navigation/states/shouldNavigateBackToMemorizedUrlOnSaveState.ts +++ b/packages/twenty-front/src/modules/ui/navigation/states/shouldNavigateBackToMemorizedUrlOnSaveState.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const shouldNavigateBackToMemorizedUrlOnSaveState = - createStateV2({ + createAtomState({ key: 'shouldNavigateBackToMemorizedUrlOnSaveState', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/__tests__/useStepBar.test.tsx b/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/__tests__/useStepBar.test.tsx index 809b8fe4b5..9ea7919db4 100644 --- a/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/__tests__/useStepBar.test.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/__tests__/useStepBar.test.tsx @@ -1,6 +1,6 @@ import { act, renderHook } from '@testing-library/react'; import { Provider } from 'jotai'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { stepBarInternalState } from '@/ui/navigation/step-bar/states/stepBarInternalState'; import { useStepBar } from '@/ui/navigation/step-bar/hooks/useStepBar'; @@ -11,7 +11,7 @@ const renderHooks = (initialStep: number) => { const { nextStep, prevStep, reset, setStep } = useStepBar({ initialStep, }); - const stepBarInternal = useRecoilValueV2(stepBarInternalState); + const stepBarInternal = useAtomStateValue(stepBarInternalState); return { nextStep, diff --git a/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/useStepBar.ts b/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/useStepBar.ts index 3a82514a89..0c7f9993d6 100644 --- a/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/useStepBar.ts +++ b/packages/twenty-front/src/modules/ui/navigation/step-bar/hooks/useStepBar.ts @@ -1,7 +1,7 @@ import { useCallback, useEffect } from 'react'; import { stepBarInternalState } from '@/ui/navigation/step-bar/states/stepBarInternalState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; export type StepsOptions = { initialStep: number; @@ -9,7 +9,7 @@ export type StepsOptions = { export const useStepBar = ({ initialStep }: StepsOptions) => { const [stepBarInternal, setStepBarInternal] = - useRecoilStateV2(stepBarInternalState); + useAtomState(stepBarInternalState); const nextStep = () => { setStepBarInternal((prevState) => ({ diff --git a/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.ts b/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.ts index 92d70719be..eb4fe8052c 100644 --- a/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.ts +++ b/packages/twenty-front/src/modules/ui/navigation/step-bar/states/stepBarInternalState.ts @@ -1,9 +1,9 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export type StepsState = { activeStep: number; }; -export const stepBarInternalState = createStateV2({ +export const stepBarInternalState = createAtomState({ key: 'step-bar/internal-state', defaultValue: { activeStep: -1, diff --git a/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx b/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx index 5919a5c684..aae5d745bd 100644 --- a/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx +++ b/packages/twenty-front/src/modules/ui/theme/components/BaseThemeProvider.tsx @@ -3,7 +3,7 @@ import { createContext } from 'react'; import { useSystemColorScheme } from '@/ui/theme/hooks/useSystemColorScheme'; import { persistedColorSchemeState } from '@/ui/theme/states/persistedColorSchemeState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { type ColorScheme } from 'twenty-ui/input'; import { THEME_DARK, THEME_LIGHT, ThemeContextProvider } from 'twenty-ui/theme'; @@ -16,7 +16,7 @@ export const ThemeSchemeContext = createContext<(theme: ColorScheme) => void>( ); export const BaseThemeProvider = ({ children }: BaseThemeProviderProps) => { - const [persistedColorScheme, setPersistedColorScheme] = useRecoilStateV2( + const [persistedColorScheme, setPersistedColorScheme] = useAtomState( persistedColorSchemeState, ); const systemColorScheme = useSystemColorScheme(); diff --git a/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsx b/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsx index 69a4907273..97d91dccc8 100644 --- a/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsx +++ b/packages/twenty-front/src/modules/ui/theme/hooks/__tests__/useColorScheme.test.tsx @@ -4,7 +4,7 @@ import { RecoilRoot } from 'recoil'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { useColorScheme } from '@/ui/theme/hooks/useColorScheme'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { type WorkspaceMember } from '@/workspace-member/types/WorkspaceMember'; @@ -43,7 +43,7 @@ describe('useColorScheme', () => { () => { const colorScheme = useColorScheme(); - const setCurrentWorkspaceMember = useSetRecoilStateV2( + const setCurrentWorkspaceMember = useSetAtomState( currentWorkspaceMemberState, ); diff --git a/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.ts b/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.ts index aab5997d8a..206cf737d7 100644 --- a/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.ts +++ b/packages/twenty-front/src/modules/ui/theme/hooks/useColorScheme.ts @@ -1,10 +1,10 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useCallback } from 'react'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { persistedColorSchemeState } from '@/ui/theme/states/persistedColorSchemeState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type ColorScheme } from '@/workspace-member/types/WorkspaceMember'; import { type IconComponent, @@ -14,14 +14,12 @@ import { } from 'twenty-ui/display'; export const useColorScheme = () => { - const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilStateV2( + const [currentWorkspaceMember, setCurrentWorkspaceMember] = useAtomState( currentWorkspaceMemberState, ); const { updateOneRecord } = useUpdateOneRecord(); - const setPersistedColorScheme = useSetRecoilStateV2( - persistedColorSchemeState, - ); + const setPersistedColorScheme = useSetAtomState(persistedColorSchemeState); const colorScheme = currentWorkspaceMember?.colorScheme ?? 'System'; diff --git a/packages/twenty-front/src/modules/ui/theme/states/persistedColorSchemeState.ts b/packages/twenty-front/src/modules/ui/theme/states/persistedColorSchemeState.ts index 8c6152a542..010e7c87d1 100644 --- a/packages/twenty-front/src/modules/ui/theme/states/persistedColorSchemeState.ts +++ b/packages/twenty-front/src/modules/ui/theme/states/persistedColorSchemeState.ts @@ -1,7 +1,7 @@ import { type ColorScheme } from '@/workspace-member/types/WorkspaceMember'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const persistedColorSchemeState = createStateV2({ +export const persistedColorSchemeState = createAtomState({ key: 'persistedColorSchemeState', defaultValue: 'System', useLocalStorage: true, diff --git a/packages/twenty-front/src/modules/ui/utilities/drag-select/hooks/useDragSelect.ts b/packages/twenty-front/src/modules/ui/utilities/drag-select/hooks/useDragSelect.ts index 0b02f33583..2a53e03541 100644 --- a/packages/twenty-front/src/modules/ui/utilities/drag-select/hooks/useDragSelect.ts +++ b/packages/twenty-front/src/modules/ui/utilities/drag-select/hooks/useDragSelect.ts @@ -1,13 +1,13 @@ import { useCallback } from 'react'; import { isDragSelectionStartEnabledStateV2 } from '@/ui/utilities/drag-select/states/internal/isDragSelectionStartEnabledStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useStore } from 'jotai'; export const useDragSelect = () => { const store = useStore(); - const setIsDragSelectionStartEnabled = useSetRecoilStateV2( + const setIsDragSelectionStartEnabled = useSetAtomState( isDragSelectionStartEnabledStateV2, ); diff --git a/packages/twenty-front/src/modules/ui/utilities/drag-select/states/internal/isDragSelectionStartEnabledStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/drag-select/states/internal/isDragSelectionStartEnabledStateV2.ts index cca33ccd52..18ef458b30 100644 --- a/packages/twenty-front/src/modules/ui/utilities/drag-select/states/internal/isDragSelectionStartEnabledStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/drag-select/states/internal/isDragSelectionStartEnabledStateV2.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const isDragSelectionStartEnabledStateV2 = createStateV2({ +export const isDragSelectionStartEnabledStateV2 = createAtomState({ key: 'drag-select/isDragSelectionStartEnabledStateV2', defaultValue: true, }); diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx index 91a959fdf8..4a9a18e06a 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx +++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/usePushFocusItemToFocusStack.test.tsx @@ -2,7 +2,7 @@ import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePush import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { focusStackState } from '@/ui/utilities/focus/states/focusStackState'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { renderHook } from '@testing-library/react'; import { createStore, Provider as JotaiProvider } from 'jotai'; import { act } from 'react'; @@ -21,8 +21,8 @@ const renderHooks = () => { const { result } = renderHook( () => { const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); - const focusStack = useRecoilValueV2(focusStackState); - const currentFocusId = useRecoilValueV2(currentFocusIdSelector); + const focusStack = useAtomStateValue(focusStackState); + const currentFocusId = useAtomStateValue(currentFocusIdSelector); return { pushFocusItemToFocusStack, diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx index 99dbbc0803..1a49427f2d 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx +++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useRemoveFocusItemFromFocusStackById.test.tsx @@ -3,7 +3,7 @@ import { useRemoveFocusItemFromFocusStackById } from '@/ui/utilities/focus/hooks import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { focusStackState } from '@/ui/utilities/focus/states/focusStackState'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { jotaiStore, resetJotaiStore, @@ -22,8 +22,8 @@ const renderHooks = () => { const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); const { removeFocusItemFromFocusStackById } = useRemoveFocusItemFromFocusStackById(); - const focusStack = useRecoilValueV2(focusStackState); - const currentFocusId = useRecoilValueV2(currentFocusIdSelector); + const focusStack = useAtomStateValue(focusStackState); + const currentFocusId = useAtomStateValue(currentFocusIdSelector); return { pushFocusItemToFocusStack, diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx index f15e9d2727..f0db32be74 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx +++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStack.test.tsx @@ -3,7 +3,7 @@ import { useResetFocusStack } from '@/ui/utilities/focus/hooks/useResetFocusStac import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { focusStackState } from '@/ui/utilities/focus/states/focusStackState'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { jotaiStore, resetJotaiStore, @@ -21,8 +21,8 @@ const renderHooks = () => { () => { const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); const { resetFocusStack } = useResetFocusStack(); - const focusStack = useRecoilValueV2(focusStackState); - const currentFocusId = useRecoilValueV2(currentFocusIdSelector); + const focusStack = useAtomStateValue(focusStackState); + const currentFocusId = useAtomStateValue(currentFocusIdSelector); return { pushFocusItemToFocusStack, diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx index 856aabf31a..d041bb42ce 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx +++ b/packages/twenty-front/src/modules/ui/utilities/focus/hooks/__tests__/useResetFocusStackToFocusItem.test.tsx @@ -3,7 +3,7 @@ import { useResetFocusStackToFocusItem } from '@/ui/utilities/focus/hooks/useRes import { currentFocusIdSelector } from '@/ui/utilities/focus/states/currentFocusIdSelector'; import { focusStackState } from '@/ui/utilities/focus/states/focusStackState'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { jotaiStore, resetJotaiStore, @@ -21,8 +21,8 @@ const renderHooks = () => { () => { const { pushFocusItemToFocusStack } = usePushFocusItemToFocusStack(); const { resetFocusStackToFocusItem } = useResetFocusStackToFocusItem(); - const focusStack = useRecoilValueV2(focusStackState); - const currentFocusId = useRecoilValueV2(currentFocusIdSelector); + const focusStack = useAtomStateValue(focusStackState); + const currentFocusId = useAtomStateValue(currentFocusIdSelector); return { pushFocusItemToFocusStack, diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusIdSelector.ts b/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusIdSelector.ts index 45e61c4d8f..7695df6f78 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusIdSelector.ts +++ b/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusIdSelector.ts @@ -1,7 +1,7 @@ -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; import { focusStackState } from './focusStackState'; -export const currentFocusIdSelector = createSelectorV2({ +export const currentFocusIdSelector = createAtomSelector({ key: 'currentFocusIdSelector', get: ({ get }) => { const focusStack = get(focusStackState); diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusedItemSelector.ts b/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusedItemSelector.ts index 725a9c2858..6a4e38ce0f 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusedItemSelector.ts +++ b/packages/twenty-front/src/modules/ui/utilities/focus/states/currentFocusedItemSelector.ts @@ -1,8 +1,8 @@ import { type FocusStackItem } from '@/ui/utilities/focus/types/FocusStackItem'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; import { focusStackState } from './focusStackState'; -export const currentFocusedItemSelector = createSelectorV2< +export const currentFocusedItemSelector = createAtomSelector< FocusStackItem | undefined >({ key: 'currentFocusedItemSelector', diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/states/currentGlobalHotkeysConfigSelector.ts b/packages/twenty-front/src/modules/ui/utilities/focus/states/currentGlobalHotkeysConfigSelector.ts index 807f22e96e..4140b99628 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/states/currentGlobalHotkeysConfigSelector.ts +++ b/packages/twenty-front/src/modules/ui/utilities/focus/states/currentGlobalHotkeysConfigSelector.ts @@ -1,11 +1,11 @@ import { focusStackState } from '@/ui/utilities/focus/states/focusStackState'; import { DEFAULT_GLOBAL_HOTKEYS_CONFIG } from '@/ui/utilities/hotkey/constants/DefaultGlobalHotkeysConfig'; import { type GlobalHotkeysConfig } from '@/ui/utilities/hotkey/types/GlobalHotkeysConfig'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; import { isDefined } from 'twenty-shared/utils'; export const currentGlobalHotkeysConfigSelector = - createSelectorV2({ + createAtomSelector({ key: 'currentGlobalHotkeysConfigSelector', get: ({ get }) => { const focusStack = get(focusStackState); diff --git a/packages/twenty-front/src/modules/ui/utilities/focus/states/focusStackState.ts b/packages/twenty-front/src/modules/ui/utilities/focus/states/focusStackState.ts index 296a87d565..65d11e0f64 100644 --- a/packages/twenty-front/src/modules/ui/utilities/focus/states/focusStackState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/focus/states/focusStackState.ts @@ -1,7 +1,7 @@ import { type FocusStackItem } from '@/ui/utilities/focus/types/FocusStackItem'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const focusStackState = createStateV2({ +export const focusStackState = createAtomState({ key: 'focusStackState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts index 670d449451..5fde07f964 100644 --- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts +++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useGlobalHotkeysSequence.ts @@ -4,7 +4,7 @@ import { type Keys } from 'react-hotkeys-hook/dist/types'; import { pendingHotkeyState } from '@/ui/utilities/hotkey/states/internal/pendingHotkeysState'; import { useGlobalHotkeysCallback } from '@/ui/utilities/hotkey/hooks/useGlobalHotkeysCallback'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { isDefined } from 'twenty-shared/utils'; export const useGlobalHotkeysSequence = ( @@ -18,8 +18,7 @@ export const useGlobalHotkeysSequence = ( }, deps: any[] = [], ) => { - const [pendingHotkey, setPendingHotkey] = - useRecoilStateV2(pendingHotkeyState); + const [pendingHotkey, setPendingHotkey] = useAtomState(pendingHotkeyState); const callGlobalHotkeysCallback = useGlobalHotkeysCallback(); diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts index 6d1dc6cacc..beeec84ff0 100644 --- a/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts +++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement.ts @@ -1,6 +1,6 @@ import { useHotkeysOnFocusedElementCallback } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElementCallback'; import { pendingHotkeyState } from '@/ui/utilities/hotkey/states/internal/pendingHotkeysState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { useHotkeys } from 'react-hotkeys-hook'; import { type HotkeyCallback, @@ -24,8 +24,7 @@ export const useHotkeysOnFocusedElement = ({ dependencies?: unknown[]; options?: UseHotkeysOptionsWithoutBuggyOptions; }) => { - const [pendingHotkey, setPendingHotkey] = - useRecoilStateV2(pendingHotkeyState); + const [pendingHotkey, setPendingHotkey] = useAtomState(pendingHotkeyState); const callScopedHotkeyCallback = useHotkeysOnFocusedElementCallback(dependencies); diff --git a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.ts b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.ts index 550e290b3f..4b021ac851 100644 --- a/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/hotkey/states/internal/pendingHotkeysState.ts @@ -1,7 +1,7 @@ import { type Keys } from 'react-hotkeys-hook/dist/types'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const pendingHotkeyState = createStateV2({ +export const pendingHotkeyState = createAtomState({ key: 'pendingHotkeyState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.ts b/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.ts index c33da128c9..ed31566472 100644 --- a/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/loading-state/states/currentPageLocationState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const currentPageLocationState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const currentPageLocationState = createAtomState({ key: 'currentPageLocationState', defaultValue: '', }); diff --git a/packages/twenty-front/src/modules/ui/utilities/page-favicon/components/PageFavicon.tsx b/packages/twenty-front/src/modules/ui/utilities/page-favicon/components/PageFavicon.tsx index 54dcc5ff6b..c1cda12d16 100644 --- a/packages/twenty-front/src/modules/ui/utilities/page-favicon/components/PageFavicon.tsx +++ b/packages/twenty-front/src/modules/ui/utilities/page-favicon/components/PageFavicon.tsx @@ -1,12 +1,12 @@ import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState'; import { DEFAULT_WORKSPACE_LOGO } from '@/ui/navigation/navigation-drawer/constants/DefaultWorkspaceLogo'; import { Helmet } from 'react-helmet-async'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { getImageAbsoluteURI } from 'twenty-shared/utils'; import { REACT_APP_SERVER_BASE_URL } from '~/config'; export const PageFavicon = () => { - const workspacePublicData = useRecoilValueV2(workspacePublicDataState); + const workspacePublicData = useAtomStateValue(workspacePublicDataState); return ( { () => { return { useClickOutside: useClickOutsideListener(componentId), - isActivated: useRecoilComponentValueV2( + isActivated: useAtomComponentStateValue( clickOutsideListenerIsActivatedComponentState, componentId, ), diff --git a/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsActivatedComponentState.ts b/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsActivatedComponentState.ts index 935a1af492..b75cbc5d4a 100644 --- a/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsActivatedComponentState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsActivatedComponentState.ts @@ -1,8 +1,8 @@ import { ClickOutsideListenerComponentInstanceContext } from '@/ui/utilities/pointer-event/states/contexts/ClickOutsideListenerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const clickOutsideListenerIsActivatedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'clickOutsideListenerIsActivatedComponentState', defaultValue: true, componentInstanceContext: ClickOutsideListenerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsMouseDownInsideComponentState.ts b/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsMouseDownInsideComponentState.ts index 31288cadda..d83235b07d 100644 --- a/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsMouseDownInsideComponentState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerIsMouseDownInsideComponentState.ts @@ -1,8 +1,8 @@ import { ClickOutsideListenerComponentInstanceContext } from '@/ui/utilities/pointer-event/states/contexts/ClickOutsideListenerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const clickOutsideListenerIsMouseDownInsideComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'clickOutsideListenerIsMouseDownInsideComponentState', defaultValue: false, componentInstanceContext: ClickOutsideListenerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerMouseDownHappenedComponentState.ts b/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerMouseDownHappenedComponentState.ts index 6f48a9b887..c7a1cd93e0 100644 --- a/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerMouseDownHappenedComponentState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/pointer-event/states/clickOutsideListenerMouseDownHappenedComponentState.ts @@ -1,8 +1,8 @@ import { ClickOutsideListenerComponentInstanceContext } from '@/ui/utilities/pointer-event/states/contexts/ClickOutsideListenerComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const clickOutsideListenerMouseDownHappenedComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'clickOutsideListenerMouseDownHappenedComponentState', defaultValue: false, componentInstanceContext: ClickOutsideListenerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollWrapper.tsx b/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollWrapper.tsx index 99ce167046..3f14da2be8 100644 --- a/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollWrapper.tsx +++ b/packages/twenty-front/src/modules/ui/utilities/scroll/components/ScrollWrapper.tsx @@ -5,7 +5,7 @@ import { ScrollWrapperComponentInstanceContext } from '@/ui/utilities/scroll/sta import { scrollWrapperScrollBottomComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollBottomComponentState'; import { scrollWrapperScrollLeftComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollLeftComponentState'; import { scrollWrapperScrollTopComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; const StyledScrollWrapper = styled.div` &.scroll-wrapper-x-enabled { @@ -35,17 +35,17 @@ export const ScrollWrapper = ({ defaultEnableXScroll = true, defaultEnableYScroll = true, }: ScrollWrapperProps) => { - const setScrollTop = useSetRecoilComponentStateV2( + const setScrollTop = useSetAtomComponentState( scrollWrapperScrollTopComponentState, componentInstanceId, ); - const setScrollLeft = useSetRecoilComponentStateV2( + const setScrollLeft = useSetAtomComponentState( scrollWrapperScrollLeftComponentState, componentInstanceId, ); - const setScrollBottom = useSetRecoilComponentStateV2( + const setScrollBottom = useSetAtomComponentState( scrollWrapperScrollBottomComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/ui/utilities/scroll/hooks/useScrollRestoration.ts b/packages/twenty-front/src/modules/ui/utilities/scroll/hooks/useScrollRestoration.ts index 5c4bc06f1f..b47a02b1ae 100644 --- a/packages/twenty-front/src/modules/ui/utilities/scroll/hooks/useScrollRestoration.ts +++ b/packages/twenty-front/src/modules/ui/utilities/scroll/hooks/useScrollRestoration.ts @@ -1,6 +1,6 @@ import { SCROLL_RESTORATION_TOP_THRESHOLD_PX } from '@/ui/utilities/scroll/constants/ScrollRestorationTopThreshold'; import { scrollWrapperScrollTopComponentState } from '@/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCallback, useEffect, useState } from 'react'; import { useLocation } from 'react-router-dom'; import { isDefined } from 'twenty-shared/utils'; @@ -10,7 +10,7 @@ export const useScrollRestoration = (componentInstanceId: string) => { const storageKey = `scroll-${location.pathname}`; const [isRestoring, setIsRestoring] = useState(false); - const scrollTop = useRecoilComponentValueV2( + const scrollTop = useAtomComponentStateValue( scrollWrapperScrollTopComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollBottomComponentState.ts b/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollBottomComponentState.ts index 5fdf869ac0..7dd4fe6725 100644 --- a/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollBottomComponentState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollBottomComponentState.ts @@ -1,8 +1,8 @@ import { ScrollWrapperComponentInstanceContext } from '@/ui/utilities/scroll/states/contexts/ScrollWrapperComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const scrollWrapperScrollBottomComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'scrollWrapperScrollBottomComponentState', defaultValue: 0, componentInstanceContext: ScrollWrapperComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollLeftComponentState.ts b/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollLeftComponentState.ts index f41f87ab19..3063b854e8 100644 --- a/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollLeftComponentState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollLeftComponentState.ts @@ -1,8 +1,8 @@ import { ScrollWrapperComponentInstanceContext } from '@/ui/utilities/scroll/states/contexts/ScrollWrapperComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const scrollWrapperScrollLeftComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'scrollWrapperScrollLeftComponentState', defaultValue: 0, componentInstanceContext: ScrollWrapperComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState.ts b/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState.ts index 23edb731b9..10603f4d46 100644 --- a/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState.ts +++ b/packages/twenty-front/src/modules/ui/utilities/scroll/states/scrollWrapperScrollTopComponentState.ts @@ -1,8 +1,8 @@ import { ScrollWrapperComponentInstanceContext } from '@/ui/utilities/scroll/states/contexts/ScrollWrapperComponentInstanceContext'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; export const scrollWrapperScrollTopComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'scrollWrapperScrollTopComponentState', defaultValue: 0, componentInstanceContext: ScrollWrapperComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState.ts similarity index 95% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState.ts index c947f69ea3..5dddaf76a1 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorCallbackStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorCallbackState.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/types/ComponentFamilySelectorV2'; -export const useRecoilComponentFamilySelectorCallbackStateV2 = < +export const useAtomComponentFamilySelectorCallbackState = < StateType, FamilyKey, >( diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue.ts index f5aaf8c184..fd87314430 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilySelectorValueV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilySelectorValue.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentFamilySelectorV2 } from '@/ui/utilities/state/jotai/types/ComponentFamilySelectorV2'; -export const useRecoilComponentFamilySelectorValueV2 = ( +export const useAtomComponentFamilySelectorValue = ( componentFamilySelector: ComponentFamilySelectorV2, familyKey: FamilyKey, instanceIdFromProps?: string, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState.ts index b6816ebac0..4bcb7ba4f7 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/types/ComponentFamilyStateV2'; -export const useRecoilComponentFamilyStateV2 = ( +export const useAtomComponentFamilyState = ( componentState: ComponentFamilyStateV2, familyKey: FamilyKey, instanceIdFromProps?: string, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState.ts similarity index 92% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState.ts index 8a3899cf3c..da14126b08 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateCallbackStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateCallbackState.ts @@ -4,10 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/types/ComponentFamilyStateV2'; -export const useRecoilComponentFamilyStateCallbackStateV2 = < - StateType, - FamilyKey, ->( +export const useAtomComponentFamilyStateCallbackState = ( componentFamilyState: ComponentFamilyStateV2, instanceIdFromProps?: string, ): (( diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue.ts index 02635bdd5a..444ec6f5bf 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/types/ComponentFamilyStateV2'; -export const useRecoilComponentFamilyValueV2 = ( +export const useAtomComponentFamilyStateValue = ( componentState: ComponentFamilyStateV2, familyKey: FamilyKey, instanceIdFromProps?: string, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState.ts index 0c8315bc0e..7037f1e463 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorCallbackStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentSelectorCallbackState.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentSelectorV2 } from '@/ui/utilities/state/jotai/types/ComponentSelectorV2'; -export const useRecoilComponentSelectorCallbackStateV2 = ( +export const useAtomComponentSelectorCallbackState = ( componentSelector: ComponentSelectorV2, instanceIdFromProps?: string, ): ReturnType['selectorFamily']> => { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue.ts index cecdf258e3..ae7de6a972 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentSelectorV2 } from '@/ui/utilities/state/jotai/types/ComponentSelectorV2'; -export const useRecoilComponentSelectorValueV2 = ( +export const useAtomComponentSelectorValue = ( componentSelector: ComponentSelectorV2, instanceIdFromProps?: string, ): StateType => { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentState.ts similarity index 94% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentState.ts index 2ef21b8283..c437a346bd 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentState.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentStateV2 } from '@/ui/utilities/state/jotai/types/ComponentStateV2'; -export const useRecoilComponentStateV2 = ( +export const useAtomComponentState = ( componentState: ComponentStateV2, instanceIdFromProps?: string, ): [ diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState.ts index c6ba0d8842..5e29992eb2 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentStateV2 } from '@/ui/utilities/state/jotai/types/ComponentStateV2'; -export const useRecoilComponentStateCallbackStateV2 = ( +export const useAtomComponentStateCallbackState = ( componentState: ComponentStateV2, instanceIdFromProps?: string, ): ReturnType['atomFamily']> => { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentStateValue.ts similarity index 94% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentStateValue.ts index cc9b345949..804a730b4f 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomComponentStateValue.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentStateV2 } from '@/ui/utilities/state/jotai/types/ComponentStateV2'; -export const useRecoilComponentValueV2 = ( +export const useAtomComponentStateValue = ( componentState: ComponentStateV2, instanceIdFromProps?: string, ): StateType => { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState.ts similarity index 85% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState.ts index 69c8236158..b7f91a9f3e 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilySelectorStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilySelectorState.ts @@ -2,7 +2,7 @@ import { useAtom } from 'jotai'; import { type WritableFamilySelectorV2 } from '@/ui/utilities/state/jotai/types/WritableFamilySelectorV2'; -export const useFamilySelectorStateV2 = ( +export const useAtomFamilySelectorState = ( familySelector: WritableFamilySelectorV2, familyKey: FamilyKey, ): [ diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue.ts similarity index 87% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue.ts index 9013cc7dc4..6a781faa73 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue.ts @@ -3,7 +3,7 @@ import { useAtomValue } from 'jotai'; import { type FamilySelectorV2 } from '@/ui/utilities/state/jotai/types/FamilySelectorV2'; import { type WritableFamilySelectorV2 } from '@/ui/utilities/state/jotai/types/WritableFamilySelectorV2'; -export const useFamilySelectorValueV2 = ( +export const useAtomFamilySelectorValue = ( familySelector: | FamilySelectorV2 | WritableFamilySelectorV2, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue.ts similarity index 81% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue.ts index 2961e8800f..e3df51e649 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue.ts @@ -2,7 +2,7 @@ import { useAtomValue } from 'jotai'; import { type FamilyStateV2 } from '@/ui/utilities/state/jotai/types/FamilyStateV2'; -export const useFamilyRecoilValueV2 = ( +export const useAtomFamilyStateValue = ( familyState: FamilyStateV2, familyKey: FamilyKey, ): ValueType => { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomState.ts similarity index 89% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomState.ts index 0929d9f38f..4564eb29dc 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomState.ts @@ -3,7 +3,7 @@ import { useAtom } from 'jotai'; import { type StateV2 } from '@/ui/utilities/state/jotai/types/StateV2'; import { type WritableSelectorV2 } from '@/ui/utilities/state/jotai/types/WritableSelectorV2'; -export const useRecoilStateV2 = ( +export const useAtomState = ( state: StateV2 | WritableSelectorV2, ): [ ValueType, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomStateValue.ts similarity index 71% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilValueV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomStateValue.ts index 3e2589fc9f..822f7a7092 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useRecoilValueV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useAtomStateValue.ts @@ -1,14 +1,14 @@ -import { useAtomValue } from 'jotai'; +import { useAtomValue as useJotaiAtomValue } from 'jotai'; import { type SelectorV2 } from '@/ui/utilities/state/jotai/types/SelectorV2'; import { type StateV2 } from '@/ui/utilities/state/jotai/types/StateV2'; import { type WritableSelectorV2 } from '@/ui/utilities/state/jotai/types/WritableSelectorV2'; -export const useRecoilValueV2 = ( +export const useAtomStateValue = ( state: | StateV2 | SelectorV2 | WritableSelectorV2, ): ValueType => { - return useAtomValue(state.atom); + return useJotaiAtomValue(state.atom); }; diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilComponentFamilyStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilComponentFamilyStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState.ts index 62a53ddd4a..133bb7f758 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilComponentFamilyStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/types/ComponentFamilyStateV2'; -export const useSetRecoilComponentFamilyStateV2 = ( +export const useSetAtomComponentFamilyState = ( componentState: ComponentFamilyStateV2, familyKey: FamilyKey, instanceIdFromProps?: string, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomComponentState.ts similarity index 94% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomComponentState.ts index 48ee152c8d..bcd23d03c1 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomComponentState.ts @@ -4,7 +4,7 @@ import { useAvailableComponentInstanceIdOrThrow } from '@/ui/utilities/state/com import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap'; import { type ComponentStateV2 } from '@/ui/utilities/state/jotai/types/ComponentStateV2'; -export const useSetRecoilComponentStateV2 = ( +export const useSetAtomComponentState = ( componentState: ComponentStateV2, instanceIdFromProps?: string, ): ((value: ValueType | ((prev: ValueType) => ValueType)) => void) => { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomFamilyState.ts similarity index 83% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomFamilyState.ts index ab0ce630cc..d5679f222f 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomFamilyState.ts @@ -2,7 +2,7 @@ import { useSetAtom } from 'jotai'; import { type FamilyStateV2 } from '@/ui/utilities/state/jotai/types/FamilyStateV2'; -export const useSetFamilyRecoilStateV2 = ( +export const useSetAtomFamilyState = ( familyState: FamilyStateV2, familyKey: FamilyKey, ): ((value: ValueType | ((prev: ValueType) => ValueType)) => void) => { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomState.ts similarity index 83% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomState.ts index f15c1c2290..f19945fb73 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetRecoilStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/hooks/useSetAtomState.ts @@ -2,7 +2,7 @@ import { useSetAtom } from 'jotai'; import { type StateV2 } from '@/ui/utilities/state/jotai/types/StateV2'; -export const useSetRecoilStateV2 = ( +export const useSetAtomState = ( state: StateV2, ): ((value: ValueType | ((prev: ValueType) => ValueType)) => void) => { return useSetAtom(state.atom); diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector.ts similarity index 96% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector.ts index df9dcfbba1..ea635c2af1 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentFamilySelectorV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentFamilySelector.ts @@ -8,7 +8,7 @@ import { type SelectorGetterV2 } from '@/ui/utilities/state/jotai/types/Selector import { buildGetHelper } from '@/ui/utilities/state/jotai/utils/buildGetHelper'; import { isDefined } from 'twenty-shared/utils'; -export const createComponentFamilySelectorV2 = ({ +export const createAtomComponentFamilySelector = ({ key, get, componentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentFamilyStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentFamilyState.ts similarity index 95% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentFamilyStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentFamilyState.ts index e61a2abac8..66850c0a7e 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentFamilyStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentFamilyState.ts @@ -8,7 +8,7 @@ import { } from '@/ui/utilities/state/jotai/types/ComponentFamilyStateV2'; import { isDefined } from 'twenty-shared/utils'; -export const createComponentFamilyStateV2 = ({ +export const createAtomComponentFamilyState = ({ key, defaultValue, componentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentSelectorV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentSelector.ts similarity index 96% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentSelectorV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentSelector.ts index 669e76b9d0..30aac6698a 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentSelectorV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentSelector.ts @@ -8,7 +8,7 @@ import { type SelectorGetterV2 } from '@/ui/utilities/state/jotai/types/Selector import { buildGetHelper } from '@/ui/utilities/state/jotai/utils/buildGetHelper'; import { isDefined } from 'twenty-shared/utils'; -export const createComponentSelectorV2 = ({ +export const createAtomComponentSelector = ({ key, get, componentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentState.ts similarity index 96% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentState.ts index dbc2ef2cfe..7871d4b58e 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createComponentStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomComponentState.ts @@ -6,7 +6,7 @@ import { globalComponentInstanceContextMap } from '@/ui/utilities/state/componen import { type ComponentStateV2 } from '@/ui/utilities/state/jotai/types/ComponentStateV2'; import { isDefined } from 'twenty-shared/utils'; -export const createComponentStateV2 = ({ +export const createAtomComponentState = ({ key, defaultValue, componentInstanceContext, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createFamilySelectorV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomFamilySelector.ts similarity index 94% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createFamilySelectorV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomFamilySelector.ts index 87601a7d5c..a2ebb94a0b 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createFamilySelectorV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomFamilySelector.ts @@ -4,7 +4,7 @@ import { type FamilySelectorV2 } from '@/ui/utilities/state/jotai/types/FamilySe import { type SelectorGetterV2 } from '@/ui/utilities/state/jotai/types/SelectorCallbacksV2'; import { buildGetHelper } from '@/ui/utilities/state/jotai/utils/buildGetHelper'; -export const createFamilySelectorV2 = ({ +export const createAtomFamilySelector = ({ key, get, }: { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createFamilyStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomFamilyState.ts similarity index 95% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createFamilyStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomFamilyState.ts index 389c62c4f7..5b32820009 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createFamilyStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomFamilyState.ts @@ -3,7 +3,7 @@ import { atomWithStorage } from 'jotai/utils'; import { type FamilyStateV2 } from '@/ui/utilities/state/jotai/types/FamilyStateV2'; -export const createFamilyStateV2 = ({ +export const createAtomFamilyState = ({ key, defaultValue, useLocalStorage = false, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createSelectorV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomSelector.ts similarity index 93% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createSelectorV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomSelector.ts index ae4558051a..c4a7fe4d0c 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createSelectorV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomSelector.ts @@ -4,7 +4,7 @@ import { type SelectorGetterV2 } from '@/ui/utilities/state/jotai/types/Selector import { type SelectorV2 } from '@/ui/utilities/state/jotai/types/SelectorV2'; import { buildGetHelper } from '@/ui/utilities/state/jotai/utils/buildGetHelper'; -export const createSelectorV2 = ({ +export const createAtomSelector = ({ key, get, }: { diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomState.ts similarity index 97% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createStateV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomState.ts index 6a7d587544..f07fbaea06 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createStateV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomState.ts @@ -22,7 +22,7 @@ type StateAtom = WritableAtom< void >; -export const createStateV2 = ({ +export const createAtomState = ({ key, defaultValue, useLocalStorage = false, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createWritableFamilySelectorV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomWritableFamilySelector.ts similarity index 96% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createWritableFamilySelectorV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomWritableFamilySelector.ts index b4c46ee448..0fbbe97726 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createWritableFamilySelectorV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomWritableFamilySelector.ts @@ -8,7 +8,7 @@ import { type WritableFamilySelectorV2 } from '@/ui/utilities/state/jotai/types/ import { buildGetHelper } from '@/ui/utilities/state/jotai/utils/buildGetHelper'; import { buildSetHelper } from '@/ui/utilities/state/jotai/utils/buildSetHelper'; -export const createWritableFamilySelectorV2 = ({ +export const createAtomWritableFamilySelector = ({ key, get, set, diff --git a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createWritableSelectorV2.ts b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomWritableSelector.ts similarity index 96% rename from packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createWritableSelectorV2.ts rename to packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomWritableSelector.ts index c10ca3c0ec..b2fe5361d3 100644 --- a/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createWritableSelectorV2.ts +++ b/packages/twenty-front/src/modules/ui/utilities/state/jotai/utils/createAtomWritableSelector.ts @@ -8,7 +8,7 @@ import { type WritableSelectorV2 } from '@/ui/utilities/state/jotai/types/Writab import { buildGetHelper } from '@/ui/utilities/state/jotai/utils/buildGetHelper'; import { buildSetHelper } from '@/ui/utilities/state/jotai/utils/buildSetHelper'; -export const createWritableSelectorV2 = ({ +export const createAtomWritableSelector = ({ key, get, set, diff --git a/packages/twenty-front/src/modules/users/components/LazyMetadataLoadEffect.tsx b/packages/twenty-front/src/modules/users/components/LazyMetadataLoadEffect.tsx index cac6a85b7f..619e11b488 100644 --- a/packages/twenty-front/src/modules/users/components/LazyMetadataLoadEffect.tsx +++ b/packages/twenty-front/src/modules/users/components/LazyMetadataLoadEffect.tsx @@ -6,7 +6,7 @@ import { transformPageLayout } from '@/page-layout/utils/transformPageLayout'; import { logicFunctionsState } from '@/settings/logic-functions/states/logicFunctionsState'; import { coreViewsState } from '@/views/states/coreViewState'; import { type CoreViewWithRelations } from '@/views/types/CoreViewWithRelations'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useStore } from 'jotai'; import { useCallback, useEffect } from 'react'; import { useLocation } from 'react-router-dom'; @@ -28,7 +28,7 @@ export const LazyMetadataLoadEffect = () => { const isLoggedIn = useIsLogged(); const store = useStore(); - const setLogicFunctions = useSetRecoilStateV2(logicFunctionsState); + const setLogicFunctions = useSetAtomState(logicFunctionsState); const { updateDraft, applyChanges } = useMetadataStore(); const isOnAuthPath = diff --git a/packages/twenty-front/src/modules/users/hooks/useLoadCurrentUser.ts b/packages/twenty-front/src/modules/users/hooks/useLoadCurrentUser.ts index b45e60f60f..6613f93857 100644 --- a/packages/twenty-front/src/modules/users/hooks/useLoadCurrentUser.ts +++ b/packages/twenty-front/src/modules/users/hooks/useLoadCurrentUser.ts @@ -8,8 +8,8 @@ import { authProvidersState } from '@/client-config/states/authProvidersState'; import { useIsCurrentLocationOnAWorkspace } from '@/domain-manager/hooks/useIsCurrentLocationOnAWorkspace'; import { useLastAuthenticatedWorkspaceDomain } from '@/domain-manager/hooks/useLastAuthenticatedWorkspaceDomain'; import { useInitializeFormatPreferences } from '@/localization/hooks/useInitializeFormatPreferences'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { coreViewsState } from '@/views/states/coreViewState'; import { workspaceAuthBypassProvidersState } from '@/workspace/states/workspaceAuthBypassProvidersState'; import { useCallback } from 'react'; @@ -25,26 +25,24 @@ import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl'; import { dynamicActivate } from '~/utils/i18n/dynamicActivate'; export const useLoadCurrentUser = () => { - const setCurrentUser = useSetRecoilStateV2(currentUserState); - const setAvailableWorkspaces = useSetRecoilStateV2(availableWorkspacesState); - const setCurrentWorkspaceMember = useSetRecoilStateV2( + const setCurrentUser = useSetAtomState(currentUserState); + const setAvailableWorkspaces = useSetAtomState(availableWorkspacesState); + const setCurrentWorkspaceMember = useSetAtomState( currentWorkspaceMemberState, ); const { setLastAuthenticateWorkspaceDomain } = useLastAuthenticatedWorkspaceDomain(); - const setCurrentUserWorkspace = useSetRecoilStateV2( - currentUserWorkspaceState, - ); - const setCurrentWorkspaceMembers = useSetRecoilStateV2( + const setCurrentUserWorkspace = useSetAtomState(currentUserWorkspaceState); + const setCurrentWorkspaceMembers = useSetAtomState( currentWorkspaceMembersState, ); - const setCurrentWorkspace = useSetRecoilStateV2(currentWorkspaceState); + const setCurrentWorkspace = useSetAtomState(currentWorkspaceState); const { initializeFormatPreferences } = useInitializeFormatPreferences(); - const setCoreViews = useSetRecoilStateV2(coreViewsState); - const setWorkspaceAuthBypassProviders = useSetRecoilStateV2( + const setCoreViews = useSetAtomState(coreViewsState); + const setWorkspaceAuthBypassProviders = useSetAtomState( workspaceAuthBypassProvidersState, ); - const authProviders = useRecoilValueV2(authProvidersState); + const authProviders = useAtomStateValue(authProvidersState); const { isOnAWorkspace } = useIsCurrentLocationOnAWorkspace(); diff --git a/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterChip.tsx b/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterChip.tsx index 03a1bbfb94..df30dc5f7e 100644 --- a/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterChip.tsx +++ b/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterChip.tsx @@ -10,8 +10,8 @@ import { useRemoveRecordFilter } from '@/object-record/record-filter/hooks/useRe import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { getAllRecordFilterDescendantsOfRecordFilterGroup } from '@/object-record/record-filter/utils/getAllRecordFilterDescendantsOfRecordFilterGroup'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { SortOrFilterChip } from '@/views/components/SortOrFilterChip'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { plural } from '@lingui/core/macro'; @@ -22,11 +22,11 @@ import { IconFilter } from 'twenty-ui/display'; export const AdvancedFilterChip = () => { const { closeDropdown } = useCloseDropdown(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); @@ -40,7 +40,7 @@ export const AdvancedFilterChip = () => { const { removeRootRecordFilterGroupIfEmpty } = useRemoveRootRecordFilterGroupIfEmpty(); - const rootRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); diff --git a/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterDropdownButton.tsx b/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterDropdownButton.tsx index 4a388045be..fbfa3df0c6 100644 --- a/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterDropdownButton.tsx +++ b/packages/twenty-front/src/modules/views/advanced-filter-chip/components/AdvancedFilterDropdownButton.tsx @@ -3,13 +3,13 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { AdvancedFilterRootRecordFilterGroup } from '@/object-record/advanced-filter/components/AdvancedFilterRootRecordFilterGroup'; import { useSetAdvancedFilterDropdownStates } from '@/object-record/advanced-filter/hooks/useSetAdvancedFilterDropdownAllRowsStates'; import { rootLevelRecordFilterGroupComponentSelector } from '@/object-record/advanced-filter/states/rootLevelRecordFilterGroupComponentSelector'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { AdvancedFilterChip } from '@/views/advanced-filter-chip/components/AdvancedFilterChip'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { isDefined } from 'twenty-shared/utils'; export const AdvancedFilterDropdownButton = () => { - const rootLevelRecordFilterGroup = useRecoilComponentSelectorValueV2( + const rootLevelRecordFilterGroup = useAtomComponentSelectorValue( rootLevelRecordFilterGroupComponentSelector, ); diff --git a/packages/twenty-front/src/modules/views/components/AnyFieldSearchChip.tsx b/packages/twenty-front/src/modules/views/components/AnyFieldSearchChip.tsx index 3f749b089b..2b021131a0 100644 --- a/packages/twenty-front/src/modules/views/components/AnyFieldSearchChip.tsx +++ b/packages/twenty-front/src/modules/views/components/AnyFieldSearchChip.tsx @@ -1,6 +1,6 @@ import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { SortOrFilterChip } from '@/views/components/SortOrFilterChip'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { useLingui } from '@lingui/react/macro'; @@ -11,8 +11,9 @@ export const AnyFieldSearchChip = () => { const { closeDropdown } = useCloseDropdown(); - const [anyFieldFilterValue, setAnyFieldFilterValue] = - useRecoilComponentStateV2(anyFieldFilterValueComponentState); + const [anyFieldFilterValue, setAnyFieldFilterValue] = useAtomComponentState( + anyFieldFilterValueComponentState, + ); const handleRemoveClick = () => { closeDropdown(); diff --git a/packages/twenty-front/src/modules/views/components/QueryParamsFiltersEffect.tsx b/packages/twenty-front/src/modules/views/components/QueryParamsFiltersEffect.tsx index 25598a11d2..62b23b4c4e 100644 --- a/packages/twenty-front/src/modules/views/components/QueryParamsFiltersEffect.tsx +++ b/packages/twenty-front/src/modules/views/components/QueryParamsFiltersEffect.tsx @@ -6,7 +6,7 @@ import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObje import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useFiltersFromQueryParams } from '@/views/hooks/internal/useFiltersFromQueryParams'; import { useHasFiltersInQueryParams } from '@/views/hooks/internal/useHasFiltersInQueryParams'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; @@ -31,11 +31,11 @@ export const QueryParamsFiltersEffect = () => { const { mapViewFiltersToRecordFilters } = useMapViewFiltersToFilters(); const { recordIndexId } = useRecordIndexContextOrThrow(); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, recordIndexId, ); - const setCurrentRecordFilterGroups = useSetRecoilComponentStateV2( + const setCurrentRecordFilterGroups = useSetAtomComponentState( currentRecordFilterGroupsComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/views/components/SoftDeleteFilterChip.tsx b/packages/twenty-front/src/modules/views/components/SoftDeleteFilterChip.tsx index e35a42427a..d0e2cbba3c 100644 --- a/packages/twenty-front/src/modules/views/components/SoftDeleteFilterChip.tsx +++ b/packages/twenty-front/src/modules/views/components/SoftDeleteFilterChip.tsx @@ -1,7 +1,7 @@ import { useRemoveRecordFilter } from '@/object-record/record-filter/hooks/useRemoveRecordFilter'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { isSoftDeleteFilterActiveComponentState } from '@/object-record/record-table/states/isSoftDeleteFilterActiveComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { SortOrFilterChip } from '@/views/components/SortOrFilterChip'; import { useIcons } from 'twenty-ui/display'; @@ -14,7 +14,7 @@ export const SoftDeleteFilterChip = ({ recordFilter, viewBarId, }: SoftDeleteFilterChipProps) => { - const setIsSoftDeleteFilterActive = useSetRecoilComponentStateV2( + const setIsSoftDeleteFilterActive = useSetAtomComponentState( isSoftDeleteFilterActiveComponentState, viewBarId, ); diff --git a/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx b/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx index 54809e9ac8..f5b8d6b98d 100644 --- a/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx +++ b/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx @@ -7,8 +7,8 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { UPDATE_VIEW_BUTTON_DROPDOWN_ID } from '@/views/constants/UpdateViewButtonDropdownId'; import { useHasFiltersInQueryParams } from '@/views/hooks/internal/useHasFiltersInQueryParams'; import { useAreViewFilterGroupsDifferentFromRecordFilterGroups } from '@/views/hooks/useAreViewFilterGroupsDifferentFromRecordFilterGroups'; @@ -45,7 +45,7 @@ export const UpdateViewButtonGroup = () => { const { setViewPickerMode } = useViewPickerMode(); - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); @@ -53,7 +53,7 @@ export const UpdateViewButtonGroup = () => { const { openDropdown: openViewPickerDropdown } = useOpenDropdown(); const { currentView } = useGetCurrentViewOnly(); - const setViewPickerReferenceViewId = useSetRecoilComponentStateV2( + const setViewPickerReferenceViewId = useSetAtomComponentState( viewPickerReferenceViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarAnyFieldFilterEffect.tsx b/packages/twenty-front/src/modules/views/components/ViewBarAnyFieldFilterEffect.tsx index 546f99dc85..b65b900e9e 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarAnyFieldFilterEffect.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarAnyFieldFilterEffect.tsx @@ -1,36 +1,38 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { hasInitializedAnyFieldFilterComponentFamilyState } from '@/views/states/hasInitializedAnyFieldFilterComponentFamilyState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const ViewBarAnyFieldFilterEffect = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); const { objectMetadataItem, recordIndexId } = useRecordIndexContextOrThrow(); - const currentView = useFamilySelectorValueV2( + const currentView = useAtomFamilySelectorValue( coreViewFromViewIdFamilySelector, - { viewId: currentViewId ?? '' }, + { + viewId: currentViewId ?? '', + }, ); const [hasInitializedAnyFieldFilter, setHasInitializedAnyFieldFilter] = - useRecoilComponentFamilyStateV2( + useAtomComponentFamilyState( hasInitializedAnyFieldFilterComponentFamilyState, { viewId: currentViewId ?? undefined, }, ); - const setAnyFieldFilterValue = useSetRecoilComponentStateV2( + const setAnyFieldFilterValue = useSetAtomComponentState( anyFieldFilterValueComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarDetails.tsx b/packages/twenty-front/src/modules/views/components/ViewBarDetails.tsx index b515adc348..e684dc236a 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarDetails.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarDetails.tsx @@ -4,7 +4,7 @@ import { type ReactNode, useMemo } from 'react'; import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural'; import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; import { useHandleToggleTrashColumnFilter } from '@/object-record/record-index/hooks/useHandleToggleTrashColumnFilter'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { AdvancedFilterDropdownButton } from '@/views/advanced-filter-chip/components/AdvancedFilterDropdownButton'; import { ViewBarDetailsAddFilterButton } from '@/views/components/ViewBarDetailsAddFilterButton'; import { EditableSortChip } from '@/views/editable-chip/components/EditableSortChip'; @@ -106,28 +106,28 @@ export const ViewBarDetails = ({ viewBarId, objectNamePlural, }: ViewBarDetailsProps) => { - const isViewBarExpanded = useRecoilComponentValueV2( + const isViewBarExpanded = useAtomComponentStateValue( isViewBarExpandedComponentState, ); const { hasFiltersQueryParams } = useHasFiltersInQueryParams(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, viewBarId, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, viewBarId, ); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, viewBarId, ); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, viewBarId, ); @@ -189,7 +189,7 @@ export const ViewBarDetails = ({ const shouldShowAdvancedFilterDropdownButton = currentRecordFilterGroups.length > 0; - const isAnyFieldSearchDropdownOpen = useRecoilComponentValueV2( + const isAnyFieldSearchDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ANY_FIELD_SEARCH_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterButton.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterButton.tsx index a56c031994..c130cd8ad7 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterButton.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterButton.tsx @@ -1,11 +1,11 @@ import { StyledHeaderDropdownButton } from '@/ui/layout/dropdown/components/StyledHeaderDropdownButton'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { Trans } from '@lingui/react/macro'; export const ViewBarFilterButton = () => { - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, ViewBarFilterDropdownIds.MAIN, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdown.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdown.tsx index 20d9a1c7c6..9b02e787b5 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdown.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdown.tsx @@ -5,7 +5,7 @@ import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdow import { objectFilterDropdownCurrentRecordFilterComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownCurrentRecordFilterComponentState'; import { useRemoveRecordFilter } from '@/object-record/record-filter/hooks/useRemoveRecordFilter'; import { isRecordFilterConsideredEmpty } from '@/object-record/record-filter/utils/isRecordFilterConsideredEmpty'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewBarFilterDropdownContent } from '@/views/components/ViewBarFilterDropdownContent'; import { isDefined } from 'twenty-shared/utils'; import { ViewBarFilterButton } from './ViewBarFilterButton'; @@ -14,7 +14,7 @@ export const ViewBarFilterDropdown = () => { const { resetFilterDropdown } = useResetFilterDropdown(); const { removeRecordFilter } = useRemoveRecordFilter(); - const objectFilterDropdownCurrentRecordFilter = useRecoilComponentValueV2( + const objectFilterDropdownCurrentRecordFilter = useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx index 7d7a5290b2..223191aaaa 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx @@ -5,15 +5,15 @@ import { currentRecordFilterGroupsComponentState } from '@/object-record/record- import { useUpsertRecordFilter } from '@/object-record/record-filter/hooks/useUpsertRecordFilter'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { VIEW_BAR_FILTER_BOTTOM_MENU_ITEM_IDS } from '@/views/constants/ViewBarFilterBottomMenuItemIds'; import { useSetRecordFilterUsedInAdvancedFilterDropdownRow } from '@/object-record/advanced-filter/hooks/useSetRecordFilterUsedInAdvancedFilterDropdownRow'; import { useCreateEmptyRecordFilterFromFieldMetadataItem } from '@/object-record/record-filter/hooks/useCreateEmptyRecordFilterFromFieldMetadataItem'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import styled from '@emotion/styled'; @@ -35,7 +35,7 @@ export const ViewBarFilterDropdownAdvancedFilterButton = () => { const { t } = useLingui(); - const isSelected = useRecoilComponentFamilyValueV2( + const isSelected = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, VIEW_BAR_FILTER_BOTTOM_MENU_ITEM_IDS.ADVANCED_FILTER, ); @@ -60,14 +60,14 @@ export const ViewBarFilterDropdownAdvancedFilterButton = () => { objectId: objectMetadataId ?? null, }); - const availableFieldMetadataItemsForFilter = useFamilySelectorValueV2( + const availableFieldMetadataItemsForFilter = useAtomFamilySelectorValue( availableFieldMetadataItemsForFilterFamilySelector, { objectMetadataItemId: objectMetadataItem.id, }, ); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAnyFieldSearchButtonMenuItem.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAnyFieldSearchButtonMenuItem.tsx index 5ed5926be0..9041094f82 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAnyFieldSearchButtonMenuItem.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAnyFieldSearchButtonMenuItem.tsx @@ -1,7 +1,7 @@ import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { IconSearch } from 'twenty-ui/display'; @@ -25,11 +25,11 @@ export const ViewBarFilterDropdownAnyFieldSearchButtonMenuItem = ({ }: ViewBarFilterDropdownAnyFieldSearchButtonMenuItemProps) => { const { t } = useLingui(); - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); - const isSelected = useRecoilComponentFamilyValueV2( + const isSelected = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, VIEW_BAR_FILTER_BOTTOM_MENU_ITEM_IDS.SEARCH, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownContent.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownContent.tsx index 7b83c244df..8efe5be666 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownContent.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownContent.tsx @@ -1,20 +1,20 @@ import { objectFilterDropdownAnyFieldSearchIsSelectedComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownAnyFieldSearchIsSelectedComponentState'; import { objectFilterDropdownFilterIsSelectedComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownFilterIsSelectedComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewBarFilterDropdownAnyFieldSearchInput } from '@/views/components/ViewBarFilterDropdownAnyFieldSearchInput'; import { ViewBarFilterDropdownFieldSelectMenu } from '@/views/components/ViewBarFilterDropdownFieldSelectMenu'; import { ViewBarFilterDropdownFilterInput } from '@/views/components/ViewBarFilterDropdownFilterInput'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; export const ViewBarFilterDropdownContent = () => { - const [objectFilterDropdownFilterIsSelected] = useRecoilComponentStateV2( + const [objectFilterDropdownFilterIsSelected] = useAtomComponentState( objectFilterDropdownFilterIsSelectedComponentState, ViewBarFilterDropdownIds.MAIN, ); const objectFilterDropdownAnyFieldSearchIsSelected = - useRecoilComponentValueV2( + useAtomComponentStateValue( objectFilterDropdownAnyFieldSearchIsSelectedComponentState, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx index 63476d8879..f1f8f20ca6 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenu.tsx @@ -10,7 +10,7 @@ import { FILTER_FIELD_LIST_ID } from '@/object-record/object-filter-dropdown/con import { useFilterDropdownSelectableFieldMetadataItems } from '@/object-record/object-filter-dropdown/hooks/useFilterDropdownSelectableFieldMetadataItems'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuSectionLabel } from '@/ui/layout/dropdown/components/DropdownMenuSectionLabel'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { ViewBarFilterDropdownBottomMenu } from '@/views/components/ViewBarFilterDropdownBottomMenu'; import { ViewBarFilterDropdownFieldSelectMenuItem } from '@/views/components/ViewBarFilterDropdownFieldSelectMenuItem'; @@ -53,7 +53,7 @@ export const StyledInput = styled.input` export const ViewBarFilterDropdownFieldSelectMenu = () => { const [objectFilterDropdownSearchInput, setObjectFilterDropdownSearchInput] = - useRecoilComponentStateV2(objectFilterDropdownSearchInputComponentState); + useAtomComponentState(objectFilterDropdownSearchInputComponentState); const { selectableHiddenFieldMetadataItems, diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenuItem.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenuItem.tsx index 34ea269709..3c04a5bced 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenuItem.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFieldSelectMenuItem.tsx @@ -3,7 +3,7 @@ import { FILTER_FIELD_LIST_ID } from '@/object-record/object-filter-dropdown/con import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList'; import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState'; -import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyValueV2'; +import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue'; import { useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown } from '@/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown'; import { useIcons } from 'twenty-ui/display'; import { MenuItem } from 'twenty-ui/navigation'; @@ -17,7 +17,7 @@ export const ViewBarFilterDropdownFieldSelectMenuItem = ({ }: ViewBarFilterDropdownFieldSelectMenuItemProps) => { const { resetSelectedItem } = useSelectableList(FILTER_FIELD_LIST_ID); - const isSelectedItem = useRecoilComponentFamilyValueV2( + const isSelectedItem = useAtomComponentFamilyStateValue( isSelectedItemIdComponentFamilyState, fieldMetadataItemToSelect.id, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFilterInputMenuHeader.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFilterInputMenuHeader.tsx index 65b5a71cfc..729171334c 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFilterInputMenuHeader.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownFilterInputMenuHeader.tsx @@ -2,11 +2,11 @@ import { useResetFilterDropdown } from '@/object-record/object-filter-dropdown/h import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-record/object-filter-dropdown/states/fieldMetadataItemUsedInDropdownComponentSelector'; import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader'; import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { IconChevronLeft } from 'twenty-ui/display'; export const ViewBarFilterDropdownFilterInputMenuHeader = () => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarRecordFieldEffect.tsx b/packages/twenty-front/src/modules/views/components/ViewBarRecordFieldEffect.tsx index fddd0844c1..3f39a590b7 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarRecordFieldEffect.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarRecordFieldEffect.tsx @@ -1,10 +1,10 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { hasInitializedCurrentRecordFieldsComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFieldsComponentFamilyState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { mapViewFieldToRecordField } from '@/views/utils/mapViewFieldToRecordField'; @@ -12,28 +12,30 @@ import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const ViewBarRecordFieldEffect = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); const { objectMetadataItem } = useRecordIndexContextOrThrow(); - const currentView = useFamilySelectorValueV2( + const currentView = useAtomFamilySelectorValue( coreViewFromViewIdFamilySelector, - { viewId: currentViewId ?? '' }, + { + viewId: currentViewId ?? '', + }, ); const [ hasInitializedCurrentRecordFields, setHasInitializedCurrentRecordFields, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentRecordFieldsComponentFamilyState, { viewId: currentViewId ?? undefined, }, ); - const setCurrentRecordFields = useSetRecoilComponentStateV2( + const setCurrentRecordFields = useSetAtomComponentState( currentRecordFieldsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterEffect.tsx b/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterEffect.tsx index 0ff89fcdd1..bd9ff224a3 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterEffect.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterEffect.tsx @@ -1,10 +1,10 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useMapViewFiltersToFilters } from '@/views/hooks/useMapViewFiltersToFilters'; import { hasInitializedCurrentRecordFiltersComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; @@ -12,28 +12,30 @@ import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const ViewBarRecordFilterEffect = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); const { objectMetadataItem, recordIndexId } = useRecordIndexContextOrThrow(); - const currentView = useFamilySelectorValueV2( + const currentView = useAtomFamilySelectorValue( coreViewFromViewIdFamilySelector, - { viewId: currentViewId ?? '' }, + { + viewId: currentViewId ?? '', + }, ); const [ hasInitializedCurrentRecordFilters, setHasInitializedCurrentRecordFilters, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentRecordFiltersComponentFamilyState, { viewId: currentViewId ?? undefined, }, ); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterGroupEffect.tsx b/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterGroupEffect.tsx index 58f5f4bbd3..c6a3e4ba73 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterGroupEffect.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarRecordFilterGroupEffect.tsx @@ -1,10 +1,10 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { hasInitializedCurrentRecordFilterGroupsComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFilterGroupsComponentFamilyState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { mapViewFilterGroupsToRecordFilterGroups } from '@/views/utils/mapViewFilterGroupsToRecordFilterGroups'; @@ -12,28 +12,30 @@ import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const ViewBarRecordFilterGroupEffect = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); const { objectMetadataItem, recordIndexId } = useRecordIndexContextOrThrow(); - const currentView = useFamilySelectorValueV2( + const currentView = useAtomFamilySelectorValue( coreViewFromViewIdFamilySelector, - { viewId: currentViewId ?? '' }, + { + viewId: currentViewId ?? '', + }, ); const [ hasInitializedCurrentRecordFilterGroups, setHasInitializedCurrentRecordFilterGroups, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentRecordFilterGroupsComponentFamilyState, { viewId: currentViewId ?? undefined, }, ); - const setCurrentRecordFilterGroups = useSetRecoilComponentStateV2( + const setCurrentRecordFilterGroups = useSetAtomComponentState( currentRecordFilterGroupsComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewBarRecordSortEffect.tsx b/packages/twenty-front/src/modules/views/components/ViewBarRecordSortEffect.tsx index 2c93e284fc..522891cced 100644 --- a/packages/twenty-front/src/modules/views/components/ViewBarRecordSortEffect.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewBarRecordSortEffect.tsx @@ -1,38 +1,40 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { hasInitializedCurrentRecordSortsComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordSortsComponentFamilyState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const ViewBarRecordSortEffect = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); const { objectMetadataItem, recordIndexId } = useRecordIndexContextOrThrow(); - const currentView = useFamilySelectorValueV2( + const currentView = useAtomFamilySelectorValue( coreViewFromViewIdFamilySelector, - { viewId: currentViewId ?? '' }, + { + viewId: currentViewId ?? '', + }, ); const [ hasInitializedCurrentRecordSorts, setHasInitializedCurrentRecordSorts, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentRecordSortsComponentFamilyState, { viewId: currentViewId ?? undefined, }, ); - const setCurrentRecordSorts = useSetRecoilComponentStateV2( + const setCurrentRecordSorts = useSetAtomComponentState( currentRecordSortsComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewFieldsHiddenDropdownSection.tsx b/packages/twenty-front/src/modules/views/components/ViewFieldsHiddenDropdownSection.tsx index 71c301d370..b06c15502e 100644 --- a/packages/twenty-front/src/modules/views/components/ViewFieldsHiddenDropdownSection.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewFieldsHiddenDropdownSection.tsx @@ -4,7 +4,7 @@ import { ObjectOptionsDropdownContext } from '@/object-record/object-options-dro import { useChangeRecordFieldVisibility } from '@/object-record/record-field/hooks/useChangeRecordFieldVisibility'; import { currentRecordFieldsComponentState } from '@/object-record/record-field/states/currentRecordFieldsComponentState'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewType } from '@/views/types/ViewType'; import { useContext } from 'react'; import { IconEye, useIcons } from 'twenty-ui/display'; @@ -29,7 +29,7 @@ export const ViewFieldsHiddenDropdownSection = () => { ? handleBoardFieldVisibilityChange : changeRecordFieldVisibility; - const currentRecordFields = useRecoilComponentValueV2( + const currentRecordFields = useAtomComponentStateValue( currentRecordFieldsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/components/ViewFieldsVisibleDropdownSection.tsx b/packages/twenty-front/src/modules/views/components/ViewFieldsVisibleDropdownSection.tsx index 059a6a7817..3f7bd65c61 100644 --- a/packages/twenty-front/src/modules/views/components/ViewFieldsVisibleDropdownSection.tsx +++ b/packages/twenty-front/src/modules/views/components/ViewFieldsVisibleDropdownSection.tsx @@ -11,8 +11,8 @@ import { DraggableItem } from '@/ui/layout/draggable-list/components/DraggableIt import { DraggableList } from '@/ui/layout/draggable-list/components/DraggableList'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { dropdownYPositionComponentState } from '@/ui/layout/dropdown/states/internal/dropdownYPositionComponentState'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewType } from '@/views/types/ViewType'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -60,7 +60,7 @@ export const ViewFieldsVisibleDropdownSection = () => { const fieldMetadataItemLabelIdentifier = getLabelIdentifierFieldMetadataItem(objectMetadataItem); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); @@ -78,7 +78,7 @@ export const ViewFieldsVisibleDropdownSection = () => { ) .toSorted(sortByProperty('position')); - const dropdownYPosition = useRecoilComponentValueV2( + const dropdownYPosition = useAtomComponentStateValue( dropdownYPositionComponentState, ); diff --git a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx index 5f8eb65e1e..5d71658b3c 100644 --- a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx +++ b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx @@ -7,7 +7,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext'; import { RecordIndexContextProvider } from '@/object-record/record-index/contexts/RecordIndexContext'; import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { ViewBarFilterDropdown } from '@/views/components/ViewBarFilterDropdown'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; @@ -17,7 +17,7 @@ import { currentRecordFieldsComponentState } from '@/object-record/record-field/ import { type RecordField } from '@/object-record/record-field/types/RecordField'; import { useRecordIndexFieldMetadataDerivedStates } from '@/object-record/record-index/hooks/useRecordIndexFieldMetadataDerivedStates'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { coreViewsState } from '@/views/states/coreViewState'; import { userEvent, within } from 'storybook/test'; import { ComponentDecorator } from 'twenty-ui/testing'; @@ -38,16 +38,16 @@ const meta: Meta = { )!; const instanceId = companyObjectMetadataItem.id; - const setCurrentRecordFields = useSetRecoilComponentStateV2( + const setCurrentRecordFields = useSetAtomComponentState( currentRecordFieldsComponentState, instanceId, ); - const setCoreViews = useSetRecoilStateV2(coreViewsState); + const setCoreViews = useSetAtomState(coreViewsState); const mockCoreView = mockedCoreViewsData[0]; - const setCurrentViewId = useSetRecoilComponentStateV2( + const setCurrentViewId = useSetAtomComponentState( contextStoreCurrentViewIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/views/editable-chip/components/EditableFilterChipDropdownMenuHeader.tsx b/packages/twenty-front/src/modules/views/editable-chip/components/EditableFilterChipDropdownMenuHeader.tsx index 05763d03e3..b644cbb47f 100644 --- a/packages/twenty-front/src/modules/views/editable-chip/components/EditableFilterChipDropdownMenuHeader.tsx +++ b/packages/twenty-front/src/modules/views/editable-chip/components/EditableFilterChipDropdownMenuHeader.tsx @@ -2,11 +2,11 @@ import { fieldMetadataItemUsedInDropdownComponentSelector } from '@/object-recor import { DropdownMenuHeader } from '@/ui/layout/dropdown/components/DropdownMenuHeader/DropdownMenuHeader'; import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components/DropdownMenuHeader/internal/DropdownMenuHeaderLeftComponent'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { IconX } from 'twenty-ui/display'; export const EditableFilterChipDropdownMenuHeader = () => { - const fieldMetadataItemUsedInDropdown = useRecoilComponentSelectorValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( fieldMetadataItemUsedInDropdownComponentSelector, ); diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx index 10621025f4..a48f734d8b 100644 --- a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx +++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx @@ -3,7 +3,7 @@ import { renderHook } from '@testing-library/react'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore, resetJotaiStore, @@ -86,7 +86,7 @@ describe('useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups', () => { const { applyCurrentViewFilterGroupsToCurrentRecordFilterGroups } = useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, 'recordIndexId', ); @@ -137,7 +137,7 @@ describe('useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups', () => { const { applyCurrentViewFilterGroupsToCurrentRecordFilterGroups } = useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, 'recordIndexId', ); @@ -182,7 +182,7 @@ describe('useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups', () => { const { applyCurrentViewFilterGroupsToCurrentRecordFilterGroups } = useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, 'recordIndexId', ); diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx index 2574a8866f..04a0005d76 100644 --- a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx +++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx @@ -3,7 +3,7 @@ import { renderHook } from '@testing-library/react'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { jotaiStore, resetJotaiStore, @@ -97,7 +97,7 @@ describe('useApplyCurrentViewFiltersToCurrentRecordFilters', () => { const { applyCurrentViewFiltersToCurrentRecordFilters } = useApplyCurrentViewFiltersToCurrentRecordFilters(); - const currentFilters = useRecoilComponentValueV2( + const currentFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'recordIndexId', ); @@ -146,7 +146,7 @@ describe('useApplyCurrentViewFiltersToCurrentRecordFilters', () => { const { applyCurrentViewFiltersToCurrentRecordFilters } = useApplyCurrentViewFiltersToCurrentRecordFilters(); - const currentFilters = useRecoilComponentValueV2( + const currentFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'recordIndexId', ); @@ -189,7 +189,7 @@ describe('useApplyCurrentViewFiltersToCurrentRecordFilters', () => { const { applyCurrentViewFiltersToCurrentRecordFilters } = useApplyCurrentViewFiltersToCurrentRecordFilters(); - const currentFilters = useRecoilComponentValueV2( + const currentFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'recordIndexId', ); diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewSortsToCurrentRecordSorts.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewSortsToCurrentRecordSorts.test.tsx index 37caaf282f..0d8bd61eda 100644 --- a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewSortsToCurrentRecordSorts.test.tsx +++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewSortsToCurrentRecordSorts.test.tsx @@ -2,7 +2,7 @@ import { act, renderHook } from '@testing-library/react'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; @@ -84,7 +84,7 @@ describe('useApplyCurrentViewSortsToCurrentRecordSorts', () => { const { applyCurrentViewSortsToCurrentRecordSorts } = useApplyCurrentViewSortsToCurrentRecordSorts(); - const currentSorts = useRecoilComponentValueV2( + const currentSorts = useAtomComponentStateValue( currentRecordSortsComponentState, 'recordIndexId', ); @@ -126,7 +126,7 @@ describe('useApplyCurrentViewSortsToCurrentRecordSorts', () => { const { applyCurrentViewSortsToCurrentRecordSorts } = useApplyCurrentViewSortsToCurrentRecordSorts(); - const currentSorts = useRecoilComponentValueV2( + const currentSorts = useAtomComponentStateValue( currentRecordSortsComponentState, 'recordIndexId', ); @@ -174,7 +174,7 @@ describe('useApplyCurrentViewSortsToCurrentRecordSorts', () => { const { applyCurrentViewSortsToCurrentRecordSorts } = useApplyCurrentViewSortsToCurrentRecordSorts(); - const currentSorts = useRecoilComponentValueV2( + const currentSorts = useAtomComponentStateValue( currentRecordSortsComponentState, 'recordIndexId', ); diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewFiltersToCurrentRecordFilters.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewFiltersToCurrentRecordFilters.test.tsx index e804a3b40d..8991c04ba5 100644 --- a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewFiltersToCurrentRecordFilters.test.tsx +++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewFiltersToCurrentRecordFilters.test.tsx @@ -2,7 +2,7 @@ import { act, renderHook } from '@testing-library/react'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type ViewFilter } from '@/views/types/ViewFilter'; import { ViewFilterOperand } from 'twenty-shared/types'; import { getFilterTypeFromFieldType, isDefined } from 'twenty-shared/utils'; @@ -42,7 +42,7 @@ describe('useApplyViewFiltersToCurrentRecordFilters', () => { const { applyViewFiltersToCurrentRecordFilters } = useApplyViewFiltersToCurrentRecordFilters(); - const currentFilters = useRecoilComponentValueV2( + const currentFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); @@ -83,7 +83,7 @@ describe('useApplyViewFiltersToCurrentRecordFilters', () => { const { applyViewFiltersToCurrentRecordFilters } = useApplyViewFiltersToCurrentRecordFilters(); - const currentFilters = useRecoilComponentValueV2( + const currentFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewSortsToCurrentRecordSorts.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewSortsToCurrentRecordSorts.test.tsx index 5c7d78507d..ebcc60fa43 100644 --- a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewSortsToCurrentRecordSorts.test.tsx +++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyViewSortsToCurrentRecordSorts.test.tsx @@ -1,7 +1,7 @@ import { act, renderHook } from '@testing-library/react'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; @@ -45,7 +45,7 @@ describe('useApplyViewSortsToCurrentRecordSorts', () => { const { applyViewSortsToCurrentRecordSorts } = useApplyViewSortsToCurrentRecordSorts(); - const currentSorts = useRecoilComponentValueV2( + const currentSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); @@ -80,7 +80,7 @@ describe('useApplyViewSortsToCurrentRecordSorts', () => { const { applyViewSortsToCurrentRecordSorts } = useApplyViewSortsToCurrentRecordSorts(); - const currentSorts = useRecoilComponentValueV2( + const currentSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.tsx index e39ebf6dfd..2ae3b3ff0f 100644 --- a/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.tsx +++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.test.tsx @@ -20,9 +20,9 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filte import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; import { getRecordFilterOperands } from '@/object-record/record-filter/utils/getRecordFilterOperands'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { getFilterTypeFromFieldType } from 'twenty-shared/utils'; import { getMockPersonObjectMetadataItem } from '~/testing/mock-data/people'; @@ -80,14 +80,13 @@ describe('useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown', () = const { initializeFilterOnFieldMetataItemFromViewBarFilterDropdown } = useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown(); - const fieldMetadataItemUsedInDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); - const objectFilterDropdownFilterIsSelected = useRecoilComponentValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); + const objectFilterDropdownFilterIsSelected = useAtomComponentStateValue( objectFilterDropdownFilterIsSelectedComponentState, ); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); @@ -133,14 +132,13 @@ describe('useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown', () = const { initializeFilterOnFieldMetataItemFromViewBarFilterDropdown } = useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown(); - const fieldMetadataItemUsedInDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); - const objectFilterDropdownFilterIsSelected = useRecoilComponentValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); + const objectFilterDropdownFilterIsSelected = useAtomComponentStateValue( objectFilterDropdownFilterIsSelectedComponentState, ); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); @@ -195,28 +193,27 @@ describe('useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown', () = const { initializeFilterOnFieldMetataItemFromViewBarFilterDropdown } = useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown(); - const fieldMetadataItemUsedInDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); - const objectFilterDropdownFilterIsSelected = useRecoilComponentValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); + const objectFilterDropdownFilterIsSelected = useAtomComponentStateValue( objectFilterDropdownFilterIsSelectedComponentState, ); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); const objectFilterDropdownCurrentRecordFilter = - useRecoilComponentValueV2( + useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, 'test', ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'test', ); @@ -279,28 +276,27 @@ describe('useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown', () = const { initializeFilterOnFieldMetataItemFromViewBarFilterDropdown } = useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown(); - const fieldMetadataItemUsedInDropdown = - useRecoilComponentSelectorValueV2( - fieldMetadataItemUsedInDropdownComponentSelector, - ); - const objectFilterDropdownFilterIsSelected = useRecoilComponentValueV2( + const fieldMetadataItemUsedInDropdown = useAtomComponentSelectorValue( + fieldMetadataItemUsedInDropdownComponentSelector, + ); + const objectFilterDropdownFilterIsSelected = useAtomComponentStateValue( objectFilterDropdownFilterIsSelectedComponentState, ); - const selectedOperandInDropdown = useRecoilComponentValueV2( + const selectedOperandInDropdown = useAtomComponentStateValue( selectedOperandInDropdownComponentState, ); const objectFilterDropdownCurrentRecordFilter = - useRecoilComponentValueV2( + useAtomComponentStateValue( objectFilterDropdownCurrentRecordFilterComponentState, ); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, 'test', ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, 'test', ); diff --git a/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts b/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts index 570d2e13c6..c55b392658 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts @@ -5,7 +5,7 @@ import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/ import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetViewGroupsFilters } from '@/views/hooks/useGetViewGroupsFilters'; import { computeRecordGqlOperationFilter, @@ -15,11 +15,11 @@ import { export const useGetRecordIndexTotalCount = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); @@ -34,7 +34,7 @@ export const useGetRecordIndexTotalCount = () => { fields: objectMetadataItem.fields, }); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewAPIUpdate.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewAPIUpdate.ts index e2218d9191..978b40c5f7 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewAPIUpdate.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePerformViewAPIUpdate.ts @@ -6,7 +6,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { coreViewsState } from '@/views/states/coreViewState'; import { ApolloError } from '@apollo/client'; import { t } from '@lingui/core/macro'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { CrudOperationType } from 'twenty-shared/types'; import { upsertPropertiesOfItemIntoArrayOfObjectsComparingId } from 'twenty-shared/utils'; import { @@ -21,7 +21,7 @@ export const usePerformViewAPIUpdate = () => { const { handleMetadataError } = useMetadataErrorHandler(); const { enqueueErrorSnackBar } = useSnackBar(); - const setCoreViews = useSetRecoilStateV2(coreViewsState); + const setCoreViews = useSetAtomState(coreViewsState); const performViewAPIUpdate = useCallback( async ( diff --git a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewAnyFieldFilterToAnyFieldFilter.ts b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewAnyFieldFilterToAnyFieldFilter.ts index 872113ee0d..c78733517d 100644 --- a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewAnyFieldFilterToAnyFieldFilter.ts +++ b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewAnyFieldFilterToAnyFieldFilter.ts @@ -1,18 +1,18 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { useStore } from 'jotai'; import { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useApplyCurrentViewAnyFieldFilterToAnyFieldFilter = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); - const setAnyFieldFilterValue = useSetRecoilComponentStateV2( + const setAnyFieldFilterValue = useSetAtomComponentState( anyFieldFilterValueComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.ts b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.ts index dae077e4b3..a8a9f5bddc 100644 --- a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.ts +++ b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.ts @@ -1,8 +1,8 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { mapViewFilterGroupsToRecordFilterGroups } from '@/views/utils/mapViewFilterGroupsToRecordFilterGroups'; import { useStore } from 'jotai'; @@ -12,15 +12,15 @@ import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; export const useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); - const setCurrentRecordFilterGroups = useSetRecoilComponentStateV2( + const setCurrentRecordFilterGroups = useSetAtomComponentState( currentRecordFilterGroupsComponentState, ); - const currentRecordFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentRecordFilterGroups = useAtomComponentStateCallbackState( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFiltersToCurrentRecordFilters.ts b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFiltersToCurrentRecordFilters.ts index e49dc2e70c..6ac6746ee7 100644 --- a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFiltersToCurrentRecordFilters.ts +++ b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewFiltersToCurrentRecordFilters.ts @@ -1,7 +1,7 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { useStore } from 'jotai'; import { useCallback } from 'react'; @@ -9,11 +9,11 @@ import { isDefined } from 'twenty-shared/utils'; import { useMapViewFiltersToFilters } from './useMapViewFiltersToFilters'; export const useApplyCurrentViewFiltersToCurrentRecordFilters = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewSortsToCurrentRecordSorts.ts b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewSortsToCurrentRecordSorts.ts index dccb231eb7..06da42f9ea 100644 --- a/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewSortsToCurrentRecordSorts.ts +++ b/packages/twenty-front/src/modules/views/hooks/useApplyCurrentViewSortsToCurrentRecordSorts.ts @@ -1,22 +1,24 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { isDefined } from 'twenty-shared/utils'; export const useApplyCurrentViewSortsToCurrentRecordSorts = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); - const currentView = useFamilySelectorValueV2( + const currentView = useAtomFamilySelectorValue( coreViewFromViewIdFamilySelector, - { viewId: currentViewId ?? '' }, + { + viewId: currentViewId ?? '', + }, ); - const setCurrentRecordSorts = useSetRecoilComponentStateV2( + const setCurrentRecordSorts = useSetAtomComponentState( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useApplyViewFiltersToCurrentRecordFilters.ts b/packages/twenty-front/src/modules/views/hooks/useApplyViewFiltersToCurrentRecordFilters.ts index ef77243be4..b57fe366d9 100644 --- a/packages/twenty-front/src/modules/views/hooks/useApplyViewFiltersToCurrentRecordFilters.ts +++ b/packages/twenty-front/src/modules/views/hooks/useApplyViewFiltersToCurrentRecordFilters.ts @@ -1,10 +1,10 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { type ViewFilter } from '@/views/types/ViewFilter'; import { useMapViewFiltersToFilters } from './useMapViewFiltersToFilters'; export const useApplyViewFiltersToCurrentRecordFilters = () => { - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useApplyViewSortsToCurrentRecordSorts.ts b/packages/twenty-front/src/modules/views/hooks/useApplyViewSortsToCurrentRecordSorts.ts index 56f7597fb0..3d2e93f21a 100644 --- a/packages/twenty-front/src/modules/views/hooks/useApplyViewSortsToCurrentRecordSorts.ts +++ b/packages/twenty-front/src/modules/views/hooks/useApplyViewSortsToCurrentRecordSorts.ts @@ -1,9 +1,9 @@ import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { type CoreViewSortEssential } from '@/views/types/CoreViewSortEssential'; export const useApplyViewSortsToCurrentRecordSorts = () => { - const setCurrentRecordSorts = useSetRecoilComponentStateV2( + const setCurrentRecordSorts = useSetAtomComponentState( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useAreViewFilterGroupsDifferentFromRecordFilterGroups.ts b/packages/twenty-front/src/modules/views/hooks/useAreViewFilterGroupsDifferentFromRecordFilterGroups.ts index 01813a2b97..32ebc568fa 100644 --- a/packages/twenty-front/src/modules/views/hooks/useAreViewFilterGroupsDifferentFromRecordFilterGroups.ts +++ b/packages/twenty-front/src/modules/views/hooks/useAreViewFilterGroupsDifferentFromRecordFilterGroups.ts @@ -1,5 +1,5 @@ import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { getViewFilterGroupsToCreate } from '@/views/utils/getViewFilterGroupsToCreate'; import { getViewFilterGroupsToDelete } from '@/views/utils/getViewFilterGroupsToDelete'; @@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils'; export const useAreViewFilterGroupsDifferentFromRecordFilterGroups = () => { const { currentView } = useGetCurrentViewOnly(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useAreViewFiltersDifferentFromRecordFilters.ts b/packages/twenty-front/src/modules/views/hooks/useAreViewFiltersDifferentFromRecordFilters.ts index a90d6cdee9..40c87adbf7 100644 --- a/packages/twenty-front/src/modules/views/hooks/useAreViewFiltersDifferentFromRecordFilters.ts +++ b/packages/twenty-front/src/modules/views/hooks/useAreViewFiltersDifferentFromRecordFilters.ts @@ -1,5 +1,5 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { getViewFiltersToCreate } from '@/views/utils/getViewFiltersToCreate'; import { getViewFiltersToDelete } from '@/views/utils/getViewFiltersToDelete'; @@ -9,7 +9,7 @@ import { useMemo } from 'react'; export const useAreViewFiltersDifferentFromRecordFilters = () => { const { currentView } = useGetCurrentViewOnly(); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useAreViewSortsDifferentFromRecordSorts.ts b/packages/twenty-front/src/modules/views/hooks/useAreViewSortsDifferentFromRecordSorts.ts index 4ceaf92150..2b019d97dc 100644 --- a/packages/twenty-front/src/modules/views/hooks/useAreViewSortsDifferentFromRecordSorts.ts +++ b/packages/twenty-front/src/modules/views/hooks/useAreViewSortsDifferentFromRecordSorts.ts @@ -1,5 +1,5 @@ import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { getViewSortsToCreate } from '@/views/utils/getViewSortsToCreate'; import { getViewSortsToDelete } from '@/views/utils/getViewSortsToDelete'; @@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils'; export const useAreViewSortsDifferentFromRecordSorts = () => { const { currentView } = useGetCurrentViewOnly(); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useComputeRecordRelationFilterLabelValue.tsx b/packages/twenty-front/src/modules/views/hooks/useComputeRecordRelationFilterLabelValue.tsx index 7117a632c5..eee38bff62 100644 --- a/packages/twenty-front/src/modules/views/hooks/useComputeRecordRelationFilterLabelValue.tsx +++ b/packages/twenty-front/src/modules/views/hooks/useComputeRecordRelationFilterLabelValue.tsx @@ -13,7 +13,7 @@ import { jsonRelationFilterValueSchema, } from 'twenty-shared/utils'; import { allowRequestsToTwentyIconsState } from '@/client-config/states/allowRequestsToTwentyIcons'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; type ObjectFilterDropdownRecordSelectProps = { recordFilter: RecordFilter; @@ -23,7 +23,7 @@ type ObjectFilterDropdownRecordSelectProps = { export const useComputeRecordRelationFilterLabelValue = ({ recordFilter, }: ObjectFilterDropdownRecordSelectProps) => { - const allowRequestsToTwentyIcons = useRecoilValueV2( + const allowRequestsToTwentyIcons = useAtomStateValue( allowRequestsToTwentyIconsState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts b/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts index bbb18113a1..5964910bf1 100644 --- a/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts +++ b/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts @@ -4,8 +4,8 @@ import { anyFieldFilterValueComponentState } from '@/object-record/record-filter import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { usePerformViewAPIPersist } from '@/views/hooks/internal/usePerformViewAPIPersist'; import { usePerformViewFieldAPIPersist } from '@/views/hooks/internal/usePerformViewFieldAPIPersist'; import { usePerformViewFilterAPIPersist } from '@/views/hooks/internal/usePerformViewFilterAPIPersist'; @@ -33,12 +33,12 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => { const { objectMetadataItem, recordIndexId } = useRecordIndexContextOrThrow(); - const currentViewId = useRecoilComponentStateCallbackStateV2( + const currentViewId = useAtomComponentStateCallbackState( contextStoreCurrentViewIdComponentState, viewBarComponentId, ); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, recordIndexId, ); @@ -57,17 +57,17 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => { const { refreshCoreViewsByObjectMetadataId } = useRefreshCoreViewsByObjectMetadataId(); - const currentRecordFilterGroups = useRecoilComponentValueV2( + const currentRecordFilterGroups = useAtomComponentStateValue( currentRecordFilterGroupsComponentState, recordIndexId, ); - const currentRecordSorts = useRecoilComponentValueV2( + const currentRecordSorts = useAtomComponentStateValue( currentRecordSortsComponentState, recordIndexId, ); - const currentRecordFilters = useRecoilComponentValueV2( + const currentRecordFilters = useAtomComponentStateValue( currentRecordFiltersComponentState, recordIndexId, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useGetCurrentViewOnly.ts b/packages/twenty-front/src/modules/views/hooks/useGetCurrentViewOnly.ts index f0f62120f8..f69faa2765 100644 --- a/packages/twenty-front/src/modules/views/hooks/useGetCurrentViewOnly.ts +++ b/packages/twenty-front/src/modules/views/hooks/useGetCurrentViewOnly.ts @@ -1,16 +1,18 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; export const useGetCurrentViewOnly = () => { - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); - const currentView = useFamilySelectorValueV2( + const currentView = useAtomFamilySelectorValue( coreViewFromViewIdFamilySelector, - { viewId: currentViewId ?? '' }, + { + viewId: currentViewId ?? '', + }, ); return { diff --git a/packages/twenty-front/src/modules/views/hooks/useGetViewById.ts b/packages/twenty-front/src/modules/views/hooks/useGetViewById.ts index 1842a7fa30..3696ec979a 100644 --- a/packages/twenty-front/src/modules/views/hooks/useGetViewById.ts +++ b/packages/twenty-front/src/modules/views/hooks/useGetViewById.ts @@ -1,8 +1,8 @@ -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; export const useGetViewById = (viewId: string | null) => { - const view = useFamilySelectorValueV2(coreViewFromViewIdFamilySelector, { + const view = useAtomFamilySelectorValue(coreViewFromViewIdFamilySelector, { viewId: viewId ?? '', }); diff --git a/packages/twenty-front/src/modules/views/hooks/useInitViewBar.ts b/packages/twenty-front/src/modules/views/hooks/useInitViewBar.ts index c3158ee2c7..3b17999b92 100644 --- a/packages/twenty-front/src/modules/views/hooks/useInitViewBar.ts +++ b/packages/twenty-front/src/modules/views/hooks/useInitViewBar.ts @@ -1,14 +1,14 @@ -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { availableFieldDefinitionsComponentState } from '@/views/states/availableFieldDefinitionsComponentState'; import { viewObjectMetadataIdComponentState } from '@/views/states/viewObjectMetadataIdComponentState'; export const useInitViewBar = (viewBarInstanceId?: string) => { - const setAvailableFieldDefinitions = useSetRecoilComponentStateV2( + const setAvailableFieldDefinitions = useSetAtomComponentState( availableFieldDefinitionsComponentState, viewBarInstanceId, ); - const setViewObjectMetadataId = useSetRecoilComponentStateV2( + const setViewObjectMetadataId = useSetAtomComponentState( viewObjectMetadataIdComponentState, viewBarInstanceId, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts b/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts index 0f931fb5ef..e0eb522a32 100644 --- a/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts +++ b/packages/twenty-front/src/modules/views/hooks/useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown.ts @@ -12,7 +12,7 @@ import { findDuplicateRecordFilterInNonAdvancedRecordFilters } from '@/object-re import { getRecordFilterOperands } from '@/object-record/record-filter/utils/getRecordFilterOperands'; import { usePushFocusItemToFocusStack } from '@/ui/utilities/focus/hooks/usePushFocusItemToFocusStack'; import { FocusComponentType } from '@/ui/utilities/focus/types/FocusComponentType'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { ViewBarFilterDropdownIds } from '@/views/constants/ViewBarFilterDropdownIds'; import { useStore } from 'jotai'; @@ -23,27 +23,25 @@ import { v4 } from 'uuid'; export const useInitializeFilterOnFieldMetadataItemFromViewBarFilterDropdown = () => { const selectedOperandInDropdownCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( selectedOperandInDropdownComponentState, ); const currentRecordFiltersCallbackState = - useRecoilComponentStateCallbackStateV2( - currentRecordFiltersComponentState, - ); + useAtomComponentStateCallbackState(currentRecordFiltersComponentState); const objectFilterDropdownCurrentRecordFilterCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownCurrentRecordFilterComponentState, ); const fieldMetadataItemUsedInDropdownCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( fieldMetadataItemIdUsedInDropdownComponentState, ); const objectFilterDropdownFilterIsSelectedCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( objectFilterDropdownFilterIsSelectedComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useIsViewAnyFieldFilterDifferentFromCurrentAnyFieldFilter.ts b/packages/twenty-front/src/modules/views/hooks/useIsViewAnyFieldFilterDifferentFromCurrentAnyFieldFilter.ts index 8a6545f6d8..930fe8084d 100644 --- a/packages/twenty-front/src/modules/views/hooks/useIsViewAnyFieldFilterDifferentFromCurrentAnyFieldFilter.ts +++ b/packages/twenty-front/src/modules/views/hooks/useIsViewAnyFieldFilterDifferentFromCurrentAnyFieldFilter.ts @@ -1,12 +1,12 @@ import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { isNonEmptyString } from '@sniptt/guards'; import { compareNonEmptyStrings } from '~/utils/compareNonEmptyStrings'; export const useIsViewAnyFieldFilterDifferentFromCurrentAnyFieldFilter = () => { const { currentView } = useGetCurrentViewOnly(); - const anyFieldFilterValue = useRecoilComponentValueV2( + const anyFieldFilterValue = useAtomComponentStateValue( anyFieldFilterValueComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useOpenAnyFieldSearchFilterFromViewBar.ts b/packages/twenty-front/src/modules/views/hooks/useOpenAnyFieldSearchFilterFromViewBar.ts index 849b8cb98f..80090ae0d5 100644 --- a/packages/twenty-front/src/modules/views/hooks/useOpenAnyFieldSearchFilterFromViewBar.ts +++ b/packages/twenty-front/src/modules/views/hooks/useOpenAnyFieldSearchFilterFromViewBar.ts @@ -2,24 +2,24 @@ import { objectFilterDropdownAnyFieldSearchIsSelectedComponentState } from '@/ob import { objectFilterDropdownSearchInputComponentState } from '@/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputComponentState'; import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { t } from '@lingui/core/macro'; import { isNonEmptyString } from '@sniptt/guards'; export const useOpenAnyFieldSearchFilterFromViewBar = () => { - const setAnyFieldFilterValue = useSetRecoilComponentStateV2( + const setAnyFieldFilterValue = useSetAtomComponentState( anyFieldFilterValueComponentState, ); const { objectMetadataItem } = useRecordIndexContextOrThrow(); const setObjectFilterDropdownAnyFieldSearchIsSelectedComponentState = - useSetRecoilComponentStateV2( + useSetAtomComponentState( objectFilterDropdownAnyFieldSearchIsSelectedComponentState, ); - const objectFilterDropdownSearchInput = useRecoilComponentValueV2( + const objectFilterDropdownSearchInput = useAtomComponentStateValue( objectFilterDropdownSearchInputComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useOpenCreateViewDropown.ts b/packages/twenty-front/src/modules/views/hooks/useOpenCreateViewDropown.ts index 77475879d1..b39bb8bad3 100644 --- a/packages/twenty-front/src/modules/views/hooks/useOpenCreateViewDropown.ts +++ b/packages/twenty-front/src/modules/views/hooks/useOpenCreateViewDropown.ts @@ -1,5 +1,5 @@ import { useOpenDropdown } from '@/ui/layout/dropdown/hooks/useOpenDropdown'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { type View } from '@/views/types/View'; import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId'; import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode'; @@ -8,7 +8,7 @@ import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/sta import { isDefined } from 'twenty-shared/utils'; export const useOpenCreateViewDropdown = (viewBardId?: string) => { - const setViewPickerReferenceViewId = useSetRecoilComponentStateV2( + const setViewPickerReferenceViewId = useSetAtomComponentState( viewPickerReferenceViewIdComponentState, viewBardId, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useQueryVariablesFromParentView.ts b/packages/twenty-front/src/modules/views/hooks/useQueryVariablesFromParentView.ts index 32aabd23b3..1e0fc511bc 100644 --- a/packages/twenty-front/src/modules/views/hooks/useQueryVariablesFromParentView.ts +++ b/packages/twenty-front/src/modules/views/hooks/useQueryVariablesFromParentView.ts @@ -3,7 +3,7 @@ import { contextStoreRecordShowParentViewComponentState } from '@/context-store/ import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { getQueryVariablesFromFiltersAndSorts } from '@/views/utils/getQueryVariablesFromFiltersAndSorts'; export const useQueryVariablesFromParentView = ({ @@ -13,7 +13,7 @@ export const useQueryVariablesFromParentView = ({ }) => { const { objectMetadataItems } = useObjectMetadataItems(); - const recordShowParentView = useRecoilComponentValueV2( + const recordShowParentView = useAtomComponentStateValue( contextStoreRecordShowParentViewComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveAnyFieldFilterToView.ts b/packages/twenty-front/src/modules/views/hooks/useSaveAnyFieldFilterToView.ts index e5e252a5d8..6a2367b541 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveAnyFieldFilterToView.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveAnyFieldFilterToView.ts @@ -1,5 +1,5 @@ import { anyFieldFilterValueComponentState } from '@/object-record/record-filter/states/anyFieldFilterValueComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewAPIUpdate } from '@/views/hooks/internal/usePerformViewAPIUpdate'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; @@ -14,8 +14,9 @@ export const useSaveAnyFieldFilterToView = () => { const { currentView } = useGetCurrentViewOnly(); - const anyFieldFilterValueCallbackState = - useRecoilComponentStateCallbackStateV2(anyFieldFilterValueComponentState); + const anyFieldFilterValueCallbackState = useAtomComponentStateCallbackState( + anyFieldFilterValueComponentState, + ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts b/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts index 513384bcba..c43bf6cd92 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts @@ -2,7 +2,7 @@ import { useStore } from 'jotai'; import { useCallback } from 'react'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewFieldAPIPersist } from '@/views/hooks/internal/usePerformViewFieldAPIPersist'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useGetViewFromPrefetchState } from '@/views/hooks/useGetViewFromPrefetchState'; @@ -21,7 +21,7 @@ export const useSaveCurrentViewFields = () => { const { getViewFromPrefetchState } = useGetViewFromPrefetchState(); - const currentViewIdCallbackState = useRecoilComponentStateCallbackStateV2( + const currentViewIdCallbackState = useAtomComponentStateCallbackState( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewGroups.ts b/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewGroups.ts index 3186181e07..e2c03af149 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewGroups.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewGroups.ts @@ -2,7 +2,7 @@ import { useStore } from 'jotai'; import { useCallback } from 'react'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewGroupAPIPersist } from '@/views/hooks/internal/usePerformViewGroupAPIPersist'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useGetViewFromPrefetchState } from '@/views/hooks/useGetViewFromPrefetchState'; @@ -17,7 +17,7 @@ export const useSaveCurrentViewGroups = () => { const { getViewFromPrefetchState } = useGetViewFromPrefetchState(); - const currentViewIdCallbackState = useRecoilComponentStateCallbackStateV2( + const currentViewIdCallbackState = useAtomComponentStateCallbackState( contextStoreCurrentViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts index e292cf177c..b4870f4af3 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts @@ -1,5 +1,5 @@ import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewFilterGroupAPIPersist } from '@/views/hooks/internal/usePerformViewFilterGroupAPIPersist'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; @@ -22,9 +22,7 @@ export const useSaveRecordFilterGroupsToViewFilterGroups = () => { const { currentView } = useGetCurrentViewOnly(); const currentRecordFilterGroupsCallbackState = - useRecoilComponentStateCallbackStateV2( - currentRecordFilterGroupsComponentState, - ); + useAtomComponentStateCallbackState(currentRecordFilterGroupsComponentState); const store = useStore(); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts index 230b5e6a70..640af055cb 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts @@ -1,5 +1,5 @@ import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewFilterAPIPersist } from '@/views/hooks/internal/usePerformViewFilterAPIPersist'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; @@ -21,8 +21,9 @@ export const useSaveRecordFiltersToViewFilters = () => { const { currentView } = useGetCurrentViewOnly(); - const currentRecordFiltersCallbackState = - useRecoilComponentStateCallbackStateV2(currentRecordFiltersComponentState); + const currentRecordFiltersCallbackState = useAtomComponentStateCallbackState( + currentRecordFiltersComponentState, + ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts b/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts index 930ef48b83..943b0fbb92 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts @@ -1,5 +1,5 @@ import { currentRecordSortsComponentState } from '@/object-record/record-sort/states/currentRecordSortsComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewSortAPIPersist } from '@/views/hooks/internal/usePerformViewSortAPIPersist'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; @@ -21,8 +21,9 @@ export const useSaveRecordSortsToViewSorts = () => { const { currentView } = useGetCurrentViewOnly(); - const currentRecordSortsCallbackState = - useRecoilComponentStateCallbackStateV2(currentRecordSortsComponentState); + const currentRecordSortsCallbackState = useAtomComponentStateCallbackState( + currentRecordSortsComponentState, + ); const store = useStore(); diff --git a/packages/twenty-front/src/modules/views/hooks/useUpdateCurrentView.ts b/packages/twenty-front/src/modules/views/hooks/useUpdateCurrentView.ts index aab0387adf..e00257103f 100644 --- a/packages/twenty-front/src/modules/views/hooks/useUpdateCurrentView.ts +++ b/packages/twenty-front/src/modules/views/hooks/useUpdateCurrentView.ts @@ -1,11 +1,11 @@ import { useStore } from 'jotai'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { useLoadRecordIndexStates } from '@/object-record/record-index/hooks/useLoadRecordIndexStates'; import { recordIndexViewTypeState } from '@/object-record/record-index/states/recordIndexViewTypeState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useRefreshCoreViewsByObjectMetadataId } from '@/views/hooks/useRefreshCoreViewsByObjectMetadataId'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; @@ -21,12 +21,12 @@ import { useUpdateCoreViewMutation } from '~/generated-metadata/graphql'; export const useUpdateCurrentView = () => { const { canPersistChanges } = useCanPersistViewChanges(); - const currentViewIdCallbackState = useRecoilComponentStateCallbackStateV2( + const currentViewIdCallbackState = useAtomComponentStateCallbackState( contextStoreCurrentViewIdComponentState, ); const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); const { loadRecordIndexStates } = useLoadRecordIndexStates(); - const setRecordIndexViewType = useSetRecoilStateV2(recordIndexViewTypeState); + const setRecordIndexViewType = useSetAtomState(recordIndexViewTypeState); const store = useStore(); diff --git a/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts b/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts index 730ecbde48..60052dc674 100644 --- a/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts +++ b/packages/twenty-front/src/modules/views/hooks/useUpdateViewAggregate.ts @@ -3,7 +3,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { useLoadRecordIndexStates } from '@/object-record/record-index/hooks/useLoadRecordIndexStates'; import { type ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations'; import { convertExtendedAggregateOperationToAggregateOperation } from '@/object-record/utils/convertExtendedAggregateOperationToAggregateOperation'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { usePerformViewAPIUpdate } from '@/views/hooks/internal/usePerformViewAPIUpdate'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { coreViewsState } from '@/views/states/coreViewState'; @@ -19,7 +19,7 @@ import { useStore } from 'jotai'; export const useUpdateViewAggregate = () => { const store = useStore(); const { canPersistChanges } = useCanPersistViewChanges(); - const currentViewId = useRecoilComponentValueV2( + const currentViewId = useAtomComponentStateValue( contextStoreCurrentViewIdComponentState, ); const { performViewAPIUpdate } = usePerformViewAPIUpdate(); diff --git a/packages/twenty-front/src/modules/views/hooks/useViewOrDefaultViewFromPrefetchedViews.ts b/packages/twenty-front/src/modules/views/hooks/useViewOrDefaultViewFromPrefetchedViews.ts index ca8a653385..7eca746cf8 100644 --- a/packages/twenty-front/src/modules/views/hooks/useViewOrDefaultViewFromPrefetchedViews.ts +++ b/packages/twenty-front/src/modules/views/hooks/useViewOrDefaultViewFromPrefetchedViews.ts @@ -1,4 +1,4 @@ -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreIndexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; @@ -7,14 +7,17 @@ export const useViewOrDefaultViewFromPrefetchedViews = ({ }: { objectMetadataItemId: string; }) => { - const indexViewId = useFamilySelectorValueV2( + const indexViewId = useAtomFamilySelectorValue( coreIndexViewIdFromObjectMetadataItemFamilySelector, { objectMetadataItemId }, ); - const indexView = useFamilySelectorValueV2(coreViewFromViewIdFamilySelector, { - viewId: indexViewId ?? '', - }); + const indexView = useAtomFamilySelectorValue( + coreViewFromViewIdFamilySelector, + { + viewId: indexViewId ?? '', + }, + ); return { view: indexView }; }; diff --git a/packages/twenty-front/src/modules/views/hooks/useViewsSideEffectsOnViewGroups.ts b/packages/twenty-front/src/modules/views/hooks/useViewsSideEffectsOnViewGroups.ts index e74d81d74e..4fa991b87f 100644 --- a/packages/twenty-front/src/modules/views/hooks/useViewsSideEffectsOnViewGroups.ts +++ b/packages/twenty-front/src/modules/views/hooks/useViewsSideEffectsOnViewGroups.ts @@ -1,7 +1,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { useTriggerViewGroupOptimisticEffect } from '@/views/optimistic-effects/hooks/useTriggerViewGroupOptimisticEffect'; import { type ViewGroup } from '@/views/types/ViewGroup'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { v4 } from 'uuid'; import { type CoreViewGroup } from '~/generated-metadata/graphql'; @@ -10,7 +10,7 @@ const useViewsSideEffectsOnViewGroups = () => { const { triggerViewGroupOptimisticEffect } = useTriggerViewGroupOptimisticEffect(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const triggerViewGroupOptimisticEffectAtViewCreation = ({ newViewId, diff --git a/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsComponentState.ts b/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsComponentState.ts index 710679054f..a86f4b6aa4 100644 --- a/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsComponentState.ts +++ b/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsComponentState.ts @@ -1,9 +1,9 @@ import { type FieldMetadata } from '@/object-record/record-field/ui/types/FieldMetadata'; import { type ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition'; -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; -export const availableFieldDefinitionsComponentState = createComponentStateV2< +export const availableFieldDefinitionsComponentState = createAtomComponentState< ColumnDefinition[] >({ key: 'availableFieldDefinitionsComponentState', diff --git a/packages/twenty-front/src/modules/views/states/coreViewState.ts b/packages/twenty-front/src/modules/views/states/coreViewState.ts index b2b641df42..ac17bc3023 100644 --- a/packages/twenty-front/src/modules/views/states/coreViewState.ts +++ b/packages/twenty-front/src/modules/views/states/coreViewState.ts @@ -1,7 +1,7 @@ import { type CoreViewWithRelations } from '@/views/types/CoreViewWithRelations'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const coreViewsState = createStateV2({ +export const coreViewsState = createAtomState({ key: 'coreViewsState', defaultValue: [], }); diff --git a/packages/twenty-front/src/modules/views/states/hasInitializedAnyFieldFilterComponentFamilyState.ts b/packages/twenty-front/src/modules/views/states/hasInitializedAnyFieldFilterComponentFamilyState.ts index 1f0e42c348..6541ce15dc 100644 --- a/packages/twenty-front/src/modules/views/states/hasInitializedAnyFieldFilterComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/views/states/hasInitializedAnyFieldFilterComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const hasInitializedAnyFieldFilterComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'hasInitializedAnyFieldFilterComponentFamilyState', defaultValue: false, componentInstanceContext: RecordFiltersComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFieldsComponentFamilyState.ts b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFieldsComponentFamilyState.ts index 6963b01993..c47266a30d 100644 --- a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFieldsComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFieldsComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordFieldsComponentInstanceContext } from '@/object-record/record-field/states/context/RecordFieldsComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const hasInitializedCurrentRecordFieldsComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'hasInitializedCurrentRecordFieldsComponentFamilyState', defaultValue: false, componentInstanceContext: RecordFieldsComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFilterGroupsComponentFamilyState.ts b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFilterGroupsComponentFamilyState.ts index 3be2166778..0d9dea882c 100644 --- a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFilterGroupsComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFilterGroupsComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/record-filter-group/states/context/RecordFilterGroupsComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const hasInitializedCurrentRecordFilterGroupsComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'hasInitializedCurrentRecordFilterGroupsComponentFamilyState', defaultValue: false, componentInstanceContext: RecordFilterGroupsComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState.ts b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState.ts index ce1c0be4a8..3eb890e328 100644 --- a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const hasInitializedCurrentRecordFiltersComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'hasInitializedCurrentRecordFiltersComponentFamilyState', defaultValue: false, componentInstanceContext: RecordFiltersComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordSortsComponentFamilyState.ts b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordSortsComponentFamilyState.ts index 2908db3317..5744197054 100644 --- a/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordSortsComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/views/states/hasInitializedCurrentRecordSortsComponentFamilyState.ts @@ -1,8 +1,8 @@ import { RecordSortsComponentInstanceContext } from '@/object-record/record-sort/states/context/RecordSortsComponentInstanceContext'; -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; export const hasInitializedCurrentRecordSortsComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'hasInitializedCurrentRecordSortsComponentFamilyState', defaultValue: false, componentInstanceContext: RecordSortsComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/states/isCurrentViewIndexComponentState.ts b/packages/twenty-front/src/modules/views/states/isCurrentViewIndexComponentState.ts index 75666dc567..f343bb046e 100644 --- a/packages/twenty-front/src/modules/views/states/isCurrentViewIndexComponentState.ts +++ b/packages/twenty-front/src/modules/views/states/isCurrentViewIndexComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const isCurrentViewKeyIndexComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'isCurrentViewKeyIndexComponentState', defaultValue: true, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/states/isViewBarExpandedComponentState.ts b/packages/twenty-front/src/modules/views/states/isViewBarExpandedComponentState.ts index f3edd1d081..60b1472593 100644 --- a/packages/twenty-front/src/modules/views/states/isViewBarExpandedComponentState.ts +++ b/packages/twenty-front/src/modules/views/states/isViewBarExpandedComponentState.ts @@ -1,8 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; -export const isViewBarExpandedComponentState = createComponentStateV2({ - key: 'isViewBarExpandedComponentState', - defaultValue: true, - componentInstanceContext: ViewComponentInstanceContext, -}); +export const isViewBarExpandedComponentState = + createAtomComponentState({ + key: 'isViewBarExpandedComponentState', + defaultValue: true, + componentInstanceContext: ViewComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector.ts b/packages/twenty-front/src/modules/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector.ts index 2c39356b91..bc5baa0a9d 100644 --- a/packages/twenty-front/src/modules/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector.ts +++ b/packages/twenty-front/src/modules/views/states/selectors/coreIndexViewIdFromObjectMetadataItemFamilySelector.ts @@ -1,10 +1,13 @@ import { coreViewsState } from '@/views/states/coreViewState'; import { ViewKey } from '@/views/types/ViewKey'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; export const coreIndexViewIdFromObjectMetadataItemFamilySelector = - createFamilySelectorV2({ + createAtomFamilySelector< + string | undefined, + { objectMetadataItemId: string } + >({ key: 'coreIndexViewIdFromObjectMetadataItemFamilySelector', get: ({ objectMetadataItemId }) => diff --git a/packages/twenty-front/src/modules/views/states/selectors/coreViewFromViewIdFamilySelector.ts b/packages/twenty-front/src/modules/views/states/selectors/coreViewFromViewIdFamilySelector.ts index 4327a4f8d0..5976508155 100644 --- a/packages/twenty-front/src/modules/views/states/selectors/coreViewFromViewIdFamilySelector.ts +++ b/packages/twenty-front/src/modules/views/states/selectors/coreViewFromViewIdFamilySelector.ts @@ -1,9 +1,9 @@ -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { coreViewsState } from '@/views/states/coreViewState'; import { type View } from '@/views/types/View'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; -export const coreViewFromViewIdFamilySelector = createFamilySelectorV2< +export const coreViewFromViewIdFamilySelector = createAtomFamilySelector< View | undefined, { viewId: string } >({ diff --git a/packages/twenty-front/src/modules/views/states/selectors/coreViewIdsFromObjectMetadataItemFamilySelector.ts b/packages/twenty-front/src/modules/views/states/selectors/coreViewIdsFromObjectMetadataItemFamilySelector.ts index 4664b2ede6..8a107edc8f 100644 --- a/packages/twenty-front/src/modules/views/states/selectors/coreViewIdsFromObjectMetadataItemFamilySelector.ts +++ b/packages/twenty-front/src/modules/views/states/selectors/coreViewIdsFromObjectMetadataItemFamilySelector.ts @@ -1,9 +1,9 @@ import { coreViewsState } from '@/views/states/coreViewState'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; export const coreViewIdsFromObjectMetadataItemFamilySelector = - createFamilySelectorV2({ + createAtomFamilySelector({ key: 'coreViewIdsFromObjectMetadataItemFamilySelector', get: ({ objectMetadataItemId }) => diff --git a/packages/twenty-front/src/modules/views/states/selectors/coreViewLengthFamilySelector.ts b/packages/twenty-front/src/modules/views/states/selectors/coreViewLengthFamilySelector.ts index 34b33d4fac..d28d2654e2 100644 --- a/packages/twenty-front/src/modules/views/states/selectors/coreViewLengthFamilySelector.ts +++ b/packages/twenty-front/src/modules/views/states/selectors/coreViewLengthFamilySelector.ts @@ -1,7 +1,7 @@ import { coreViewsState } from '@/views/states/coreViewState'; -import { createSelectorV2 } from '@/ui/utilities/state/jotai/utils/createSelectorV2'; +import { createAtomSelector } from '@/ui/utilities/state/jotai/utils/createAtomSelector'; -export const coreViewLengthFamilySelector = createSelectorV2({ +export const coreViewLengthFamilySelector = createAtomSelector({ key: 'coreViewLengthFamilySelector', get: ({ get }) => { const coreViews = get(coreViewsState); diff --git a/packages/twenty-front/src/modules/views/states/selectors/coreViewsByObjectMetadataIdFamilySelector.ts b/packages/twenty-front/src/modules/views/states/selectors/coreViewsByObjectMetadataIdFamilySelector.ts index 552d29f4b8..f5f277a771 100644 --- a/packages/twenty-front/src/modules/views/states/selectors/coreViewsByObjectMetadataIdFamilySelector.ts +++ b/packages/twenty-front/src/modules/views/states/selectors/coreViewsByObjectMetadataIdFamilySelector.ts @@ -1,9 +1,9 @@ import { coreViewsState } from '@/views/states/coreViewState'; import { type CoreViewWithRelations } from '@/views/types/CoreViewWithRelations'; -import { createWritableFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createWritableFamilySelectorV2'; +import { createAtomWritableFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomWritableFamilySelector'; export const coreViewsByObjectMetadataIdFamilySelector = - createWritableFamilySelectorV2({ + createAtomWritableFamilySelector({ key: 'coreViewsByObjectMetadataIdFamilySelector', get: (objectMetadataId) => diff --git a/packages/twenty-front/src/modules/views/states/selectors/coreViewsFromObjectMetadataItemFamilySelector.ts b/packages/twenty-front/src/modules/views/states/selectors/coreViewsFromObjectMetadataItemFamilySelector.ts index dacecb6cad..699efecf0d 100644 --- a/packages/twenty-front/src/modules/views/states/selectors/coreViewsFromObjectMetadataItemFamilySelector.ts +++ b/packages/twenty-front/src/modules/views/states/selectors/coreViewsFromObjectMetadataItemFamilySelector.ts @@ -1,10 +1,10 @@ import { coreViewsState } from '@/views/states/coreViewState'; import { type View } from '@/views/types/View'; import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; export const coreViewsFromObjectMetadataItemFamilySelector = - createFamilySelectorV2({ + createAtomFamilySelector({ key: 'coreViewsFromObjectMetadataItemFamilySelector', get: ({ objectMetadataItemId }) => diff --git a/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdComponentState.ts b/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdComponentState.ts index d4eb8afb30..e0d952efee 100644 --- a/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdComponentState.ts +++ b/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdComponentState.ts @@ -1,7 +1,7 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; -export const viewObjectMetadataIdComponentState = createComponentStateV2< +export const viewObjectMetadataIdComponentState = createAtomComponentState< string | undefined >({ key: 'viewObjectMetadataIdComponentState', diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx index 2876ac9132..5afd7d1a10 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentCreateMode.tsx @@ -11,9 +11,9 @@ import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { viewObjectMetadataIdComponentState } from '@/views/states/viewObjectMetadataIdComponentState'; import { ViewType, viewTypeIconMapping } from '@/views/types/ViewType'; import { ViewPickerCreateButton } from '@/views/view-picker/components/ViewPickerCreateButton'; @@ -53,41 +53,38 @@ export const ViewPickerContentCreateMode = () => { const { viewPickerMode, setViewPickerMode } = useViewPickerMode(); const [hasManuallySelectedIcon, setHasManuallySelectedIcon] = useState(false); - const viewObjectMetadataId = useRecoilComponentValueV2( + const viewObjectMetadataId = useAtomComponentStateValue( viewObjectMetadataIdComponentState, ); const { objectMetadataItem } = useObjectMetadataItemById({ objectId: viewObjectMetadataId ?? '', }); - const [viewPickerInputName, setViewPickerInputName] = - useRecoilComponentStateV2(viewPickerInputNameComponentState); + const [viewPickerInputName, setViewPickerInputName] = useAtomComponentState( + viewPickerInputNameComponentState, + ); const [viewPickerSelectedIcon, setViewPickerSelectedIcon] = - useRecoilComponentStateV2(viewPickerSelectedIconComponentState); + useAtomComponentState(viewPickerSelectedIconComponentState); - const viewPickerIsPersisting = useRecoilComponentValueV2( + const viewPickerIsPersisting = useAtomComponentStateValue( viewPickerIsPersistingComponentState, ); - const setViewPickerIsDirty = useSetRecoilComponentStateV2( + const setViewPickerIsDirty = useSetAtomComponentState( viewPickerIsDirtyComponentState, ); const [ viewPickerMainGroupByFieldMetadataId, setViewPickerMainGroupByFieldMetadataId, - ] = useRecoilComponentStateV2( - viewPickerMainGroupByFieldMetadataIdComponentState, - ); + ] = useAtomComponentState(viewPickerMainGroupByFieldMetadataIdComponentState); const [ viewPickerCalendarFieldMetadataId, setViewPickerCalendarFieldMetadataId, - ] = useRecoilComponentStateV2( - viewPickerCalendarFieldMetadataIdComponentState, - ); + ] = useAtomComponentState(viewPickerCalendarFieldMetadataIdComponentState); - const [viewPickerType, setViewPickerType] = useRecoilComponentStateV2( + const [viewPickerType, setViewPickerType] = useAtomComponentState( viewPickerTypeComponentState, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx index 08e4be62dd..62c47d72b7 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEditMode.tsx @@ -8,9 +8,9 @@ import { DropdownMenuHeaderLeftComponent } from '@/ui/layout/dropdown/components import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { ViewPickerEditButton } from '@/views/view-picker/components/ViewPickerEditButton'; import { ViewPickerIconAndNameContainer } from '@/views/view-picker/components/ViewPickerIconAndNameContainer'; import { ViewPickerSaveButtonContainer } from '@/views/view-picker/components/ViewPickerSaveButtonContainer'; @@ -27,15 +27,16 @@ import { IconChevronLeft } from 'twenty-ui/display'; export const ViewPickerContentEditMode = () => { const { setViewPickerMode } = useViewPickerMode(); - const [viewPickerInputName, setViewPickerInputName] = - useRecoilComponentStateV2(viewPickerInputNameComponentState); + const [viewPickerInputName, setViewPickerInputName] = useAtomComponentState( + viewPickerInputNameComponentState, + ); const [viewPickerSelectedIcon, setViewPickerSelectedIcon] = - useRecoilComponentStateV2(viewPickerSelectedIconComponentState); + useAtomComponentState(viewPickerSelectedIconComponentState); - const viewPickerIsPersisting = useRecoilComponentValueV2( + const viewPickerIsPersisting = useAtomComponentStateValue( viewPickerIsPersistingComponentState, ); - const setViewPickerIsDirty = useSetRecoilComponentStateV2( + const setViewPickerIsDirty = useSetAtomComponentState( viewPickerIsDirtyComponentState, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEffect.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEffect.tsx index 4671611395..1033f736dd 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEffect.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerContentEffect.tsx @@ -2,10 +2,10 @@ import { useEffect } from 'react'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewsFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/coreViewsFromObjectMetadataItemFamilySelector'; import { viewTypeIconMapping } from '@/views/types/ViewType'; import { useGetAvailableFieldsForCalendar } from '@/views/view-picker/hooks/useGetAvailableFieldsForCalendar'; @@ -27,13 +27,13 @@ import { } from '~/generated-metadata/graphql'; export const ViewPickerContentEffect = () => { - const setViewPickerSelectedIcon = useSetRecoilComponentStateV2( + const setViewPickerSelectedIcon = useSetAtomComponentState( viewPickerSelectedIconComponentState, ); - const setViewPickerInputName = useSetRecoilComponentStateV2( + const setViewPickerInputName = useSetAtomComponentState( viewPickerInputNameComponentState, ); - const setViewPickerVisibility = useSetRecoilComponentStateV2( + const setViewPickerVisibility = useSetAtomComponentState( viewPickerVisibilityComponentState, ); const { viewPickerMode } = useViewPickerMode(); @@ -41,35 +41,31 @@ export const ViewPickerContentEffect = () => { const [ viewPickerMainGroupByFieldMetadataId, setViewPickerMainGroupByFieldMetadataId, - ] = useRecoilComponentStateV2( - viewPickerMainGroupByFieldMetadataIdComponentState, - ); + ] = useAtomComponentState(viewPickerMainGroupByFieldMetadataIdComponentState); const [ viewPickerCalendarFieldMetadataId, setViewPickerCalendarFieldMetadataId, - ] = useRecoilComponentStateV2( - viewPickerCalendarFieldMetadataIdComponentState, - ); + ] = useAtomComponentState(viewPickerCalendarFieldMetadataIdComponentState); - const [viewPickerType, setViewPickerType] = useRecoilComponentStateV2( + const [viewPickerType, setViewPickerType] = useAtomComponentState( viewPickerTypeComponentState, ); - const viewPickerReferenceViewId = useRecoilComponentValueV2( + const viewPickerReferenceViewId = useAtomComponentStateValue( viewPickerReferenceViewIdComponentState, ); - const viewPickerIsDirty = useRecoilComponentValueV2( + const viewPickerIsDirty = useAtomComponentStateValue( viewPickerIsDirtyComponentState, ); - const viewPickerIsPersisting = useRecoilComponentValueV2( + const viewPickerIsPersisting = useAtomComponentStateValue( viewPickerIsPersistingComponentState, ); const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const viewsOnCurrentObject = useFamilySelectorValueV2( + const viewsOnCurrentObject = useAtomFamilySelectorValue( coreViewsFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateButton.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateButton.tsx index b6b21b2913..1448acb5e4 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateButton.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateButton.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewType } from '@/views/types/ViewType'; import { useCreateViewFromCurrentState } from '@/views/view-picker/hooks/useCreateViewFromCurrentState'; import { useDestroyViewFromCurrentState } from '@/views/view-picker/hooks/useDestroyViewFromCurrentState'; @@ -20,16 +20,16 @@ export const ViewPickerCreateButton = () => { useGetAvailableFieldsForCalendar(); const { viewPickerMode } = useViewPickerMode(); - const viewPickerType = useRecoilComponentValueV2( + const viewPickerType = useAtomComponentStateValue( viewPickerTypeComponentState, ); - const viewPickerIsPersisting = useRecoilComponentValueV2( + const viewPickerIsPersisting = useAtomComponentStateValue( viewPickerIsPersistingComponentState, ); - const viewPickerMainGroupByFieldMetadataId = useRecoilComponentValueV2( + const viewPickerMainGroupByFieldMetadataId = useAtomComponentStateValue( viewPickerMainGroupByFieldMetadataIdComponentState, ); - const viewPickerCalendarFieldMetadataId = useRecoilComponentValueV2( + const viewPickerCalendarFieldMetadataId = useAtomComponentStateValue( viewPickerCalendarFieldMetadataIdComponentState, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx index e3ab851f88..ebe458784a 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerDropdown.tsx @@ -5,7 +5,7 @@ import { t } from '@lingui/core/macro'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { StyledDropdownButtonContainer } from '@/ui/layout/dropdown/components/StyledDropdownButtonContainer'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetRecordIndexTotalCount } from '@/views/hooks/internal/useGetRecordIndexTotalCount'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { ViewPickerContentCreateMode } from '@/views/view-picker/components/ViewPickerContentCreateMode'; @@ -61,7 +61,7 @@ export const ViewPickerDropdown = () => { const { totalCount } = useGetRecordIndexTotalCount(); - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, VIEW_PICKER_DROPDOWN_ID, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerEditButton.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerEditButton.tsx index 0d921ab66e..6c61df3872 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerEditButton.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerEditButton.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { ViewType } from '@/views/types/ViewType'; import { useCreateViewFromCurrentState } from '@/views/view-picker/hooks/useCreateViewFromCurrentState'; import { useDestroyViewFromCurrentState } from '@/views/view-picker/hooks/useDestroyViewFromCurrentState'; @@ -15,13 +15,13 @@ export const ViewPickerEditButton = () => { useGetAvailableFieldsToGroupRecordsBy(); const { viewPickerMode } = useViewPickerMode(); - const viewPickerType = useRecoilComponentValueV2( + const viewPickerType = useAtomComponentStateValue( viewPickerTypeComponentState, ); - const viewPickerIsPersisting = useRecoilComponentValueV2( + const viewPickerIsPersisting = useAtomComponentStateValue( viewPickerIsPersistingComponentState, ); - const viewPickerMainGroupByFieldMetadataId = useRecoilComponentValueV2( + const viewPickerMainGroupByFieldMetadataId = useAtomComponentStateValue( viewPickerMainGroupByFieldMetadataIdComponentState, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerFavoriteFoldersDropdown.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerFavoriteFoldersDropdown.tsx index 01ce6268e7..5d87b8f378 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerFavoriteFoldersDropdown.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerFavoriteFoldersDropdown.tsx @@ -1,18 +1,18 @@ import { FavoriteFolderPicker } from '@/favorites/favorite-folder-picker/components/FavoriteFolderPicker'; import { FavoriteFolderPickerEffect } from '@/favorites/favorite-folder-picker/components/FavoriteFolderPickerEffect'; import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder-picker/states/context/FavoriteFolderPickerInstanceContext'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { coreViewFromViewIdFamilySelector } from '@/views/states/selectors/coreViewFromViewIdFamilySelector'; import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId'; import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState'; export const ViewPickerFavoriteFoldersDropdown = () => { - const [viewPickerReferenceViewId] = useRecoilComponentStateV2( + const [viewPickerReferenceViewId] = useAtomComponentState( viewPickerReferenceViewIdComponentState, ); - const view = useFamilySelectorValueV2(coreViewFromViewIdFamilySelector, { + const view = useAtomFamilySelectorValue(coreViewFromViewIdFamilySelector, { viewId: viewPickerReferenceViewId ?? '', }); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerListContent.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerListContent.tsx index e8cd9f91c3..aa3a97ca50 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerListContent.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerListContent.tsx @@ -10,8 +10,8 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSectionLabel } from '@/ui/layout/dropdown/components/DropdownMenuSectionLabel'; import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { usePerformViewAPIUpdate } from '@/views/hooks/internal/usePerformViewAPIUpdate'; import { useChangeView } from '@/views/hooks/useChangeView'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; @@ -36,7 +36,7 @@ export const ViewPickerListContent = () => { const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const viewsOnCurrentObject = useFamilySelectorValueV2( + const viewsOnCurrentObject = useAtomFamilySelectorValue( coreViewsFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); @@ -54,7 +54,7 @@ export const ViewPickerListContent = () => { const { currentView } = useGetCurrentViewOnly(); - const setViewPickerReferenceViewId = useSetRecoilComponentStateV2( + const setViewPickerReferenceViewId = useSetAtomComponentState( viewPickerReferenceViewIdComponentState, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerOptionDropdown.tsx b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerOptionDropdown.tsx index a048d63529..f7db62d2b3 100644 --- a/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerOptionDropdown.tsx +++ b/packages/twenty-front/src/modules/views/view-picker/components/ViewPickerOptionDropdown.tsx @@ -6,7 +6,7 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { MenuItemWithOptionDropdown } from '@/ui/navigation/menu-item/components/MenuItemWithOptionDropdown'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { type View } from '@/views/types/View'; import { useDestroyViewFromCurrentState } from '@/views/view-picker/hooks/useDestroyViewFromCurrentState'; import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode'; @@ -54,7 +54,7 @@ export const ViewPickerOptionDropdown = ({ const { closeDropdown } = useCloseDropdown(); const { getIcon } = useIcons(); const { destroyViewFromCurrentState } = useDestroyViewFromCurrentState(); - const setViewPickerReferenceViewId = useSetRecoilComponentStateV2( + const setViewPickerReferenceViewId = useSetAtomComponentState( viewPickerReferenceViewIdComponentState, ); const { setViewPickerMode } = useViewPickerMode(); diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useCloseAndResetViewPicker.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useCloseAndResetViewPicker.ts index 3130637e47..f03056cb04 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useCloseAndResetViewPicker.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useCloseAndResetViewPicker.ts @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId'; import { VIEW_PICKER_KANBAN_FIELD_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerKanbanFieldDropdownId'; import { VIEW_PICKER_VIEW_TYPE_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerViewTypeDropdownId'; @@ -9,11 +9,11 @@ import { viewPickerIsPersistingComponentState } from '@/views/view-picker/states import { viewPickerModeComponentState } from '@/views/view-picker/states/viewPickerModeComponentState'; export const useCloseAndResetViewPicker = () => { - const setViewPickerMode = useSetRecoilComponentStateV2( + const setViewPickerMode = useSetAtomComponentState( viewPickerModeComponentState, ); - const setViewPickerIsPersisting = useSetRecoilComponentStateV2( + const setViewPickerIsPersisting = useSetAtomComponentState( viewPickerIsPersistingComponentState, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useCreateViewFromCurrentState.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useCreateViewFromCurrentState.ts index ebb81e76f1..ea6a3abaac 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useCreateViewFromCurrentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useCreateViewFromCurrentState.ts @@ -1,4 +1,4 @@ -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { useChangeView } from '@/views/hooks/useChangeView'; import { useCreateViewFromCurrentView } from '@/views/hooks/useCreateViewFromCurrentView'; import { ViewType } from '@/views/types/ViewType'; @@ -19,43 +19,41 @@ import { isDefined } from 'twenty-shared/utils'; export const useCreateViewFromCurrentState = () => { const { closeAndResetViewPicker } = useCloseAndResetViewPicker(); - const viewPickerInputNameCallbackState = - useRecoilComponentStateCallbackStateV2(viewPickerInputNameComponentState); + const viewPickerInputNameCallbackState = useAtomComponentStateCallbackState( + viewPickerInputNameComponentState, + ); const viewPickerSelectedIconCallbackState = - useRecoilComponentStateCallbackStateV2( - viewPickerSelectedIconComponentState, - ); + useAtomComponentStateCallbackState(viewPickerSelectedIconComponentState); - const viewPickerTypeCallbackState = useRecoilComponentStateCallbackStateV2( + const viewPickerTypeCallbackState = useAtomComponentStateCallbackState( viewPickerTypeComponentState, ); const viewPickerMainGroupByFieldMetadataIdCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( viewPickerMainGroupByFieldMetadataIdComponentState, ); const viewPickerCalendarFieldMetadataIdCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( viewPickerCalendarFieldMetadataIdComponentState, ); const viewPickerIsPersistingCallbackState = - useRecoilComponentStateCallbackStateV2( - viewPickerIsPersistingComponentState, - ); + useAtomComponentStateCallbackState(viewPickerIsPersistingComponentState); - const viewPickerIsDirtyCallbackState = useRecoilComponentStateCallbackStateV2( + const viewPickerIsDirtyCallbackState = useAtomComponentStateCallbackState( viewPickerIsDirtyComponentState, ); - const viewPickerModeCallbackState = useRecoilComponentStateCallbackStateV2( + const viewPickerModeCallbackState = useAtomComponentStateCallbackState( viewPickerModeComponentState, ); - const viewPickerVisibilityCallbackState = - useRecoilComponentStateCallbackStateV2(viewPickerVisibilityComponentState); + const viewPickerVisibilityCallbackState = useAtomComponentStateCallbackState( + viewPickerVisibilityComponentState, + ); const { createViewFromCurrentView } = useCreateViewFromCurrentView(); const { changeView } = useChangeView(); diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useDestroyViewFromCurrentState.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useDestroyViewFromCurrentState.ts index fcbe169831..7b2468f394 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useDestroyViewFromCurrentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useDestroyViewFromCurrentState.ts @@ -2,8 +2,8 @@ import { useCallback } from 'react'; import { useStore } from 'jotai'; import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { usePerformViewAPIPersist } from '@/views/hooks/internal/usePerformViewAPIPersist'; import { useChangeView } from '@/views/hooks/useChangeView'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; @@ -18,25 +18,25 @@ export const useDestroyViewFromCurrentState = (viewBarInstanceId?: string) => { const { closeAndResetViewPicker } = useCloseAndResetViewPicker(); const viewPickerIsPersistingCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( viewPickerIsPersistingComponentState, viewBarInstanceId, ); - const viewPickerIsDirtyCallbackState = useRecoilComponentStateCallbackStateV2( + const viewPickerIsDirtyCallbackState = useAtomComponentStateCallbackState( viewPickerIsDirtyComponentState, viewBarInstanceId, ); const viewPickerReferenceViewIdCallbackState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( viewPickerReferenceViewIdComponentState, viewBarInstanceId, ); const { objectMetadataItem } = useContextStoreObjectMetadataItemOrThrow(); - const viewsOnCurrentObject = useFamilySelectorValueV2( + const viewsOnCurrentObject = useAtomFamilySelectorValue( coreViewsFromObjectMetadataItemFamilySelector, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForCalendar.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForCalendar.ts index 02676cf2f4..b7904259ad 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForCalendar.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForCalendar.ts @@ -3,20 +3,20 @@ import { useLocation } from 'react-router-dom'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { viewObjectMetadataIdComponentState } from '@/views/states/viewObjectMetadataIdComponentState'; import { FieldMetadataType, SettingsPath } from 'twenty-shared/types'; import { isDefined, isFieldMetadataDateKind } from 'twenty-shared/utils'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; export const useGetAvailableFieldsForCalendar = () => { - const viewObjectMetadataId = useRecoilComponentValueV2( + const viewObjectMetadataId = useAtomComponentStateValue( viewObjectMetadataIdComponentState, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); const location = useLocation(); diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsToGroupRecordsBy.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsToGroupRecordsBy.ts index 9719705d28..a8c195eb41 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsToGroupRecordsBy.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsToGroupRecordsBy.ts @@ -3,9 +3,9 @@ import { useLocation } from 'react-router-dom'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { viewObjectMetadataIdComponentState } from '@/views/states/viewObjectMetadataIdComponentState'; import { SettingsPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -13,11 +13,11 @@ import { FieldMetadataType } from '~/generated-metadata/graphql'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; export const useGetAvailableFieldsToGroupRecordsBy = () => { - const viewObjectMetadataId = useRecoilComponentValueV2( + const viewObjectMetadataId = useAtomComponentStateValue( viewObjectMetadataIdComponentState, ); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const setNavigationMemorizedUrl = useSetRecoilStateV2( + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const setNavigationMemorizedUrl = useSetAtomState( navigationMemorizedUrlState, ); const location = useLocation(); diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useUpdateViewFromCurrentState.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useUpdateViewFromCurrentState.ts index 126b701ca8..43ca24a3e6 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useUpdateViewFromCurrentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useUpdateViewFromCurrentState.ts @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import { useStore } from 'jotai'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { usePerformViewAPIUpdate } from '@/views/hooks/internal/usePerformViewAPIUpdate'; import { useCanPersistViewChanges } from '@/views/hooks/useCanPersistViewChanges'; import { useCloseAndResetViewPicker } from '@/views/view-picker/hooks/useCloseAndResetViewPicker'; @@ -16,30 +16,26 @@ export const useUpdateViewFromCurrentState = () => { const { canPersistChanges } = useCanPersistViewChanges(); const { closeAndResetViewPicker } = useCloseAndResetViewPicker(); - const viewPickerInputNameCallbackState = - useRecoilComponentStateCallbackStateV2(viewPickerInputNameComponentState); + const viewPickerInputNameCallbackState = useAtomComponentStateCallbackState( + viewPickerInputNameComponentState, + ); const viewPickerSelectedIconCallbackState = - useRecoilComponentStateCallbackStateV2( - viewPickerSelectedIconComponentState, - ); + useAtomComponentStateCallbackState(viewPickerSelectedIconComponentState); const viewPickerIsPersistingCallbackState = - useRecoilComponentStateCallbackStateV2( - viewPickerIsPersistingComponentState, - ); + useAtomComponentStateCallbackState(viewPickerIsPersistingComponentState); - const viewPickerIsDirtyCallbackState = useRecoilComponentStateCallbackStateV2( + const viewPickerIsDirtyCallbackState = useAtomComponentStateCallbackState( viewPickerIsDirtyComponentState, ); const viewPickerReferenceViewIdCallbackState = - useRecoilComponentStateCallbackStateV2( - viewPickerReferenceViewIdComponentState, - ); + useAtomComponentStateCallbackState(viewPickerReferenceViewIdComponentState); - const viewPickerVisibilityCallbackState = - useRecoilComponentStateCallbackStateV2(viewPickerVisibilityComponentState); + const viewPickerVisibilityCallbackState = useAtomComponentStateCallbackState( + viewPickerVisibilityComponentState, + ); const { performViewAPIUpdate } = usePerformViewAPIUpdate(); diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useViewPickerMode.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useViewPickerMode.ts index 7f7e5a4a72..a14d177ee0 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useViewPickerMode.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useViewPickerMode.ts @@ -1,8 +1,8 @@ -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { viewPickerModeComponentState } from '@/views/view-picker/states/viewPickerModeComponentState'; export const useViewPickerMode = (viewBarComponentId?: string) => { - const [viewPickerMode, setViewPickerMode] = useRecoilComponentStateV2( + const [viewPickerMode, setViewPickerMode] = useAtomComponentState( viewPickerModeComponentState, viewBarComponentId, ); diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerCalendarFieldMetadataIdComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerCalendarFieldMetadataIdComponentState.ts index cd6bf515a6..67a2845f5d 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerCalendarFieldMetadataIdComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerCalendarFieldMetadataIdComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const viewPickerCalendarFieldMetadataIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'viewPickerCalendarFieldMetadataIdComponentState', defaultValue: '', componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerInputNameComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerInputNameComponentState.ts index c80c7bd948..a844067893 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerInputNameComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerInputNameComponentState.ts @@ -1,10 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; -export const viewPickerInputNameComponentState = createComponentStateV2( - { +export const viewPickerInputNameComponentState = + createAtomComponentState({ key: 'viewPickerInputNameComponentState', defaultValue: '', componentInstanceContext: ViewComponentInstanceContext, - }, -); + }); diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsDirtyComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsDirtyComponentState.ts index be881283ba..c2f69d050b 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsDirtyComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsDirtyComponentState.ts @@ -1,8 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; -export const viewPickerIsDirtyComponentState = createComponentStateV2({ - key: 'viewPickerIsDirtyComponentState', - defaultValue: false, - componentInstanceContext: ViewComponentInstanceContext, -}); +export const viewPickerIsDirtyComponentState = + createAtomComponentState({ + key: 'viewPickerIsDirtyComponentState', + defaultValue: false, + componentInstanceContext: ViewComponentInstanceContext, + }); diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsPersistingComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsPersistingComponentState.ts index ec321e2dad..899f2679fa 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsPersistingComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerIsPersistingComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const viewPickerIsPersistingComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'viewPickerIsPersistingComponentState', defaultValue: false, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerMainGroupByFieldMetadataIdComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerMainGroupByFieldMetadataIdComponentState.ts index 01bf81811b..ab2ce4303c 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerMainGroupByFieldMetadataIdComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerMainGroupByFieldMetadataIdComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const viewPickerMainGroupByFieldMetadataIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'viewPickerMainGroupByFieldMetadataIdComponentState', defaultValue: '', componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerModeComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerModeComponentState.ts index 6ede272f8f..720a8b3262 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerModeComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerModeComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { type ViewPickerMode } from '@/views/view-picker/types/ViewPickerMode'; export const viewPickerModeComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'viewPickerModeComponentState', defaultValue: 'list', componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerReferenceViewIdComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerReferenceViewIdComponentState.ts index ee7dbbec68..5b878db14c 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerReferenceViewIdComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerReferenceViewIdComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const viewPickerReferenceViewIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'viewPickerReferenceViewIdComponentState', defaultValue: '', componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerSelectedIconComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerSelectedIconComponentState.ts index b53bb9a692..ffe796b7ba 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerSelectedIconComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerSelectedIconComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; export const viewPickerSelectedIconComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'viewPickerSelectedIconComponentState', defaultValue: '', componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerTypeComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerTypeComponentState.ts index 182c71948b..0e1161335f 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerTypeComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerTypeComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { ViewType } from '@/views/types/ViewType'; -export const viewPickerTypeComponentState = createComponentStateV2({ +export const viewPickerTypeComponentState = createAtomComponentState({ key: 'viewPickerTypeComponentState', defaultValue: ViewType.Table, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerVisibilityComponentState.ts b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerVisibilityComponentState.ts index 3e00317c53..413ae60760 100644 --- a/packages/twenty-front/src/modules/views/view-picker/states/viewPickerVisibilityComponentState.ts +++ b/packages/twenty-front/src/modules/views/view-picker/states/viewPickerVisibilityComponentState.ts @@ -1,9 +1,9 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { ViewVisibility } from '~/generated-metadata/graphql'; export const viewPickerVisibilityComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'viewPickerVisibilityComponentState', defaultValue: ViewVisibility.UNLISTED, componentInstanceContext: ViewComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/hooks/__tests__/useGetUpdatableWorkflowVersion.test.ts b/packages/twenty-front/src/modules/workflow/hooks/__tests__/useGetUpdatableWorkflowVersion.test.ts index e40af536e3..ed8032ed99 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/__tests__/useGetUpdatableWorkflowVersion.test.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/__tests__/useGetUpdatableWorkflowVersion.test.ts @@ -18,9 +18,12 @@ jest.mock('@/workflow/hooks/useCreateDraftFromWorkflowVersion', () => ({ }), })); -jest.mock('@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2', () => ({ - useRecoilComponentValueV2: jest.fn(() => mockWorkflowId), -})); +jest.mock( + '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue', + () => ({ + useAtomComponentStateValue: jest.fn(() => mockWorkflowId), + }), +); jest.mock('@/workflow/hooks/useWorkflowWithCurrentVersion', () => ({ useWorkflowWithCurrentVersion: jest.fn((workflowId) => diff --git a/packages/twenty-front/src/modules/workflow/hooks/useFlowOrThrow.ts b/packages/twenty-front/src/modules/workflow/hooks/useFlowOrThrow.ts index 8e4a609526..947475f11e 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useFlowOrThrow.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useFlowOrThrow.ts @@ -1,9 +1,9 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { flowComponentState } from '@/workflow/states/flowComponentState'; import { isDefined } from 'twenty-shared/utils'; export const useFlowOrThrow = () => { - const flow = useRecoilComponentValueV2(flowComponentState); + const flow = useAtomComponentStateValue(flowComponentState); if (!isDefined(flow)) { throw new Error('Expected the flow to be defined'); diff --git a/packages/twenty-front/src/modules/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow.ts b/packages/twenty-front/src/modules/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow.ts index f177380b06..0984319fb7 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow.ts @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCreateDraftFromWorkflowVersion } from '@/workflow/hooks/useCreateDraftFromWorkflowVersion'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -7,7 +7,7 @@ import { isDefined } from 'twenty-shared/utils'; export const useGetUpdatableWorkflowVersionOrThrow = (instanceId?: string) => { const { createDraftFromWorkflowVersion } = useCreateDraftFromWorkflowVersion(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, instanceId, ); diff --git a/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx b/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx index 7b18a8ed35..119ff3fa74 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx +++ b/packages/twenty-front/src/modules/workflow/hooks/useRunWorkflowVersion.tsx @@ -17,7 +17,7 @@ import { computeOptimisticCreateRecordBaseRecordInput } from '@/object-record/ut import { computeOptimisticRecordFromInput } from '@/object-record/utils/computeOptimisticRecordFromInput'; import { RUN_WORKFLOW_VERSION } from '@/workflow/graphql/mutations/runWorkflowVersion'; import { type WorkflowRun } from '@/workflow/types/Workflow'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useCallback } from 'react'; import { useMutation } from '@apollo/client'; import { isDefined } from 'twenty-shared/utils'; @@ -42,7 +42,7 @@ export const useRunWorkflowVersion = () => { const createOneRecordInCache = useCreateOneRecordInCache({ objectMetadataItem, }); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const [mutate] = useMutation< RunWorkflowVersionMutation, diff --git a/packages/twenty-front/src/modules/workflow/hooks/useWorkflowRunIdOrThrow.ts b/packages/twenty-front/src/modules/workflow/hooks/useWorkflowRunIdOrThrow.ts index 2e8c0fc91b..2c5e0433e1 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useWorkflowRunIdOrThrow.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useWorkflowRunIdOrThrow.ts @@ -1,9 +1,9 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowRunIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowRunIdComponentState'; import { isDefined } from 'twenty-shared/utils'; export const useWorkflowRunIdOrThrow = () => { - const workflowRunId = useRecoilComponentValueV2( + const workflowRunId = useAtomComponentStateValue( workflowVisualizerWorkflowRunIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/hooks/useWorkflowVersionIdOrThrow.ts b/packages/twenty-front/src/modules/workflow/hooks/useWorkflowVersionIdOrThrow.ts index 6b442561d3..0d8ff64712 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useWorkflowVersionIdOrThrow.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useWorkflowVersionIdOrThrow.ts @@ -1,9 +1,9 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowVersionIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowVersionIdComponentState'; import { isDefined } from 'twenty-shared/utils'; export const useWorkflowVersionIdOrThrow = () => { - const workflowVersionId = useRecoilComponentValueV2( + const workflowVersionId = useAtomComponentStateValue( workflowVisualizerWorkflowVersionIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/hooks/useWorkflowWithCurrentVersion.ts b/packages/twenty-front/src/modules/workflow/hooks/useWorkflowWithCurrentVersion.ts index b52e4d617f..92792c6625 100644 --- a/packages/twenty-front/src/modules/workflow/hooks/useWorkflowWithCurrentVersion.ts +++ b/packages/twenty-front/src/modules/workflow/hooks/useWorkflowWithCurrentVersion.ts @@ -2,8 +2,8 @@ import { useEffect } from 'react'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useFindOneRecord } from '@/object-record/hooks/useFindOneRecord'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { shouldWorkflowRefetchRequestFamilyState } from '@/workflow/states/shouldWorkflowRefetchRequestFamilyState'; import { type Workflow, @@ -21,11 +21,11 @@ type WorkflowWithAllVersions = Omit & { export const useWorkflowWithCurrentVersion = ( workflowId: string | undefined, ): WorkflowWithCurrentVersion | undefined => { - const shouldWorkflowRefetchRequest = useFamilyRecoilValueV2( + const shouldWorkflowRefetchRequest = useAtomFamilyStateValue( shouldWorkflowRefetchRequestFamilyState, workflowId ?? '', ); - const setShouldWorkflowRefetchRequest = useSetFamilyRecoilStateV2( + const setShouldWorkflowRefetchRequest = useSetAtomFamilyState( shouldWorkflowRefetchRequestFamilyState, workflowId ?? '', ); diff --git a/packages/twenty-front/src/modules/workflow/states/flowComponentState.ts b/packages/twenty-front/src/modules/workflow/states/flowComponentState.ts index 422feb8385..70eff23392 100644 --- a/packages/twenty-front/src/modules/workflow/states/flowComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/states/flowComponentState.ts @@ -1,11 +1,11 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { type WorkflowAction, type WorkflowTrigger, } from '@/workflow/types/Workflow'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const flowComponentState = createComponentStateV2< +export const flowComponentState = createAtomComponentState< | { workflowVersionId: string; trigger: WorkflowTrigger | null; diff --git a/packages/twenty-front/src/modules/workflow/states/selectors/stepSelector.ts b/packages/twenty-front/src/modules/workflow/states/selectors/stepSelector.ts index 6c7f2fb25d..f94a41924b 100644 --- a/packages/twenty-front/src/modules/workflow/states/selectors/stepSelector.ts +++ b/packages/twenty-front/src/modules/workflow/states/selectors/stepSelector.ts @@ -1,11 +1,11 @@ -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { flowComponentState } from '@/workflow/states/flowComponentState'; import type { WorkflowAction } from '@/workflow/types/Workflow'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; import { isDefined } from 'twenty-shared/utils'; export const createStepSelector = (stepId: string) => - createComponentSelectorV2({ + createAtomComponentSelector({ key: `stepSelector-${stepId}`, get: (componentStateKey) => diff --git a/packages/twenty-front/src/modules/workflow/states/selectors/stepsOutputSchemaFamilySelector.ts b/packages/twenty-front/src/modules/workflow/states/selectors/stepsOutputSchemaFamilySelector.ts index 2b7987ffe6..6fa33909a0 100644 --- a/packages/twenty-front/src/modules/workflow/states/selectors/stepsOutputSchemaFamilySelector.ts +++ b/packages/twenty-front/src/modules/workflow/states/selectors/stepsOutputSchemaFamilySelector.ts @@ -1,10 +1,10 @@ -import { createFamilySelectorV2 } from '@/ui/utilities/state/jotai/utils/createFamilySelectorV2'; +import { createAtomFamilySelector } from '@/ui/utilities/state/jotai/utils/createAtomFamilySelector'; import { getStepOutputSchemaFamilyStateKey } from '@/workflow/utils/getStepOutputSchemaFamilyStateKey'; import { stepsOutputSchemaFamilyState } from '@/workflow/workflow-variables/states/stepsOutputSchemaFamilyState'; import { type StepOutputSchemaV2 } from '@/workflow/workflow-variables/types/StepOutputSchemaV2'; import { isDefined } from 'twenty-shared/utils'; -export const stepsOutputSchemaFamilySelector = createFamilySelectorV2< +export const stepsOutputSchemaFamilySelector = createAtomFamilySelector< StepOutputSchemaV2[], { workflowVersionId: string; stepIds: string[] } >({ diff --git a/packages/twenty-front/src/modules/workflow/states/shouldWorkflowRefetchRequestFamilyState.ts b/packages/twenty-front/src/modules/workflow/states/shouldWorkflowRefetchRequestFamilyState.ts index 646c0c60c8..54c728d5c8 100644 --- a/packages/twenty-front/src/modules/workflow/states/shouldWorkflowRefetchRequestFamilyState.ts +++ b/packages/twenty-front/src/modules/workflow/states/shouldWorkflowRefetchRequestFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const shouldWorkflowRefetchRequestFamilyState = createFamilyStateV2< +export const shouldWorkflowRefetchRequestFamilyState = createAtomFamilyState< boolean, string >({ diff --git a/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdComponentState.ts b/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdComponentState.ts index f1696cec50..ff0703a17a 100644 --- a/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/states/workflowLastCreatedStepIdComponentState.ts @@ -1,7 +1,7 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const workflowLastCreatedStepIdComponentState = createComponentStateV2< +export const workflowLastCreatedStepIdComponentState = createAtomComponentState< string | undefined >({ key: 'workflowLastCreatedStepIdComponentState', diff --git a/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowIdComponentState.ts b/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowIdComponentState.ts index 6fb77afffa..36414a95c8 100644 --- a/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowIdComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowIdComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; export const workflowVisualizerWorkflowIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowVisualizerWorkflowIdComponentState', defaultValue: undefined, componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowRunIdComponentState.ts b/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowRunIdComponentState.ts index bee706400b..12dfe67980 100644 --- a/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowRunIdComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowRunIdComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; export const workflowVisualizerWorkflowRunIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowVisualizerWorkflowRunIdComponentState', defaultValue: undefined, componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowVersionIdComponentState.ts b/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowVersionIdComponentState.ts index 1b78268b39..b92db338ed 100644 --- a/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowVersionIdComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/states/workflowVisualizerWorkflowVersionIdComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; export const workflowVisualizerWorkflowVersionIdComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowVisualizerWorkflowVersionIdComponentState', defaultValue: undefined, componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx index 361acb3076..0e119e7e05 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase.tsx @@ -2,9 +2,9 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { commandMenuWidthState } from '@/command-menu/states/commandMenuWidthState'; import { isCommandMenuOpenedStateV2 } from '@/command-menu/states/isCommandMenuOpenedStateV2'; import { useListenToSidePanelClosing } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelClosing'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { WorkflowDiagramRightClickCommandMenu } from '@/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenu'; import { WORKFLOW_DIAGRAM_EMPTY_NODE_DEFINITION } from '@/workflow/workflow-diagram/constants/WorkflowDiagramEmptyNodeDefinition'; import { useResetWorkflowInsertStepIds } from '@/workflow/workflow-diagram/hooks/useResetWorkflowInsertStepIds'; @@ -60,7 +60,7 @@ import React, { useRef, useState, } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { Tag, type TagColor } from 'twenty-ui/components'; import { useStore } from 'jotai'; @@ -170,31 +170,31 @@ export const WorkflowDiagramCanvasBase = ({ const reactflow = useReactFlow(); - const currentWorkflowDiagram = useRecoilComponentValueV2( + const currentWorkflowDiagram = useAtomComponentStateValue( workflowDiagramComponentState, ); - const workflowDiagramPanOnDrag = useRecoilComponentValueV2( + const workflowDiagramPanOnDrag = useAtomComponentStateValue( workflowDiagramPanOnDragComponentState, ); - const workflowDiagram = useRecoilComponentStateCallbackStateV2( + const workflowDiagram = useAtomComponentStateCallbackState( workflowDiagramComponentState, ); - const setWorkflowDiagram = useSetRecoilComponentStateV2( + const setWorkflowDiagram = useSetAtomComponentState( workflowDiagramComponentState, ); - const setWorkflowSelectedNode = useSetRecoilComponentStateV2( + const setWorkflowSelectedNode = useSetAtomComponentState( workflowSelectedNodeComponentState, ); const { resetWorkflowInsertStepIds } = useResetWorkflowInsertStepIds(); const workflowDiagramWaitingNodesDimensions = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( workflowDiagramWaitingNodesDimensionsComponentState, ); - const setWorkflowDiagramWaitingNodesDimensions = useSetRecoilComponentStateV2( + const setWorkflowDiagramWaitingNodesDimensions = useSetAtomComponentState( workflowDiagramWaitingNodesDimensionsComponentState, ); - const workflowInsertStepIds = useRecoilComponentValueV2( + const workflowInsertStepIds = useAtomComponentStateValue( workflowInsertStepIdsComponentState, ); @@ -257,7 +257,7 @@ export const WorkflowDiagramCanvasBase = ({ return { nodes, edges }; }, [currentWorkflowDiagram, workflowInsertStepIds]); - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); const { isInRightDrawer } = useContext(ActionMenuContext); const handleEdgesChange = ( diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditable.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditable.tsx index e4b7fd1701..e266235d32 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditable.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramCanvasEditable.tsx @@ -1,5 +1,5 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { WorkflowDiagramCanvasBase } from '@/workflow/workflow-diagram/components/WorkflowDiagramCanvasBase'; @@ -35,7 +35,7 @@ import React, { useCallback } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const WorkflowDiagramCanvasEditable = () => { - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); @@ -43,11 +43,11 @@ export const WorkflowDiagramCanvasEditable = () => { workflowVisualizerWorkflowId, ); - const setWorkflowDiagram = useSetRecoilComponentStateV2( + const setWorkflowDiagram = useSetAtomComponentState( workflowDiagramComponentState, ); - const setWorkflowDiagramRightClickMenuPosition = useSetRecoilComponentStateV2( + const setWorkflowDiagramRightClickMenuPosition = useSetAtomComponentState( workflowDiagramRightClickMenuPositionState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramEffect.tsx index e1ce38f7a7..ab96e5c77c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramEffect.tsx @@ -1,6 +1,6 @@ -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { flowComponentState } from '@/workflow/states/flowComponentState'; import { workflowLastCreatedStepIdComponentState } from '@/workflow/states/workflowLastCreatedStepIdComponentState'; @@ -16,7 +16,7 @@ import { useCallback, useEffect } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const WorkflowDiagramEffect = () => { - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); @@ -24,13 +24,13 @@ export const WorkflowDiagramEffect = () => { workflowVisualizerWorkflowId, ); - const workflowDiagram = useRecoilComponentStateCallbackStateV2( + const workflowDiagram = useAtomComponentStateCallbackState( workflowDiagramComponentState, ); - const setFlow = useSetRecoilComponentStateV2(flowComponentState); + const setFlow = useSetAtomComponentState(flowComponentState); const { populateStepsOutputSchema } = useStepsOutputSchema(); - const workflowLastCreatedStepId = useRecoilComponentStateCallbackStateV2( + const workflowLastCreatedStepId = useAtomComponentStateCallbackState( workflowLastCreatedStepIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenu.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenu.tsx index fba494d818..d55f6aa411 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenu.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenu.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useCloseRightClickMenu } from '@/workflow/workflow-diagram/hooks/useCloseRightClickMenu'; import { useStartNodeCreation } from '@/workflow/workflow-diagram/hooks/useStartNodeCreation'; import { useWorkflowDiagramScreenToFlowPosition } from '@/workflow/workflow-diagram/hooks/useWorkflowDiagramScreenToFlowPosition'; @@ -37,7 +37,7 @@ export const WorkflowDiagramRightClickCommandMenu = () => { const { closeRightClickMenu } = useCloseRightClickMenu(); - const workflowDiagramRightClickMenuPosition = useRecoilComponentValueV2( + const workflowDiagramRightClickMenuPosition = useAtomComponentStateValue( workflowDiagramRightClickMenuPositionState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenuClickOutsideEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenuClickOutsideEffect.tsx index ccdb602c27..43d438d8f5 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenuClickOutsideEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowDiagramRightClickCommandMenuClickOutsideEffect.tsx @@ -1,6 +1,6 @@ import { COMMAND_MENU_CLICK_OUTSIDE_ID } from '@/command-menu/constants/CommandMenuClickOutsideId'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { WORKFLOW_DIAGRAM_RIGHT_CLICK_MENU_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramRightClickMenuClickOutsideId'; import { workflowDiagramRightClickMenuPositionState } from '@/workflow/workflow-diagram/states/workflowDiagramRightClickMenuPositionState'; @@ -9,7 +9,7 @@ export const WorkflowDiagramRightClickCommandMenuClickOutsideEffect = ({ }: { rightClickCommandMenuRef: React.RefObject; }) => { - const setWorkflowDiagramRightClickMenuPosition = useSetRecoilComponentStateV2( + const setWorkflowDiagramRightClickMenuPosition = useSetAtomComponentState( workflowDiagramRightClickMenuPositionState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizer.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizer.tsx index 45b8e39045..0616212f50 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizer.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizer.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { WorkflowRunDiagramCanvas } from '@/workflow/workflow-diagram/components/WorkflowRunDiagramCanvas'; import { workflowDiagramStatusComponentState } from '@/workflow/workflow-diagram/states/workflowDiagramStatusComponentState'; @@ -10,7 +10,7 @@ export const WorkflowRunVisualizer = ({ workflowRunId: string; }) => { const workflowRun = useWorkflowRun({ workflowRunId }); - const workflowDiagramStatus = useRecoilComponentValueV2( + const workflowDiagramStatus = useAtomComponentStateValue( workflowDiagramStatusComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx index ce5a2722c7..0b27af8750 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowRunVisualizerEffect.tsx @@ -1,7 +1,7 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowVersion } from '@/workflow/hooks/useWorkflowVersion'; import { flowComponentState } from '@/workflow/states/flowComponentState'; @@ -30,36 +30,36 @@ export const WorkflowRunVisualizerEffect = ({ const { getIcon } = useIcons(); const workflowRun = useWorkflowRun({ workflowRunId }); - const setWorkflowRunId = useSetRecoilComponentStateV2( + const setWorkflowRunId = useSetAtomComponentState( workflowVisualizerWorkflowRunIdComponentState, ); const workflowVersionId = workflowRun?.workflowVersionId; const workflowVersion = useWorkflowVersion(workflowVersionId); - const setWorkflowVisualizerWorkflowVersionId = useSetRecoilComponentStateV2( + const setWorkflowVisualizerWorkflowVersionId = useSetAtomComponentState( workflowVisualizerWorkflowVersionIdComponentState, ); - const workflowVisualizerWorkflowId = useRecoilComponentStateCallbackStateV2( + const workflowVisualizerWorkflowId = useAtomComponentStateCallbackState( workflowVisualizerWorkflowIdComponentState, ); - const setWorkflowVisualizerWorkflowId = useSetRecoilComponentStateV2( + const setWorkflowVisualizerWorkflowId = useSetAtomComponentState( workflowVisualizerWorkflowIdComponentState, ); - const flow = useRecoilComponentStateCallbackStateV2(flowComponentState); - const workflowDiagram = useRecoilComponentStateCallbackStateV2( + const flow = useAtomComponentStateCallbackState(flowComponentState); + const workflowDiagram = useAtomComponentStateCallbackState( workflowDiagramComponentState, ); - const workflowSelectedNode = useRecoilComponentStateCallbackStateV2( + const workflowSelectedNode = useAtomComponentStateCallbackState( workflowSelectedNodeComponentState, ); - const workflowDiagramStatusState = useRecoilComponentStateCallbackStateV2( + const workflowDiagramStatusState = useAtomComponentStateCallbackState( workflowDiagramStatusComponentState, ); const workflowRunDiagramAutomaticallyOpenedStepsState = - useRecoilComponentStateCallbackStateV2( + useAtomComponentStateCallbackState( workflowRunDiagramAutomaticallyOpenedStepsComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowSSESubscribeEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowSSESubscribeEffect.tsx index 3f0dbaf15b..9bde4125cf 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowSSESubscribeEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowSSESubscribeEffect.tsx @@ -4,7 +4,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useListenToObjectRecordOperationBrowserEvent } from '@/browser-event/hooks/useListenToObjectRecordOperationBrowserEvent'; import { useListenToEventsForQuery } from '@/sse-db-event/hooks/useListenToEventsForQuery'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { shouldWorkflowRefetchRequestFamilyState } from '@/workflow/states/shouldWorkflowRefetchRequestFamilyState'; export const WorkflowSSESubscribeEffect = ({ @@ -14,7 +14,7 @@ export const WorkflowSSESubscribeEffect = ({ }) => { const queryId = `workflow-versions-for-workflow-${workflowId}`; - const setShouldWorkflowRefetchRequest = useSetFamilyRecoilStateV2( + const setShouldWorkflowRefetchRequest = useSetAtomFamilyState( shouldWorkflowRefetchRequestFamilyState, workflowId, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionVisualizerEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionVisualizerEffect.tsx index 5c169a4cec..142f6834c6 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionVisualizerEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVersionVisualizerEffect.tsx @@ -1,4 +1,4 @@ -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useWorkflowVersion } from '@/workflow/hooks/useWorkflowVersion'; import { flowComponentState } from '@/workflow/states/flowComponentState'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -16,14 +16,14 @@ export const WorkflowVersionVisualizerEffect = ({ }) => { const workflowVersion = useWorkflowVersion(workflowVersionId); - const setFlow = useSetRecoilComponentStateV2(flowComponentState); - const setWorkflowDiagram = useSetRecoilComponentStateV2( + const setFlow = useSetAtomComponentState(flowComponentState); + const setWorkflowDiagram = useSetAtomComponentState( workflowDiagramComponentState, ); - const setWorkflowVisualizerWorkflowId = useSetRecoilComponentStateV2( + const setWorkflowVisualizerWorkflowId = useSetAtomComponentState( workflowVisualizerWorkflowIdComponentState, ); - const setWorkflowVisualizerWorkflowVersionId = useSetRecoilComponentStateV2( + const setWorkflowVisualizerWorkflowVersionId = useSetAtomComponentState( workflowVisualizerWorkflowVersionIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVisualizerEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVisualizerEffect.tsx index fea6df2068..7ce69a004c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVisualizerEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/components/WorkflowVisualizerEffect.tsx @@ -1,4 +1,4 @@ -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { workflowVisualizerWorkflowVersionIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowVersionIdComponentState'; @@ -10,10 +10,10 @@ export const WorkflowVisualizerEffect = ({ }: { workflowId: string; }) => { - const setWorkflowVisualizerWorkflowId = useSetRecoilComponentStateV2( + const setWorkflowVisualizerWorkflowId = useSetAtomComponentState( workflowVisualizerWorkflowIdComponentState, ); - const setWorkflowVisualizerWorkflowVersionId = useSetRecoilComponentStateV2( + const setWorkflowVisualizerWorkflowVersionId = useSetAtomComponentState( workflowVisualizerWorkflowVersionIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useCloseRightClickMenu.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useCloseRightClickMenu.ts index d69757eb8e..b733547fd1 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useCloseRightClickMenu.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useCloseRightClickMenu.ts @@ -1,8 +1,8 @@ -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { workflowDiagramRightClickMenuPositionState } from '@/workflow/workflow-diagram/states/workflowDiagramRightClickMenuPositionState'; export const useCloseRightClickMenu = () => { - const setWorkflowDiagramRightClickMenuPosition = useSetRecoilComponentStateV2( + const setWorkflowDiagramRightClickMenuPosition = useSetAtomComponentState( workflowDiagramRightClickMenuPositionState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useResetWorkflowInsertStepIds.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useResetWorkflowInsertStepIds.ts index 1569d2215e..bd2d2a1cbf 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useResetWorkflowInsertStepIds.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useResetWorkflowInsertStepIds.ts @@ -1,9 +1,9 @@ -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { workflowInsertStepIdsComponentState } from '@/workflow/workflow-steps/states/workflowInsertStepIdsComponentState'; import { useCallback } from 'react'; export const useResetWorkflowInsertStepIds = () => { - const setWorkflowInsertStepIds = useSetRecoilComponentStateV2( + const setWorkflowInsertStepIds = useSetAtomComponentState( workflowInsertStepIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts index 73cc44719e..7940999947 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useRightDrawerState.ts @@ -1,13 +1,13 @@ import { isCommandMenuOpenedStateV2 } from '@/command-menu/states/isCommandMenuOpenedStateV2'; import { type CommandMenuAnimationVariant } from '@/command-menu/types/CommandMenuAnimationVariant'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsMobile } from 'twenty-ui/utilities'; export const useRightDrawerState = (): { rightDrawerState: CommandMenuAnimationVariant; } => { const isMobile = useIsMobile(); - const isCommandMenuOpened = useRecoilValueV2(isCommandMenuOpenedStateV2); + const isCommandMenuOpened = useAtomStateValue(isCommandMenuOpenedStateV2); if (isMobile) { return { diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts index d9897adc31..ab8969e3b5 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/hooks/useStartNodeCreation.ts @@ -1,14 +1,14 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; import { type StartNodeCreationParams } from '@/workflow/workflow-diagram/types/WorkflowDiagram'; import { workflowInsertStepIdsComponentState } from '@/workflow/workflow-steps/states/workflowInsertStepIdsComponentState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useCallback, useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -16,19 +16,19 @@ export const useStartNodeCreation = () => { const { isInRightDrawer } = useContext(ActionMenuContext); const [workflowInsertStepIds, setWorkflowInsertStepIds] = - useRecoilComponentStateV2(workflowInsertStepIdsComponentState); + useAtomComponentState(workflowInsertStepIdsComponentState); - const setWorkflowSelectedNode = useSetRecoilComponentStateV2( + const setWorkflowSelectedNode = useSetAtomComponentState( workflowSelectedNodeComponentState, ); const { openWorkflowCreateStepInCommandMenu } = useWorkflowCommandMenu(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramComponentState.ts index 1fd486f308..0134e98659 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; import { type WorkflowDiagram } from '@/workflow/workflow-diagram/types/WorkflowDiagram'; -export const workflowDiagramComponentState = createComponentStateV2< +export const workflowDiagramComponentState = createAtomComponentState< WorkflowDiagram | undefined >({ key: 'workflowDiagramComponentState', diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramPanOnDragComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramPanOnDragComponentState.ts index 42fd0ae3d0..b2d4191feb 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramPanOnDragComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramPanOnDragComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; export const workflowDiagramPanOnDragComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowDiagramPanOnDragComponentState', defaultValue: true, componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramRightClickMenuPositionState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramRightClickMenuPositionState.ts index 4a24bafadb..0abd576dc3 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramRightClickMenuPositionState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramRightClickMenuPositionState.ts @@ -1,4 +1,4 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; type WorkflowDiagramRightClickMenuPositionState = @@ -9,7 +9,7 @@ type WorkflowDiagramRightClickMenuPositionState = | undefined; export const workflowDiagramRightClickMenuPositionState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowDiagramRightClickMenuPositionState', defaultValue: undefined, componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramStatusComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramStatusComponentState.ts index 6401fe7165..fcfded5149 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramStatusComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramStatusComponentState.ts @@ -1,11 +1,11 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowRunVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowRunVisualizerComponentInstanceContext'; import { type WorkflowDiagramStatus } from '@/workflow/workflow-diagram/types/WorkflowDiagramStatus'; // This state must be fresh every time the Reactflow component is mounted. // We use another instance context whose instanceId is an id unique to the component hierarchy. export const workflowDiagramStatusComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowDiagramStatusComponentState', defaultValue: 'computing-diagram', componentInstanceContext: WorkflowRunVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramWaitingNodesDimensionsComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramWaitingNodesDimensionsComponentState.ts index fa8d2271f4..56868c638b 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramWaitingNodesDimensionsComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowDiagramWaitingNodesDimensionsComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; export const workflowDiagramWaitingNodesDimensionsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowDiagramWaitingNodesDimensionsComponentState', defaultValue: false, componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts index 8d3f9d546e..67d9aadec0 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowRunDiagramAutomaticallyOpenedStepsComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; export const workflowRunDiagramAutomaticallyOpenedStepsComponentState = - createComponentStateV2<{ stepId: string; isInRightDrawer: boolean }[]>({ + createAtomComponentState<{ stepId: string; isInRightDrawer: boolean }[]>({ key: 'workflowRunDiagramAutomaticallyOpenedStepsComponentState', defaultValue: [], componentInstanceContext: WorkflowVisualizerComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowSelectedNodeComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowSelectedNodeComponentState.ts index 8dddf9d8ec..4ba9528b8c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowSelectedNodeComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/states/workflowSelectedNodeComponentState.ts @@ -1,7 +1,7 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; -export const workflowSelectedNodeComponentState = createComponentStateV2< +export const workflowSelectedNodeComponentState = createAtomComponentState< string | undefined >({ key: 'workflowSelectedNodeComponentState', diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/hooks/useEdgeState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/hooks/useEdgeState.ts index e4edc89001..89649dd2a6 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/hooks/useEdgeState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/hooks/useEdgeState.ts @@ -1,4 +1,4 @@ -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { EDGE_BRANCH_ARROW_MARKER } from '@/workflow/workflow-diagram/workflow-edges/constants/EdgeBranchArrowMarker'; import { workflowHoveredEdgeComponentState } from '@/workflow/workflow-diagram/workflow-edges/states/workflowHoveredEdgeComponentState'; import { workflowSelectedEdgeComponentState } from '@/workflow/workflow-diagram/workflow-edges/states/workflowSelectedEdgeComponentState'; @@ -8,11 +8,13 @@ import { useReactFlow } from '@xyflow/react'; export const useEdgeState = () => { const reactflow = useReactFlow(); - const [workflowSelectedEdge, setWorkflowSelectedEdge] = - useRecoilComponentStateV2(workflowSelectedEdgeComponentState); + const [workflowSelectedEdge, setWorkflowSelectedEdge] = useAtomComponentState( + workflowSelectedEdgeComponentState, + ); - const [workflowHoveredEdge, setWorkflowHoveredEdge] = - useRecoilComponentStateV2(workflowHoveredEdgeComponentState); + const [workflowHoveredEdge, setWorkflowHoveredEdge] = useAtomComponentState( + workflowHoveredEdgeComponentState, + ); const isSourceSelected = ({ nodeId, diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowHoveredEdgeComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowHoveredEdgeComponentState.ts index 469d40d804..324d42e124 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowHoveredEdgeComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowHoveredEdgeComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; import { type WorkflowDiagramEdgeDescriptor } from '@/workflow/workflow-diagram/workflow-edges/types/WorkflowDiagramEdgeDescriptor'; -export const workflowHoveredEdgeComponentState = createComponentStateV2< +export const workflowHoveredEdgeComponentState = createAtomComponentState< WorkflowDiagramEdgeDescriptor | undefined >({ key: 'workflowHoveredEdgeComponentState', diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowSelectedEdgeComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowSelectedEdgeComponentState.ts index 0c1b0bcc86..a669ff65b1 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowSelectedEdgeComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-edges/states/workflowSelectedEdgeComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; import { type WorkflowDiagramEdgeDescriptor } from '@/workflow/workflow-diagram/workflow-edges/types/WorkflowDiagramEdgeDescriptor'; -export const workflowSelectedEdgeComponentState = createComponentStateV2< +export const workflowSelectedEdgeComponentState = createAtomComponentState< WorkflowDiagramEdgeDescriptor | undefined >({ key: 'workflowSelectedEdgeComponentState', diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx index 393884a489..cf2a7dd081 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerEditable.tsx @@ -1,8 +1,8 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { WORKFLOW_DIAGRAM_STEP_NODE_BASE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramStepNodeClickOutsideId'; import { useResetWorkflowInsertStepIds } from '@/workflow/workflow-diagram/hooks/useResetWorkflowInsertStepIds'; @@ -14,7 +14,7 @@ import { WorkflowNodeLabelWithCounterPart } from '@/workflow/workflow-diagram/wo import { WorkflowNodeRightPart } from '@/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeRightPart'; import { WorkflowNodeTitle } from '@/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeTitle'; import { useLingui } from '@lingui/react/macro'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; @@ -23,16 +23,17 @@ export const WorkflowDiagramEmptyTriggerEditable = ({ id }: { id: string }) => { const { openWorkflowTriggerTypeInCommandMenu } = useWorkflowCommandMenu(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const [workflowSelectedNode, setWorkflowSelectedNode] = - useRecoilComponentStateV2(workflowSelectedNodeComponentState); + const [workflowSelectedNode, setWorkflowSelectedNode] = useAtomComponentState( + workflowSelectedNodeComponentState, + ); const { isInRightDrawer } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx index 5d9ba79907..9939279b79 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramEmptyTriggerReadonly.tsx @@ -1,8 +1,8 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { workflowVisualizerWorkflowVersionIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowVersionIdComponentState'; import { WORKFLOW_DIAGRAM_STEP_NODE_BASE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramStepNodeClickOutsideId'; @@ -14,7 +14,7 @@ import { WorkflowNodeLabelWithCounterPart } from '@/workflow/workflow-diagram/wo import { WorkflowNodeRightPart } from '@/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeRightPart'; import { WorkflowNodeTitle } from '@/workflow/workflow-diagram/workflow-nodes/components/WorkflowNodeTitle'; import { useLingui } from '@lingui/react/macro'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { TRIGGER_STEP_ID } from 'twenty-shared/workflow'; @@ -24,21 +24,22 @@ export const WorkflowDiagramEmptyTriggerReadonly = ({ id }: { id: string }) => { const { getIcon } = useIcons(); const { t } = useLingui(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const workflowVisualizerWorkflowVersionId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowVersionId = useAtomComponentStateValue( workflowVisualizerWorkflowVersionIdComponentState, ); - const [workflowSelectedNode, setWorkflowSelectedNode] = - useRecoilComponentStateV2(workflowSelectedNodeComponentState); + const [workflowSelectedNode, setWorkflowSelectedNode] = useAtomComponentState( + workflowSelectedNodeComponentState, + ); const { isInRightDrawer } = useContext(ActionMenuContext); const { openWorkflowViewStepInCommandMenu } = useWorkflowCommandMenu(); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx index 1db6857aaf..b9ca3c0ca5 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditable.tsx @@ -1,15 +1,15 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { useResetWorkflowInsertStepIds } from '@/workflow/workflow-diagram/hooks/useResetWorkflowInsertStepIds'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; import { type WorkflowDiagramStepNodeData } from '@/workflow/workflow-diagram/types/WorkflowDiagram'; import { getWorkflowNodeIconKey } from '@/workflow/workflow-diagram/utils/getWorkflowNodeIconKey'; import { WorkflowDiagramStepNodeEditableContent } from '@/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditableContent'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useContext } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; @@ -23,12 +23,13 @@ export const WorkflowDiagramStepNodeEditable = ({ }) => { const { getIcon } = useIcons(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const [workflowSelectedNode, setWorkflowSelectedNode] = - useRecoilComponentStateV2(workflowSelectedNodeComponentState); + const [workflowSelectedNode, setWorkflowSelectedNode] = useAtomComponentState( + workflowSelectedNodeComponentState, + ); const selected = workflowSelectedNode === id; @@ -38,7 +39,7 @@ export const WorkflowDiagramStepNodeEditable = ({ const { isInRightDrawer } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditableContent.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditableContent.tsx index fd79b6fd52..1f7f4f0a2f 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditableContent.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeEditableContent.tsx @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { WorkflowDiagramCreateStepElement } from '@/workflow/workflow-diagram/components/WorkflowDiagramCreateStepElement'; import { EMPTY_NODE_ID } from '@/workflow/workflow-diagram/constants/EmptyNodeId'; import { WORKFLOW_DIAGRAM_STEP_NODE_BASE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramStepNodeClickOutsideId'; @@ -64,7 +64,7 @@ export const WorkflowDiagramStepNodeEditableContent = ({ const { isNodeCreationStarted } = useStartNodeCreation(); - const workflowInsertStepIds = useRecoilComponentValueV2( + const workflowInsertStepIds = useAtomComponentStateValue( workflowInsertStepIdsComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx index f9bfbb4b06..5a493d521f 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowDiagramStepNodeReadonly.tsx @@ -1,8 +1,8 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { workflowVisualizerWorkflowVersionIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowVersionIdComponentState'; import { WORKFLOW_DIAGRAM_STEP_NODE_BASE_CLICK_OUTSIDE_ID } from '@/workflow/workflow-diagram/constants/WorkflowDiagramStepNodeClickOutsideId'; @@ -21,7 +21,7 @@ import { WorkflowNodeTitle } from '@/workflow/workflow-diagram/workflow-nodes/co import { WORKFLOW_DIAGRAM_NODE_DEFAULT_SOURCE_HANDLE_ID } from '@/workflow/workflow-diagram/workflow-nodes/constants/WorkflowDiagramNodeDefaultSourceHandleId'; import { isNodeTitleHighlighted } from '@/workflow/workflow-diagram/workflow-nodes/utils/isNodeTitleHighlighted'; import { Position } from '@xyflow/react'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useContext } from 'react'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { useIcons } from 'twenty-ui/display'; @@ -35,15 +35,16 @@ export const WorkflowDiagramStepNodeReadonly = ({ }) => { const { getIcon } = useIcons(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const workflowVisualizerWorkflowVersionId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowVersionId = useAtomComponentStateValue( workflowVisualizerWorkflowVersionIdComponentState, ); - const [workflowSelectedNode, setWorkflowSelectedNode] = - useRecoilComponentStateV2(workflowSelectedNodeComponentState); + const [workflowSelectedNode, setWorkflowSelectedNode] = useAtomComponentState( + workflowSelectedNodeComponentState, + ); const selected = workflowSelectedNode === id; @@ -51,7 +52,7 @@ export const WorkflowDiagramStepNodeReadonly = ({ const { isInRightDrawer } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx index e59b4c9e1a..3c63724892 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-diagram/workflow-nodes/components/WorkflowRunDiagramStepNode.tsx @@ -1,8 +1,8 @@ import { ActionMenuContext } from '@/action-menu/contexts/ActionMenuContext'; import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -26,7 +26,7 @@ import { getNodeIterationCount } from '@/workflow/workflow-diagram/workflow-node import { css, useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { Position } from '@xyflow/react'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useContext } from 'react'; import { capitalize, isDefined } from 'twenty-shared/utils'; import { StepStatus } from 'twenty-shared/workflow'; @@ -87,13 +87,14 @@ export const WorkflowRunDiagramStepNode = ({ const { getIcon } = useIcons(); const theme = useTheme(); - const workflowId = useRecoilComponentValueV2( + const workflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); const workflowRunId = useWorkflowRunIdOrThrow(); - const [workflowSelectedNode, setWorkflowSelectedNode] = - useRecoilComponentStateV2(workflowSelectedNodeComponentState); + const [workflowSelectedNode, setWorkflowSelectedNode] = useAtomComponentState( + workflowSelectedNodeComponentState, + ); const selected = workflowSelectedNode === id; @@ -101,7 +102,7 @@ export const WorkflowRunDiagramStepNode = ({ const { isInRightDrawer } = useContext(ActionMenuContext); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx index 48b6782a83..a46f17776e 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowRunStepInputDetail.tsx @@ -1,5 +1,5 @@ import { workflowRunIteratorSubStepIterationIndexComponentState } from '@/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow'; import { getStepDefinitionOrThrow } from '@/workflow/utils/getStepDefinitionOrThrow'; @@ -29,7 +29,7 @@ export const WorkflowRunStepInputDetail = ({ stepId }: { stepId: string }) => { (step) => step.id === stepId, ); - const workflowRunIteratorSubStepIterationIndex = useRecoilComponentValueV2( + const workflowRunIteratorSubStepIterationIndex = useAtomComponentStateValue( workflowRunIteratorSubStepIterationIndexComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx index 0b182fe1ec..f6ad430b46 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/components/WorkflowStepFooter.tsx @@ -5,10 +5,10 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { RightDrawerFooter } from '@/ui/layout/right-drawer/components/RightDrawerFooter'; import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem'; import { selectedItemIdComponentState } from '@/ui/layout/selectable-list/states/selectedItemIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useDeleteStep } from '@/workflow/workflow-steps/hooks/useDeleteStep'; import { useDuplicateStep } from '@/workflow/workflow-steps/hooks/useDuplicateStep'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { workflowAiAgentActionAgentStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2'; import { useLingui } from '@lingui/react/macro'; import { useId } from 'react'; @@ -44,7 +44,7 @@ export const WorkflowStepFooter = ({ } = useWorkflowCommandMenu(); const { deleteStep } = useDeleteStep(); const navigateSettings = useNavigateSettings(); - const workflowAiAgentActionAgent = useRecoilValueV2( + const workflowAiAgentActionAgent = useAtomStateValue( workflowAiAgentActionAgentStateV2, ); const shouldPinDeleteButton = @@ -98,7 +98,7 @@ export const WorkflowStepFooter = ({ } }; - const selectedItemId = useRecoilComponentValueV2( + const selectedItemId = useAtomComponentStateValue( selectedItemIdComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowEditActionFilterBodyEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowEditActionFilterBodyEffect.tsx index 3c47567aff..34f3176b48 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowEditActionFilterBodyEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/components/WorkflowEditActionFilterBodyEffect.tsx @@ -1,6 +1,6 @@ -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState'; import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFiltersComponentState'; import { hasInitializedCurrentStepFilterGroupsComponentFamilyState } from '@/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFilterGroupsComponentFamilyState'; @@ -31,7 +31,7 @@ export const WorkflowEditActionFilterBodyEffect = ({ const [ hasInitializedCurrentStepFilters, setHasInitializedCurrentStepFilters, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentStepFiltersComponentFamilyState, { stepId }, ); @@ -39,23 +39,23 @@ export const WorkflowEditActionFilterBodyEffect = ({ const [ hasInitializedCurrentStepFilterGroups, setHasInitializedCurrentStepFilterGroups, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentStepFilterGroupsComponentFamilyState, { stepId }, ); - const currentStepFilters = useRecoilComponentValueV2( + const currentStepFilters = useAtomComponentStateValue( currentStepFiltersComponentState, ); - const currentStepFilterGroups = useRecoilComponentValueV2( + const currentStepFilterGroups = useAtomComponentStateValue( currentStepFilterGroupsComponentState, ); - const setCurrentStepFilters = useSetRecoilComponentStateV2( + const setCurrentStepFilters = useSetAtomComponentState( currentStepFiltersComponentState, ); - const setCurrentStepFilterGroups = useSetRecoilComponentStateV2( + const setCurrentStepFilterGroups = useSetAtomComponentState( currentStepFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.ts index edae5bb58b..ce49b056c4 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useAddRootStepFilter.ts @@ -1,5 +1,5 @@ -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; -import { useSetRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentFamilyStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; +import { useSetAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState'; import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext'; import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState'; import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFiltersComponentState'; @@ -19,22 +19,21 @@ export const useAddRootStepFilter = () => { const { stepId, onFilterSettingsUpdate } = useContext( WorkflowStepFilterContext, ); - const currentStepFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentStepFilterGroups = useAtomComponentStateCallbackState( currentStepFilterGroupsComponentState, ); - const currentStepFilters = useRecoilComponentStateCallbackStateV2( + const currentStepFilters = useAtomComponentStateCallbackState( currentStepFiltersComponentState, ); - const setHasInitializedCurrentStepFilters = - useSetRecoilComponentFamilyStateV2( - hasInitializedCurrentStepFiltersComponentFamilyState, - { stepId }, - ); + const setHasInitializedCurrentStepFilters = useSetAtomComponentFamilyState( + hasInitializedCurrentStepFiltersComponentFamilyState, + { stepId }, + ); const setHasInitializedCurrentStepFilterGroups = - useSetRecoilComponentFamilyStateV2( + useSetAtomComponentFamilyState( hasInitializedCurrentStepFilterGroupsComponentFamilyState, { stepId }, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useChildStepFiltersAndChildStepFilterGroups.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useChildStepFiltersAndChildStepFilterGroups.ts index 8a3a306078..ffd305201a 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useChildStepFiltersAndChildStepFilterGroups.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useChildStepFiltersAndChildStepFilterGroups.ts @@ -1,4 +1,4 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState'; import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFiltersComponentState'; import { type StepFilter, type StepFilterGroup } from 'twenty-shared/types'; @@ -9,11 +9,11 @@ export const useChildStepFiltersAndChildStepFilterGroups = ({ }: { stepFilterGroupId: string; }) => { - const stepFilterGroups = useRecoilComponentValueV2( + const stepFilterGroups = useAtomComponentStateValue( currentStepFilterGroupsComponentState, ); - const stepFilters = useRecoilComponentValueV2( + const stepFilters = useAtomComponentStateValue( currentStepFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useFilterCounter.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useFilterCounter.ts index 2a0922005b..06b895421b 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useFilterCounter.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useFilterCounter.ts @@ -1,11 +1,11 @@ -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { createStepSelector } from '@/workflow/states/selectors/stepSelector'; import { useMemo } from 'react'; import { isDefined } from 'twenty-shared/utils'; export const useFilterCounter = ({ stepId }: { stepId: string }) => { const stepSelector = useMemo(() => createStepSelector(stepId), [stepId]); - const step = useRecoilComponentSelectorValueV2(stepSelector); + const step = useAtomComponentSelectorValue(stepSelector); if (!isDefined(step)) { return { diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilter.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilter.ts index 318aa56382..03f4bf0ae9 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilter.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilter.ts @@ -1,4 +1,4 @@ -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState'; import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFiltersComponentState'; import { useStore } from 'jotai'; @@ -9,11 +9,11 @@ import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/sta export const useRemoveStepFilter = () => { const { onFilterSettingsUpdate } = useContext(WorkflowStepFilterContext); - const currentStepFilters = useRecoilComponentStateCallbackStateV2( + const currentStepFilters = useAtomComponentStateCallbackState( currentStepFiltersComponentState, ); - const currentStepFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentStepFilterGroups = useAtomComponentStateCallbackState( currentStepFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilterGroup.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilterGroup.ts index 81f81edf72..1eddc76dd3 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilterGroup.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useRemoveStepFilterGroup.ts @@ -1,4 +1,4 @@ -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext'; import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState'; import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFiltersComponentState'; @@ -9,11 +9,11 @@ import { isDefined } from 'twenty-shared/utils'; export const useRemoveStepFilterGroup = () => { const { onFilterSettingsUpdate } = useContext(WorkflowStepFilterContext); - const currentStepFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentStepFilterGroups = useAtomComponentStateCallbackState( currentStepFilterGroupsComponentState, ); - const currentStepFilters = useRecoilComponentStateCallbackStateV2( + const currentStepFilters = useAtomComponentStateCallbackState( currentStepFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings.ts index c320298341..fac3b9f34c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/hooks/useUpsertStepFilterSettings.ts @@ -1,4 +1,4 @@ -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { WorkflowStepFilterContext } from '@/workflow/workflow-steps/filters/states/context/WorkflowStepFilterContext'; import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState'; import { currentStepFiltersComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFiltersComponentState'; @@ -8,11 +8,11 @@ import { type StepFilter, type StepFilterGroup } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const useUpsertStepFilterSettings = () => { - const currentStepFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentStepFilterGroups = useAtomComponentStateCallbackState( currentStepFilterGroupsComponentState, ); - const currentStepFilters = useRecoilComponentStateCallbackStateV2( + const currentStepFilters = useAtomComponentStateCallbackState( currentStepFiltersComponentState, ); const { onFilterSettingsUpdate } = useContext(WorkflowStepFilterContext); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState.ts index 992a8e13f2..a3e55fe20e 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { StepFilterGroupsComponentInstanceContext } from '@/workflow/workflow-steps/filters/states/context/StepFilterGroupsComponentInstanceContext'; import { type StepFilterGroup } from 'twenty-shared/types'; -export const currentStepFilterGroupsComponentState = createComponentStateV2< +export const currentStepFilterGroupsComponentState = createAtomComponentState< StepFilterGroup[] >({ key: 'currentStepFilterGroupsComponentState', diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFiltersComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFiltersComponentState.ts index d6718d20c1..14108f6f52 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFiltersComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/currentStepFiltersComponentState.ts @@ -1,8 +1,8 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { StepFiltersComponentInstanceContext } from '@/workflow/workflow-steps/filters/states/context/StepFiltersComponentInstanceContext'; import { type StepFilter } from 'twenty-shared/types'; -export const currentStepFiltersComponentState = createComponentStateV2< +export const currentStepFiltersComponentState = createAtomComponentState< StepFilter[] >({ key: 'currentStepFiltersComponentState', diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFilterGroupsComponentFamilyState.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFilterGroupsComponentFamilyState.ts index cfb778a75f..5db9dd821e 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFilterGroupsComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFilterGroupsComponentFamilyState.ts @@ -1,8 +1,8 @@ -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { StepFilterGroupsComponentInstanceContext } from '@/workflow/workflow-steps/filters/states/context/StepFilterGroupsComponentInstanceContext'; export const hasInitializedCurrentStepFilterGroupsComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'hasInitializedCurrentStepFilterGroupsComponentFamilyState', defaultValue: false, componentInstanceContext: StepFilterGroupsComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFiltersComponentFamilyState.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFiltersComponentFamilyState.ts index 287850e3aa..dd1147b1cf 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFiltersComponentFamilyState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/hasInitializedCurrentStepFiltersComponentFamilyState.ts @@ -1,8 +1,8 @@ -import { createComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentFamilyStateV2'; +import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState'; import { StepFiltersComponentInstanceContext } from '@/workflow/workflow-steps/filters/states/context/StepFiltersComponentInstanceContext'; export const hasInitializedCurrentStepFiltersComponentFamilyState = - createComponentFamilyStateV2({ + createAtomComponentFamilyState({ key: 'hasInitializedCurrentStepFiltersComponentFamilyState', defaultValue: false, componentInstanceContext: StepFiltersComponentInstanceContext, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/rootLevelStepFilterGroupComponentSelector.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/rootLevelStepFilterGroupComponentSelector.ts index 1a0cf227f7..14c02c1506 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/rootLevelStepFilterGroupComponentSelector.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/states/rootLevelStepFilterGroupComponentSelector.ts @@ -1,11 +1,11 @@ -import { createComponentSelectorV2 } from '@/ui/utilities/state/jotai/utils/createComponentSelectorV2'; +import { createAtomComponentSelector } from '@/ui/utilities/state/jotai/utils/createAtomComponentSelector'; import { StepFilterGroupsComponentInstanceContext } from '@/workflow/workflow-steps/filters/states/context/StepFilterGroupsComponentInstanceContext'; import { currentStepFilterGroupsComponentState } from '@/workflow/workflow-steps/filters/states/currentStepFilterGroupsComponentState'; import { type StepFilterGroup } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; export const rootLevelStepFilterGroupComponentSelector = - createComponentSelectorV2({ + createAtomComponentSelector({ key: 'rootLevelStepFilterGroupComponentSelector', get: ({ instanceId }) => diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateStep.ts index fe91b9d12f..300936e1d5 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateStep.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateStep.ts @@ -1,4 +1,4 @@ -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow'; import { workflowLastCreatedStepIdComponentState } from '@/workflow/states/workflowLastCreatedStepIdComponentState'; import { type WorkflowActionType } from '@/workflow/types/Workflow'; @@ -18,10 +18,10 @@ import { v4 } from 'uuid'; export const useCreateStep = () => { const [isLoading, setIsLoading] = useState(false); const { createWorkflowVersionStep } = useCreateWorkflowVersionStep(); - const setWorkflowSelectedNode = useSetRecoilComponentStateV2( + const setWorkflowSelectedNode = useSetAtomComponentState( workflowSelectedNodeComponentState, ); - const setWorkflowLastCreatedStepId = useSetRecoilComponentStateV2( + const setWorkflowLastCreatedStepId = useSetAtomComponentState( workflowLastCreatedStepIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.ts index b85faf0d4e..017548d750 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useCreateWorkflowVersionStep.ts @@ -8,7 +8,7 @@ import { } from '~/generated/graphql'; import { useUpdateWorkflowVersionCache } from '@/workflow/workflow-steps/hooks/useUpdateWorkflowVersionCache'; import { flowComponentState } from '@/workflow/states/flowComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isDefined } from 'twenty-shared/utils'; export const useCreateWorkflowVersionStep = () => { @@ -16,7 +16,7 @@ export const useCreateWorkflowVersionStep = () => { const { updateWorkflowVersionCache } = useUpdateWorkflowVersionCache(); - const setFlow = useSetRecoilComponentStateV2(flowComponentState); + const setFlow = useSetAtomComponentState(flowComponentState); const [mutate] = useMutation< CreateWorkflowVersionStepMutation, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts index c508b371ba..520576a06c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDeleteStep.ts @@ -1,5 +1,5 @@ import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -17,7 +17,7 @@ export const useDeleteStep = () => { const { getUpdatableWorkflowVersion } = useGetUpdatableWorkflowVersionOrThrow(); const { closeCommandMenu } = useCommandMenu(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); const workflow = useWorkflowWithCurrentVersion(workflowVisualizerWorkflowId); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateStep.ts index 5d7f8b15a9..85d67951cf 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateStep.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateStep.ts @@ -1,4 +1,4 @@ -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow'; import { workflowLastCreatedStepIdComponentState } from '@/workflow/states/workflowLastCreatedStepIdComponentState'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; @@ -10,10 +10,10 @@ import { isDefined } from 'twenty-shared/utils'; export const useDuplicateStep = () => { const [isLoading, setIsLoading] = useState(false); const { duplicateWorkflowVersionStep } = useDuplicateWorkflowVersionStep(); - const setWorkflowSelectedNode = useSetRecoilComponentStateV2( + const setWorkflowSelectedNode = useSetAtomComponentState( workflowSelectedNodeComponentState, ); - const setWorkflowLastCreatedStepId = useSetRecoilComponentStateV2( + const setWorkflowLastCreatedStepId = useSetAtomComponentState( workflowLastCreatedStepIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.ts index 68bae309db..adc863f327 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useDuplicateWorkflowVersionStep.ts @@ -1,5 +1,5 @@ import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { DUPLICATE_WORKFLOW_VERSION_STEP } from '@/workflow/graphql/mutations/duplicateWorkflowVersionStep'; import { flowComponentState } from '@/workflow/states/flowComponentState'; import { useUpdateWorkflowVersionCache } from '@/workflow/workflow-steps/hooks/useUpdateWorkflowVersionCache'; @@ -16,7 +16,7 @@ export const useDuplicateWorkflowVersionStep = () => { const { updateWorkflowVersionCache } = useUpdateWorkflowVersionCache(); - const setFlow = useSetRecoilComponentStateV2(flowComponentState); + const setFlow = useSetAtomComponentState(flowComponentState); const [mutate] = useMutation< DuplicateWorkflowVersionStepMutation, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts index e973a82465..8c33d4d202 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/hooks/useWorkflowRunStepInfo.ts @@ -1,5 +1,5 @@ import { workflowRunIteratorSubStepIterationIndexComponentState } from '@/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow'; import { isDefined } from 'twenty-shared/utils'; @@ -9,7 +9,7 @@ export const useWorkflowRunStepInfo = ({ stepId }: { stepId: string }) => { const workflowRunId = useWorkflowRunIdOrThrow(); const workflowRun = useWorkflowRun({ workflowRunId }); - const workflowRunIteratorSubStepIterationIndex = useRecoilComponentValueV2( + const workflowRunIteratorSubStepIterationIndex = useAtomComponentStateValue( workflowRunIteratorSubStepIterationIndexComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/states/workflowInsertStepIdsComponentState.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/states/workflowInsertStepIdsComponentState.ts index e69063c573..0fea325573 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/states/workflowInsertStepIdsComponentState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/states/workflowInsertStepIdsComponentState.ts @@ -1,4 +1,4 @@ -import { createComponentStateV2 } from '@/ui/utilities/state/jotai/utils/createComponentStateV2'; +import { createAtomComponentState } from '@/ui/utilities/state/jotai/utils/createAtomComponentState'; import { WorkflowVisualizerComponentInstanceContext } from '@/workflow/workflow-diagram/states/contexts/WorkflowVisualizerComponentInstanceContext'; import { type WorkflowStepConnectionOptions } from '@/workflow/workflow-diagram/workflow-iterator/types/WorkflowStepConnectionOptions'; @@ -10,7 +10,7 @@ type WorkflowInsertStepIdsState = { }; export const workflowInsertStepIdsComponentState = - createComponentStateV2({ + createAtomComponentState({ key: 'workflowInsertStepIdsComponentState', defaultValue: { parentStepId: undefined, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx index df20c08770..7cb60b4cd1 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab.tsx @@ -3,8 +3,8 @@ import { useActionRolePermissionFlagConfig } from '@/settings/roles/role-permiss import { TextInput } from '@/ui/input/components/TextInput'; import { type WorkflowAiAgentAction } from '@/workflow/types/Workflow'; import { useWorkflowAiAgentPermissionActions } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { workflowAiAgentActionAgentStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2'; import { workflowAiAgentPermissionsIsAddingPermissionStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2'; import { workflowAiAgentPermissionsSelectedObjectIdStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdStateV2'; @@ -75,18 +75,18 @@ export const WorkflowAiAgentPermissionsTab = ({ isAgentLoading, refetchAgent, }: WorkflowAiAgentPermissionsTabProps) => { - const workflowAiAgentActionAgent = useRecoilValueV2( + const workflowAiAgentActionAgent = useAtomStateValue( workflowAiAgentActionAgentStateV2, ); const [ workflowAiAgentPermissionsSelectedObjectId, setWorkflowAiAgentPermissionsSelectedObjectId, - ] = useRecoilStateV2(workflowAiAgentPermissionsSelectedObjectIdStateV2); + ] = useAtomState(workflowAiAgentPermissionsSelectedObjectIdStateV2); const [ workflowAiAgentPermissionsIsAddingPermission, setWorkflowAiAgentPermissionsIsAddingPermission, - ] = useRecoilStateV2(workflowAiAgentPermissionsIsAddingPermissionStateV2); + ] = useAtomState(workflowAiAgentPermissionsIsAddingPermissionStateV2); const { alphaSortedActiveNonSystemObjectMetadataItems: objectMetadataItems } = useFilteredObjectMetadataItems(); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx index 8af742b4a4..dd2f8ca728 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPromptTab.tsx @@ -1,6 +1,6 @@ import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput'; import { Select } from '@/ui/input/components/Select'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { workflowAiAgentActionAgentStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2'; import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker'; import { t } from '@lingui/core/macro'; @@ -32,7 +32,7 @@ export const WorkflowAiAgentPromptTab = ({ onModelConfigurationChange, onResponseFormatChange, }: WorkflowAiAgentPromptTabProps) => { - const workflowAiAgentActionAgent = useRecoilValueV2( + const workflowAiAgentActionAgent = useAtomStateValue( workflowAiAgentActionAgentStateV2, ); return ( diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx index ce83990526..819030f3bf 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowEditActionAiAgent.tsx @@ -3,7 +3,7 @@ import { useAiModelOptions } from '@/ai/hooks/useAiModelOptions'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { type WorkflowAiAgentAction } from '@/workflow/types/Workflow'; import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody'; @@ -12,7 +12,7 @@ import { useUpdateWorkflowVersionStep } from '@/workflow/workflow-steps/hooks/us import { WorkflowAiAgentPermissionsTab } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/components/WorkflowAiAgentPermissionsTab'; import { WORKFLOW_AI_AGENT_TABS } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentTabs'; import { useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { workflowAiAgentActionAgentStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2'; import { workflowAiAgentPermissionsIsAddingPermissionStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2'; import styled from '@emotion/styled'; @@ -66,7 +66,7 @@ export const WorkflowEditActionAiAgent = ({ const componentInstanceId = `${WORKFLOW_AI_AGENT_TAB_LIST_COMPONENT_ID}-${action.id}`; const agentId = action.settings.input.agentId; const [workflowAiAgentActionAgent, setWorkflowAiAgentActionAgent] = - useRecoilStateV2(workflowAiAgentActionAgentStateV2); + useAtomState(workflowAiAgentActionAgentStateV2); const { loading: agentLoading, refetch: refetchAgent } = useFindOneAgentQuery( { variables: { id: agentId || '' }, @@ -204,7 +204,7 @@ export const WorkflowEditActionAiAgent = ({ }, ]; - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, componentInstanceId, ); @@ -217,7 +217,7 @@ export const WorkflowEditActionAiAgent = ({ const [ workflowAiAgentPermissionsIsAddingPermission, setWorkflowAiAgentPermissionsIsAddingPermission, - ] = useRecoilStateV2(workflowAiAgentPermissionsIsAddingPermissionStateV2); + ] = useAtomState(workflowAiAgentPermissionsIsAddingPermissionStateV2); const role = rolesData?.getRoles.find( (item) => item.id === workflowAiAgentActionAgent?.roleId, diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose.ts index 17a0c25dc4..75c776e79d 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose.ts @@ -1,17 +1,17 @@ import { useListenToSidePanelClosing } from '@/ui/layout/right-drawer/hooks/useListenToSidePanelClosing'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { workflowAiAgentActionAgentStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2'; import { workflowAiAgentPermissionsIsAddingPermissionStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2'; import { workflowAiAgentPermissionsSelectedObjectIdStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdStateV2'; export const useResetWorkflowAiAgentPermissionsStateOnCommandMenuClose = () => { - const setSelectedObjectId = useSetRecoilStateV2( + const setSelectedObjectId = useSetAtomState( workflowAiAgentPermissionsSelectedObjectIdStateV2, ); - const setIsAddingPermission = useSetRecoilStateV2( + const setIsAddingPermission = useSetAtomState( workflowAiAgentPermissionsIsAddingPermissionStateV2, ); - const setAgentState = useSetRecoilStateV2(workflowAiAgentActionAgentStateV2); + const setAgentState = useSetAtomState(workflowAiAgentActionAgentStateV2); const resetPermissionState = () => { setSelectedObjectId(undefined); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.ts index b8da014586..d5fec0c9a0 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/hooks/useWorkflowAiAgentPermissionActions.ts @@ -4,7 +4,7 @@ import { useActionRolePermissionFlagConfig } from '@/settings/roles/role-permiss import { useSettingsRolePermissionFlagConfig } from '@/settings/roles/role-permissions/permission-flags/hooks/useSettingsRolePermissionFlagConfig'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { CRUD_PERMISSIONS } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/constants/WorkflowAiAgentCrudPermissions'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { workflowAiAgentActionAgentStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2'; import { workflowAiAgentPermissionsIsAddingPermissionStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2'; import { workflowAiAgentPermissionsSelectedObjectIdStateV2 } from '@/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdStateV2'; @@ -37,7 +37,7 @@ export const useWorkflowAiAgentPermissionActions = ({ }: UseWorkflowAiAgentPermissionActionsParams) => { const { enqueueSuccessSnackBar } = useSnackBar(); const [workflowAiAgentActionAgent, setWorkflowAiAgentActionAgent] = - useRecoilStateV2(workflowAiAgentActionAgentStateV2); + useAtomState(workflowAiAgentActionAgentStateV2); const { alphaSortedActiveNonSystemObjectMetadataItems: objectMetadataItems } = useFilteredObjectMetadataItems(); const settingsPermissionsConfig = useSettingsRolePermissionFlagConfig({ @@ -47,10 +47,10 @@ export const useWorkflowAiAgentPermissionActions = ({ assignmentCapabilities: { canBeAssignedToAgents: true }, }); - const [, setWorkflowAiAgentPermissionsSelectedObjectId] = useRecoilStateV2( + const [, setWorkflowAiAgentPermissionsSelectedObjectId] = useAtomState( workflowAiAgentPermissionsSelectedObjectIdStateV2, ); - const [, setWorkflowAiAgentPermissionsIsAddingPermission] = useRecoilStateV2( + const [, setWorkflowAiAgentPermissionsIsAddingPermission] = useAtomState( workflowAiAgentPermissionsIsAddingPermissionStateV2, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2.ts index 477d4a392b..2e4339f017 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentActionAgentStateV2.ts @@ -1,8 +1,8 @@ import { type Agent } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const workflowAiAgentActionAgentStateV2 = createStateV2< +export const workflowAiAgentActionAgentStateV2 = createAtomState< Agent | undefined >({ key: 'workflowAiAgentActionAgentStateV2', diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2.ts index d0a8fa6bab..cff8b65e58 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsIsAddingPermissionStateV2.ts @@ -1,7 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const workflowAiAgentPermissionsIsAddingPermissionStateV2 = - createStateV2({ + createAtomState({ key: 'workflowAiAgentPermissionsIsAddingPermissionStateV2', defaultValue: false, }); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdStateV2.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdStateV2.ts index 552d7940d9..5b5334dadd 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdStateV2.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/ai-agent-action/states/workflowAiAgentPermissionsSelectedObjectIdStateV2.ts @@ -1,8 +1,7 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const workflowAiAgentPermissionsSelectedObjectIdStateV2 = createStateV2< - string | undefined ->({ - key: 'workflowAiAgentPermissionsSelectedObjectIdStateV2', - defaultValue: undefined, -}); +export const workflowAiAgentPermissionsSelectedObjectIdStateV2 = + createAtomState({ + key: 'workflowAiAgentPermissionsSelectedObjectIdStateV2', + defaultValue: undefined, + }); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx index f15ef6bf4c..31be6a1155 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCode.tsx @@ -17,13 +17,13 @@ import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement'; import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody'; import { WorkflowCodeEditor } from '@/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowCodeEditor'; import { WorkflowEditActionCodeFields } from '@/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionCodeFields'; import { WORKFLOW_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID } from '@/workflow/workflow-steps/workflow-actions/code-action/constants/WorkflowLogicFunctionTabListComponentId'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { logicFunctionTestDataFamilyState } from '@/workflow/workflow-steps/workflow-actions/code-action/states/logicFunctionTestDataFamilyState'; import { WorkflowLogicFunctionTabId } from '@/workflow/workflow-steps/workflow-actions/code-action/types/WorkflowLogicFunctionTabId'; import { getWrongExportedFunctionMarkers } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/getWrongExportedFunctionMarkers'; @@ -95,14 +95,14 @@ export const WorkflowEditActionCode = ({ const isMobile = useIsMobile(); const logicFunctionId = action.settings.input.logicFunctionId; const fullScreenFocusId = `code-editor-fullscreen-${logicFunctionId}`; - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, WORKFLOW_LOGIC_FUNCTION_TAB_LIST_COMPONENT_ID, ); const { getUpdatableWorkflowVersion } = useGetUpdatableWorkflowVersionOrThrow(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); const workflow = useWorkflowWithCurrentVersion(workflowVisualizerWorkflowId); @@ -128,11 +128,11 @@ export const WorkflowEditActionCode = ({ id: logicFunctionId, }); - const logicFunctionTestData = useFamilyRecoilValueV2( + const logicFunctionTestData = useAtomFamilyStateValue( logicFunctionTestDataFamilyState, logicFunctionId, ); - const setLogicFunctionTestData = useSetFamilyRecoilStateV2( + const setLogicFunctionTestData = useSetAtomFamilyState( logicFunctionTestDataFamilyState, logicFunctionId, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/states/logicFunctionTestDataFamilyState.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/states/logicFunctionTestDataFamilyState.ts index 7ad5113bb2..e0046a27d5 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/states/logicFunctionTestDataFamilyState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/states/logicFunctionTestDataFamilyState.ts @@ -1,4 +1,4 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { LogicFunctionExecutionStatus } from '~/generated-metadata/graphql'; export type LogicFunctionTestData = { @@ -21,7 +21,7 @@ export const DEFAULT_OUTPUT_VALUE = { status: LogicFunctionExecutionStatus.IDLE, }; -export const logicFunctionTestDataFamilyState = createFamilyStateV2< +export const logicFunctionTestDataFamilyState = createAtomFamilyState< LogicFunctionTestData, string >({ diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx index 24803b02cb..79038208db 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionEmailBase.tsx @@ -17,7 +17,7 @@ import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody'; @@ -26,7 +26,7 @@ import { useEmailForm } from '@/workflow/workflow-steps/workflow-actions/hooks/u import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker'; import { useTheme } from '@emotion/react'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect, useState } from 'react'; import { ConnectedAccountProvider, SettingsPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; @@ -57,12 +57,12 @@ export const WorkflowEditActionEmailBase = ({ actionOptions, }: WorkflowEditActionEmailBaseProps) => { const theme = useTheme(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { triggerApisOAuth } = useTriggerApisOAuth(); const { enqueueErrorSnackBar } = useSnackBar(); const { uploadAttachmentFile } = useUploadAttachmentFile(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowEditActionFilterBody.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowEditActionFilterBody.tsx index f100ca9837..e1b06ba557 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowEditActionFilterBody.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/filter-action/components/WorkflowEditActionFilterBody.tsx @@ -1,5 +1,5 @@ import { InputLabel } from '@/ui/input/components/InputLabel'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; import { type WorkflowFilterAction } from '@/workflow/types/Workflow'; import { WorkflowStepBody } from '@/workflow/workflow-steps/components/WorkflowStepBody'; import { WorkflowStepFilterAddFilterRuleSelect } from '@/workflow/workflow-steps/filters/components/WorkflowStepFilterAddFilterRuleSelect'; @@ -49,7 +49,7 @@ export const WorkflowEditActionFilterBody = ({ action, actionOptions, }: WorkflowEditActionFilterBodyProps) => { - const rootStepFilterGroup = useRecoilComponentSelectorValueV2( + const rootStepFilterGroup = useAtomComponentSelectorValue( rootLevelStepFilterGroupComponentSelector, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx index a2de48a135..1f6b4f2d2b 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFilters.tsx @@ -3,7 +3,7 @@ import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataI import { AdvancedFilterCommandMenuContainer } from '@/object-record/advanced-filter/command-menu/components/AdvancedFilterCommandMenuContainer'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useRecoilComponentStateCallbackStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateCallbackStateV2'; +import { useAtomComponentStateCallbackState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateCallbackState'; import { type FindRecordsActionFilter } from '@/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowEditActionFindRecords'; import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker'; @@ -20,11 +20,11 @@ export const WorkflowFindRecordsFilters = ({ onChange: (filter: FindRecordsActionFilter) => void; readonly?: boolean; }) => { - const currentRecordFilterGroups = useRecoilComponentStateCallbackStateV2( + const currentRecordFilterGroups = useAtomComponentStateCallbackState( currentRecordFilterGroupsComponentState, ); - const currentRecordFilters = useRecoilComponentStateCallbackStateV2( + const currentRecordFilters = useAtomComponentStateCallbackState( currentRecordFiltersComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFiltersEffect.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFiltersEffect.tsx index b48318b6fd..a2b9ea6a7c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFiltersEffect.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowFindRecordsFiltersEffect.tsx @@ -1,8 +1,8 @@ import { useSetAdvancedFilterDropdownStates } from '@/object-record/advanced-filter/hooks/useSetAdvancedFilterDropdownAllRowsStates'; import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState'; import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState'; -import { useRecoilComponentFamilyStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentFamilyStateV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyState'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { hasInitializedCurrentRecordFilterGroupsComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFilterGroupsComponentFamilyState'; import { hasInitializedCurrentRecordFiltersComponentFamilyState } from '@/views/states/hasInitializedCurrentRecordFiltersComponentFamilyState'; import { type FindRecordsActionFilter } from '@/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowEditActionFindRecords'; @@ -17,7 +17,7 @@ export const WorkflowFindRecordsFiltersEffect = ({ const [ hasInitializedCurrentRecordFilters, setHasInitializedCurrentRecordFilters, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentRecordFiltersComponentFamilyState, {}, ); @@ -25,16 +25,16 @@ export const WorkflowFindRecordsFiltersEffect = ({ const [ hasInitializedCurrentRecordFilterGroups, setHasInitializedCurrentRecordFilterGroups, - ] = useRecoilComponentFamilyStateV2( + ] = useAtomComponentFamilyState( hasInitializedCurrentRecordFilterGroupsComponentFamilyState, {}, ); - const setCurrentRecordFilters = useSetRecoilComponentStateV2( + const setCurrentRecordFilters = useSetAtomComponentState( currentRecordFiltersComponentState, ); - const setCurrentRecordFilterGroups = useSetRecoilComponentStateV2( + const setCurrentRecordFilterGroups = useSetAtomComponentState( currentRecordFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestTestVariableInput.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestTestVariableInput.tsx index 4c86ddb7ea..7323c38390 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestTestVariableInput.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/HttpRequestTestVariableInput.tsx @@ -3,8 +3,8 @@ import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/c import { type WorkflowStep } from '@/workflow/types/Workflow'; import { getWorkflowVariablesUsedInStep } from '@/workflow/workflow-steps/utils/getWorkflowVariablesUsedInStep'; import { type HttpRequestFormData } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { httpRequestTestDataFamilyState } from '@/workflow/workflow-steps/workflow-actions/http-request-action/states/httpRequestTestDataFamilyState'; import { t } from '@lingui/core/macro'; import styled from '@emotion/styled'; @@ -26,11 +26,11 @@ export const HttpRequestTestVariableInput = ({ actionId, readonly, }: HttpRequestTestVariableInputProps) => { - const httpRequestTestData = useFamilyRecoilValueV2( + const httpRequestTestData = useAtomFamilyStateValue( httpRequestTestDataFamilyState, actionId, ); - const setHttpRequestTestData = useSetFamilyRecoilStateV2( + const setHttpRequestTestData = useSetAtomFamilyState( httpRequestTestDataFamilyState, actionId, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx index b07ab97828..3b6c72b8ca 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/components/WorkflowEditActionHttpRequest.tsx @@ -8,7 +8,7 @@ import { CmdEnterActionButton } from '@/action-menu/components/CmdEnterActionBut import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { WorkflowStepFooter } from '@/workflow/workflow-steps/components/WorkflowStepFooter'; import { getBodyTypeFromHeaders } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/getBodyTypeFromHeaders'; import { isMethodWithBody } from '@/workflow/workflow-steps/workflow-actions/http-request-action/utils/isMethodWithBody'; @@ -90,7 +90,7 @@ export const WorkflowEditActionHttpRequest = ({ }: WorkflowEditActionHttpRequestProps) => { const { t } = useLingui(); const theme = useTheme(); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, WORKFLOW_HTTP_REQUEST_TAB_LIST_COMPONENT_ID, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useTestHttpRequest.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useTestHttpRequest.ts index bd26575fbc..8ee77216bc 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useTestHttpRequest.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/hooks/useTestHttpRequest.ts @@ -4,8 +4,8 @@ import { type HttpRequestFormData, } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest'; import { TEST_HTTP_REQUEST } from '@/workflow/workflow-steps/workflow-actions/http-request-action/graphql/mutations/testHttpRequest'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { httpRequestTestDataFamilyState } from '@/workflow/workflow-steps/workflow-actions/http-request-action/states/httpRequestTestDataFamilyState'; import { useMutation } from '@apollo/client'; import { t } from '@lingui/core/macro'; @@ -44,11 +44,11 @@ const convertFlatVariablesToNestedContext = (flatVariables: { export const useTestHttpRequest = (actionId: string) => { const apolloCoreClient = useApolloCoreClient(); const [isTesting, setIsTesting] = useState(false); - const httpRequestTestData = useFamilyRecoilValueV2( + const httpRequestTestData = useAtomFamilyStateValue( httpRequestTestDataFamilyState, actionId, ); - const setHttpRequestTestData = useSetFamilyRecoilStateV2( + const setHttpRequestTestData = useSetAtomFamilyState( httpRequestTestDataFamilyState, actionId, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/states/httpRequestTestDataFamilyState.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/states/httpRequestTestDataFamilyState.ts index 8c3393b003..251f86dae1 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/states/httpRequestTestDataFamilyState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/http-request-action/states/httpRequestTestDataFamilyState.ts @@ -1,8 +1,8 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { DEFAULT_HTTP_REQUEST_OUTPUT_VALUE } from '@/workflow/workflow-steps/workflow-actions/http-request-action/constants/HttpRequest'; import { type HttpRequestTestData } from '@/workflow/workflow-steps/workflow-actions/http-request-action/types/HttpRequestTestData'; -export const httpRequestTestDataFamilyState = createFamilyStateV2< +export const httpRequestTestDataFamilyState = createAtomFamilyState< HttpRequestTestData, string >({ diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowEditActionIfElseBody.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowEditActionIfElseBody.tsx index cdf73a8cd1..10b5ab20c9 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowEditActionIfElseBody.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/if-else-action/components/WorkflowEditActionIfElseBody.tsx @@ -1,6 +1,6 @@ import { InputLabel } from '@/ui/input/components/InputLabel'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow'; import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; @@ -68,21 +68,21 @@ export const WorkflowEditActionIfElseBody = ({ const { updateWorkflowVersionPosition } = useTidyUpWorkflowVersion(); const { deleteWorkflowVersionStep } = useDeleteWorkflowVersionStep(); const { deleteStepsOutputSchema } = useStepsOutputSchema(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); const workflow = useWorkflowWithCurrentVersion(workflowVisualizerWorkflowId); - const currentStepFilters = useRecoilComponentValueV2( + const currentStepFilters = useAtomComponentStateValue( currentStepFiltersComponentState, ); - const currentStepFilterGroups = useRecoilComponentValueV2( + const currentStepFilterGroups = useAtomComponentStateValue( currentStepFilterGroupsComponentState, ); - const setCurrentStepFilters = useSetRecoilComponentStateV2( + const setCurrentStepFilters = useSetAtomComponentState( currentStepFiltersComponentState, ); - const setCurrentStepFilterGroups = useSetRecoilComponentStateV2( + const setCurrentStepFilterGroups = useSetAtomComponentState( currentStepFilterGroupsComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowIteratorSubStepSwitcher.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowIteratorSubStepSwitcher.tsx index 3a128e4a33..e78777a6af 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowIteratorSubStepSwitcher.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowIteratorSubStepSwitcher.tsx @@ -1,5 +1,5 @@ import { workflowRunIteratorSubStepIterationIndexComponentState } from '@/command-menu/pages/workflow/step/view-run/states/workflowRunIteratorSubStepIterationIndexComponentState'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { useWorkflowRun } from '@/workflow/hooks/useWorkflowRun'; import { useWorkflowRunIdOrThrow } from '@/workflow/hooks/useWorkflowRunIdOrThrow'; @@ -37,7 +37,7 @@ export const WorkflowIteratorSubStepSwitcher = ({ const [ workflowRunIteratorSubStepIterationIndex, setWorkflowRunIteratorSubStepIterationIndex, - ] = useRecoilComponentStateV2( + ] = useAtomComponentState( workflowRunIteratorSubStepIterationIndexComponentState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/CronExpressionHelper.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/CronExpressionHelper.tsx index 763fa1cedd..652f6751cf 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/CronExpressionHelper.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/CronExpressionHelper.tsx @@ -5,7 +5,7 @@ import { calculateNextExecutionsForMinuteInterval } from '@/workflow/workflow-tr import { convertScheduleToCronExpression } from '@/workflow/workflow-trigger/utils/cron-to-human/utils/convertScheduleToCronExpression'; import { normalizeCronExpression } from '@/workflow/workflow-trigger/utils/cron-to-human/utils/normalizeCronExpression'; import { getTriggerScheduleDescription } from '@/workflow/workflow-trigger/utils/getTriggerScheduleDescription'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { CronExpressionParser } from 'cron-parser'; @@ -93,7 +93,7 @@ export const CronExpressionHelper = ({ isUpcomingExecutionVisible = true, }: CronExpressionHelperProps) => { const { timeZone, dateFormat, timeFormat } = useDateTimeFormat(); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); if (!isVisible) { return null; diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx index 977a53c4d6..c442d8a746 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerCronForm.tsx @@ -11,7 +11,7 @@ import { } from '@/workflow/workflow-trigger/constants/CronTriggerIntervalOptions'; import { getCronTriggerDefaultSettings } from '@/workflow/workflow-trigger/utils/getCronTriggerDefaultSettings'; import { getTriggerScheduleDescription } from '@/workflow/workflow-trigger/utils/getTriggerScheduleDescription'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { t } from '@lingui/core/macro'; import { isNumber } from '@sniptt/guards'; import { useState } from 'react'; @@ -48,7 +48,7 @@ export const WorkflowEditTriggerCronForm = ({ }: WorkflowEditTriggerCronFormProps) => { const [errorMessages, setErrorMessages] = useState({}); const [errorMessagesVisible, setErrorMessagesVisible] = useState(false); - const dateLocale = useRecoilValueV2(dateLocaleState); + const dateLocale = useAtomStateValue(dateLocaleState); const customDescription = getTriggerScheduleDescription( trigger, diff --git a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx index 50ed1c7562..7d455a360c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-trigger/components/WorkflowEditTriggerWebhookForm.tsx @@ -3,7 +3,7 @@ import { FormRawJsonFieldInput } from '@/object-record/record-field/ui/form-type import { Select } from '@/ui/input/components/Select'; import { TextInput } from '@/ui/input/components/TextInput'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { type WorkflowWebhookTrigger } from '@/workflow/types/Workflow'; import { parseAndValidateVariableFriendlyStringifiedJson } from '@/workflow/utils/parseAndValidateVariableFriendlyStringifiedJson'; @@ -14,7 +14,7 @@ import { WEBHOOK_TRIGGER_HTTP_METHOD_OPTIONS } from '@/workflow/workflow-trigger import { getWebhookTriggerDefaultSettings } from '@/workflow/workflow-trigger/utils/getWebhookTriggerDefaultSettings'; import { useTheme } from '@emotion/react'; import { isNonEmptyString } from '@sniptt/guards'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { getOutputSchemaFromValue } from 'twenty-shared/logic-function'; @@ -54,10 +54,10 @@ export const WorkflowEditTriggerWebhookForm = ({ const { copyToClipboard } = useCopyToClipboard(); const [errorMessages, setErrorMessages] = useState({}); const [errorMessagesVisible, setErrorMessagesVisible] = useState(false); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const onBlur = () => { setErrorMessagesVisible(true); diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx index 842ffa521d..101f68df4c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdown.tsx @@ -2,7 +2,7 @@ import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { StyledDropdownButtonContainer } from '@/ui/layout/dropdown/components/StyledDropdownButtonContainer'; import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { type InputSchemaPropertyType } from 'twenty-shared/workflow'; import { WorkflowVariablesDropdownStepItems } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems'; import { WorkflowVariablesDropdownSteps } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownSteps'; @@ -53,7 +53,7 @@ export const WorkflowVariablesDropdown = ({ const theme = useTheme(); const dropdownId = `${SEARCH_VARIABLES_DROPDOWN_ID}-${instanceId}`; - const isDropdownOpen = useRecoilComponentValueV2( + const isDropdownOpen = useAtomComponentStateValue( isDropdownOpenComponentState, dropdownId, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useAvailableVariablesInWorkflowStep.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useAvailableVariablesInWorkflowStep.ts index 0990550c67..20a43060c9 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useAvailableVariablesInWorkflowStep.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useAvailableVariablesInWorkflowStep.ts @@ -1,5 +1,5 @@ -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { stepsOutputSchemaFamilySelector } from '@/workflow/states/selectors/stepsOutputSchemaFamilySelector'; import { @@ -21,7 +21,7 @@ export const useAvailableVariablesInWorkflowStep = ({ shouldDisplayRecordObjects: boolean; fieldTypesToExclude?: InputSchemaPropertyType[]; }): StepOutputSchemaV2[] => { - const workflowSelectedNode = useRecoilComponentValueV2( + const workflowSelectedNode = useAtomComponentStateValue( workflowSelectedNodeComponentState, ); const flow = useFlowOrThrow(); @@ -33,7 +33,7 @@ export const useAvailableVariablesInWorkflowStep = ({ : []; const availableStepsOutputSchema: StepOutputSchemaV2[] = - useFamilySelectorValueV2(stepsOutputSchemaFamilySelector, { + useAtomFamilySelectorValue(stepsOutputSchemaFamilySelector, { workflowVersionId: flow.workflowVersionId, stepIds: [TRIGGER_STEP_ID, ...previousStepIds], }); diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useSearchVariable.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useSearchVariable.ts index 932ad63c26..59c84050e9 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useSearchVariable.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useSearchVariable.ts @@ -1,4 +1,4 @@ -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow'; import { useWorkflowVersionIdOrThrow } from '@/workflow/hooks/useWorkflowVersionIdOrThrow'; import { stepsOutputSchemaFamilySelector } from '@/workflow/states/selectors/stepsOutputSchemaFamilySelector'; @@ -25,7 +25,7 @@ export const useSearchVariable = ({ }): VariableSearchResult => { const workflowVersionId = useWorkflowVersionIdOrThrow(); const flow = useFlowOrThrow(); - const [stepOutputSchema] = useFamilySelectorValueV2( + const [stepOutputSchema] = useAtomFamilySelectorValue( stepsOutputSchemaFamilySelector, { workflowVersionId, diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useVariableDropdown.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useVariableDropdown.ts index e5f282a5ec..51057cb563 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useVariableDropdown.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/hooks/useVariableDropdown.ts @@ -1,8 +1,8 @@ import { useWorkflowCommandMenu } from '@/command-menu/hooks/useWorkflowCommandMenu'; import { commandMenuNavigationStackState } from '@/command-menu/states/commandMenuNavigationStackState'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { workflowVisualizerWorkflowIdComponentState } from '@/workflow/states/workflowVisualizerWorkflowIdComponentState'; import { workflowDiagramComponentState } from '@/workflow/workflow-diagram/states/workflowDiagramComponentState'; import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState'; @@ -10,7 +10,7 @@ import { type LinkOutputSchema } from '@/workflow/workflow-variables/types/LinkO import { type FieldOutputSchemaV2 } from '@/workflow/workflow-variables/types/RecordOutputSchemaV2'; import { type StepOutputSchemaV2 } from '@/workflow/workflow-variables/types/StepOutputSchemaV2'; import { getVariableTemplateFromPath } from '@/workflow/workflow-variables/utils/getVariableTemplateFromPath'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useState } from 'react'; import { isDefined } from 'twenty-shared/utils'; import { type BaseOutputSchemaV2 } from 'twenty-shared/workflow'; @@ -48,21 +48,21 @@ export const useVariableDropdown = ({ const { openWorkflowEditStepInCommandMenu } = useWorkflowCommandMenu(); - const workflowVisualizerWorkflowId = useRecoilComponentValueV2( + const workflowVisualizerWorkflowId = useAtomComponentStateValue( workflowVisualizerWorkflowIdComponentState, ); - const setWorkflowSelectedNode = useSetRecoilComponentStateV2( + const setWorkflowSelectedNode = useSetAtomComponentState( workflowSelectedNodeComponentState, ); - const setActiveTabId = useSetRecoilComponentStateV2( + const setActiveTabId = useSetAtomComponentState( activeTabIdComponentState, 'workflow-logic-function-tab-list-component-id', ); - const setWorkflowDiagram = useSetRecoilComponentStateV2( + const setWorkflowDiagram = useSetAtomComponentState( workflowDiagramComponentState, ); - const setCommandMenuNavigationStack = useSetRecoilStateV2( + const setCommandMenuNavigationStack = useSetAtomState( commandMenuNavigationStackState, ); diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/states/shouldRecomputeOutputSchemaFamilyState.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/states/shouldRecomputeOutputSchemaFamilyState.ts index 6c58eb5279..866b1d4160 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/states/shouldRecomputeOutputSchemaFamilyState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/states/shouldRecomputeOutputSchemaFamilyState.ts @@ -1,6 +1,6 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; -export const shouldRecomputeOutputSchemaFamilyState = createFamilyStateV2< +export const shouldRecomputeOutputSchemaFamilyState = createAtomFamilyState< boolean, string | undefined >({ diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/states/stepsOutputSchemaFamilyState.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/states/stepsOutputSchemaFamilyState.ts index 9f3ff70dc4..e14be6793c 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/states/stepsOutputSchemaFamilyState.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/states/stepsOutputSchemaFamilyState.ts @@ -1,7 +1,7 @@ -import { createFamilyStateV2 } from '@/ui/utilities/state/jotai/utils/createFamilyStateV2'; +import { createAtomFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomFamilyState'; import { type StepOutputSchemaV2 } from '@/workflow/workflow-variables/types/StepOutputSchemaV2'; -export const stepsOutputSchemaFamilyState = createFamilyStateV2< +export const stepsOutputSchemaFamilyState = createAtomFamilyState< StepOutputSchemaV2 | null, string | undefined >({ diff --git a/packages/twenty-front/src/modules/workflow/workflow-version/hooks/useTidyUp.ts b/packages/twenty-front/src/modules/workflow/workflow-version/hooks/useTidyUp.ts index e2e9665c98..044bfdaacc 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-version/hooks/useTidyUp.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-version/hooks/useTidyUp.ts @@ -1,11 +1,11 @@ import { useGetUpdatableWorkflowVersionOrThrow } from '@/workflow/hooks/useGetUpdatableWorkflowVersionOrThrow'; -import { useRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentStateV2'; +import { useAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useAtomComponentState'; import { workflowDiagramComponentState } from '@/workflow/workflow-diagram/states/workflowDiagramComponentState'; import { useTidyUpWorkflowVersion } from '@/workflow/workflow-version/hooks/useTidyUpWorkflowVersion'; import { isDefined } from 'twenty-shared/utils'; export const useTidyUp = () => { - const [workflowDiagram, setWorkflowDiagram] = useRecoilComponentStateV2( + const [workflowDiagram, setWorkflowDiagram] = useAtomComponentState( workflowDiagramComponentState, ); diff --git a/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.ts b/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.ts index 93d3dae329..8377db355f 100644 --- a/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.ts +++ b/packages/twenty-front/src/modules/workspace-invitation/hooks/useCreateWorkspaceInvitation.ts @@ -3,14 +3,12 @@ import { useSendInvitationsMutation, } from '~/generated-metadata/graphql'; import { workspaceInvitationsState } from '@/workspace-invitation/states/workspaceInvitationsStates'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useCreateWorkspaceInvitation = () => { const [sendInvitationsMutation] = useSendInvitationsMutation(); - const setWorkspaceInvitations = useSetRecoilStateV2( - workspaceInvitationsState, - ); + const setWorkspaceInvitations = useSetAtomState(workspaceInvitationsState); const sendInvitation = async (emails: SendInvitationsMutationVariables) => { return await sendInvitationsMutation({ diff --git a/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.ts b/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.ts index 526e58ccd1..8bcaf243d8 100644 --- a/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.ts +++ b/packages/twenty-front/src/modules/workspace-invitation/hooks/useDeleteWorkspaceInvitation.ts @@ -3,15 +3,13 @@ import { useDeleteWorkspaceInvitationMutation, } from '~/generated-metadata/graphql'; import { workspaceInvitationsState } from '@/workspace-invitation/states/workspaceInvitationsStates'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useDeleteWorkspaceInvitation = () => { const [deleteWorkspaceInvitationMutation] = useDeleteWorkspaceInvitationMutation(); - const setWorkspaceInvitations = useSetRecoilStateV2( - workspaceInvitationsState, - ); + const setWorkspaceInvitations = useSetAtomState(workspaceInvitationsState); const deleteWorkspaceInvitation = async ({ appTokenId, diff --git a/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.ts b/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.ts index 309e61c8da..3198a4b7e5 100644 --- a/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.ts +++ b/packages/twenty-front/src/modules/workspace-invitation/hooks/useResendWorkspaceInvitation.ts @@ -3,15 +3,13 @@ import { useResendWorkspaceInvitationMutation, } from '~/generated-metadata/graphql'; import { workspaceInvitationsState } from '@/workspace-invitation/states/workspaceInvitationsStates'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; export const useResendWorkspaceInvitation = () => { const [resendWorkspaceInvitationMutation] = useResendWorkspaceInvitationMutation(); - const setWorkspaceInvitations = useSetRecoilStateV2( - workspaceInvitationsState, - ); + const setWorkspaceInvitations = useSetAtomState(workspaceInvitationsState); const resendInvitation = async ({ appTokenId, diff --git a/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.ts b/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.ts index 88c54efe14..0b92e3fb09 100644 --- a/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.ts +++ b/packages/twenty-front/src/modules/workspace-invitation/states/workspaceInvitationsStates.ts @@ -1,7 +1,7 @@ import { type WorkspaceInvitation } from '@/workspace-member/types/WorkspaceMember'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const workspaceInvitationsState = createStateV2< +export const workspaceInvitationsState = createAtomState< Omit[] >({ key: 'workspaceInvitationsState', diff --git a/packages/twenty-front/src/modules/workspace/components/WorkspaceProviderEffect.tsx b/packages/twenty-front/src/modules/workspace/components/WorkspaceProviderEffect.tsx index b9d2f85643..d3489f949e 100644 --- a/packages/twenty-front/src/modules/workspace/components/WorkspaceProviderEffect.tsx +++ b/packages/twenty-front/src/modules/workspace/components/WorkspaceProviderEffect.tsx @@ -2,7 +2,7 @@ import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWork import { useReadWorkspaceUrlFromCurrentLocation } from '@/domain-manager/hooks/useReadWorkspaceUrlFromCurrentLocation'; import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain'; import { lastAuthenticatedWorkspaceDomainState } from '@/domain-manager/states/lastAuthenticatedWorkspaceDomainState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useEffect, useCallback } from 'react'; import { useInitializeQueryParamState } from '@/app/hooks/useInitializeQueryParamState'; @@ -15,7 +15,7 @@ import { getWorkspaceUrl } from '~/utils/getWorkspaceUrl'; export const WorkspaceProviderEffect = () => { const { data: getPublicWorkspaceData } = useGetPublicWorkspaceDataByDomain(); - const lastAuthenticatedWorkspaceDomain = useRecoilValueV2( + const lastAuthenticatedWorkspaceDomain = useAtomStateValue( lastAuthenticatedWorkspaceDomainState, ); @@ -24,7 +24,7 @@ export const WorkspaceProviderEffect = () => { const { currentLocationHostname } = useReadWorkspaceUrlFromCurrentLocation(); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); diff --git a/packages/twenty-front/src/modules/workspace/hooks/__tests__/useSubscriptionStatus.test.ts b/packages/twenty-front/src/modules/workspace/hooks/__tests__/useSubscriptionStatus.test.ts index 0b3f251fa3..7617273b94 100644 --- a/packages/twenty-front/src/modules/workspace/hooks/__tests__/useSubscriptionStatus.test.ts +++ b/packages/twenty-front/src/modules/workspace/hooks/__tests__/useSubscriptionStatus.test.ts @@ -8,7 +8,7 @@ import { type CurrentWorkspace, currentWorkspaceState, } from '@/auth/states/currentWorkspaceState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore'; import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus'; import { @@ -34,7 +34,7 @@ const renderHooks = () => { const { result } = renderHook( () => { const subscriptionStatus = useSubscriptionStatus(); - const setCurrentWorkspace = useSetRecoilStateV2(currentWorkspaceState); + const setCurrentWorkspace = useSetAtomState(currentWorkspaceState); return { subscriptionStatus, diff --git a/packages/twenty-front/src/modules/workspace/hooks/useFeatureFlagsMap.ts b/packages/twenty-front/src/modules/workspace/hooks/useFeatureFlagsMap.ts index d9c4b0a50e..7a11bb59fa 100644 --- a/packages/twenty-front/src/modules/workspace/hooks/useFeatureFlagsMap.ts +++ b/packages/twenty-front/src/modules/workspace/hooks/useFeatureFlagsMap.ts @@ -1,10 +1,10 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { extractFeatureFlagMapFromWorkspace } from '@/workspace/utils/extractFeatureFlagMapFromWorkspace'; import { type FeatureFlagKey } from '~/generated-metadata/graphql'; export const useFeatureFlagsMap = (): Record => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); return extractFeatureFlagMapFromWorkspace(currentWorkspace); }; diff --git a/packages/twenty-front/src/modules/workspace/hooks/useIsFeatureEnabled.ts b/packages/twenty-front/src/modules/workspace/hooks/useIsFeatureEnabled.ts index 82efd616bc..e7b5d1843a 100644 --- a/packages/twenty-front/src/modules/workspace/hooks/useIsFeatureEnabled.ts +++ b/packages/twenty-front/src/modules/workspace/hooks/useIsFeatureEnabled.ts @@ -1,9 +1,9 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type FeatureFlagKey } from '~/generated-metadata/graphql'; export const useIsFeatureEnabled = (featureKey: FeatureFlagKey | null) => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); if (!featureKey) { return false; diff --git a/packages/twenty-front/src/modules/workspace/hooks/useIsSomeMeteredProductCapReached.ts b/packages/twenty-front/src/modules/workspace/hooks/useIsSomeMeteredProductCapReached.ts index c3bfd3c5a3..a38a5b032d 100644 --- a/packages/twenty-front/src/modules/workspace/hooks/useIsSomeMeteredProductCapReached.ts +++ b/packages/twenty-front/src/modules/workspace/hooks/useIsSomeMeteredProductCapReached.ts @@ -1,8 +1,8 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; export const useIsSomeMeteredProductCapReached = (): boolean => { - const billingSubscriptionItems = useRecoilValueV2(currentWorkspaceState) + const billingSubscriptionItems = useAtomStateValue(currentWorkspaceState) ?.currentBillingSubscription?.billingSubscriptionItems; if (!billingSubscriptionItems) { diff --git a/packages/twenty-front/src/modules/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo.ts b/packages/twenty-front/src/modules/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo.ts index 6be98b747f..1b98101239 100644 --- a/packages/twenty-front/src/modules/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo.ts +++ b/packages/twenty-front/src/modules/workspace/hooks/useIsWorkspaceActivationStatusEqualsTo.ts @@ -1,10 +1,10 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type WorkspaceActivationStatus } from 'twenty-shared/workspace'; export const useIsWorkspaceActivationStatusEqualsTo = ( activationStatus: WorkspaceActivationStatus, ): boolean => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); return currentWorkspace?.activationStatus === activationStatus; }; diff --git a/packages/twenty-front/src/modules/workspace/hooks/useSubscriptionStatus.ts b/packages/twenty-front/src/modules/workspace/hooks/useSubscriptionStatus.ts index 150d4f93ec..d9db5af966 100644 --- a/packages/twenty-front/src/modules/workspace/hooks/useSubscriptionStatus.ts +++ b/packages/twenty-front/src/modules/workspace/hooks/useSubscriptionStatus.ts @@ -1,8 +1,8 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type SubscriptionStatus } from '~/generated-metadata/graphql'; export const useSubscriptionStatus = (): SubscriptionStatus | undefined => { - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); return currentWorkspace?.currentBillingSubscription?.status; }; diff --git a/packages/twenty-front/src/modules/workspace/states/workspaceAuthBypassProvidersState.ts b/packages/twenty-front/src/modules/workspace/states/workspaceAuthBypassProvidersState.ts index 99e18d0251..6fec3554d2 100644 --- a/packages/twenty-front/src/modules/workspace/states/workspaceAuthBypassProvidersState.ts +++ b/packages/twenty-front/src/modules/workspace/states/workspaceAuthBypassProvidersState.ts @@ -1,8 +1,8 @@ import { type AuthBypassProviders } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export const workspaceAuthBypassProvidersState = - createStateV2({ + createAtomState({ key: 'workspaceAuthBypassProvidersState', defaultValue: null, }); diff --git a/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.ts b/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.ts index c76c2380cf..6a4b08875a 100644 --- a/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.ts +++ b/packages/twenty-front/src/modules/workspace/states/workspaceAuthProvidersState.ts @@ -1,7 +1,8 @@ import { type AuthProviders } from '~/generated-metadata/graphql'; -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const workspaceAuthProvidersState = createStateV2({ - key: 'workspaceAuthProvidersState', - defaultValue: null, -}); +export const workspaceAuthProvidersState = + createAtomState({ + key: 'workspaceAuthProvidersState', + defaultValue: null, + }); diff --git a/packages/twenty-front/src/modules/workspace/states/workspaceBypassModeState.ts b/packages/twenty-front/src/modules/workspace/states/workspaceBypassModeState.ts index ca24c15365..28846e3c3d 100644 --- a/packages/twenty-front/src/modules/workspace/states/workspaceBypassModeState.ts +++ b/packages/twenty-front/src/modules/workspace/states/workspaceBypassModeState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const workspaceBypassModeState = createStateV2({ +export const workspaceBypassModeState = createAtomState({ key: 'workspaceBypassModeState', defaultValue: false, }); diff --git a/packages/twenty-front/src/pages/auth/PasswordReset.tsx b/packages/twenty-front/src/pages/auth/PasswordReset.tsx index 1126cd7cc0..3a4e894b68 100644 --- a/packages/twenty-front/src/pages/auth/PasswordReset.tsx +++ b/packages/twenty-front/src/pages/auth/PasswordReset.tsx @@ -25,8 +25,8 @@ import { useState } from 'react'; import { Controller, useForm } from 'react-hook-form'; import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; import { useParams } from 'react-router-dom'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { AppPath } from 'twenty-shared/types'; import { MainButton } from 'twenty-ui/input'; import { AnimatedEaseIn } from 'twenty-ui/utilities'; @@ -88,8 +88,8 @@ export const PasswordReset = () => { const { t } = useLingui(); const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar(); - const workspacePublicData = useRecoilValueV2(workspacePublicDataState); - const setCurrentUser = useSetRecoilStateV2(currentUserState); + const workspacePublicData = useAtomStateValue(workspacePublicDataState); + const setCurrentUser = useSetAtomState(currentUserState); const navigate = useNavigateApp(); const { redirect } = useRedirect(); diff --git a/packages/twenty-front/src/pages/auth/SignInUp.tsx b/packages/twenty-front/src/pages/auth/SignInUp.tsx index 979264f573..7f3561bc1e 100644 --- a/packages/twenty-front/src/pages/auth/SignInUp.tsx +++ b/packages/twenty-front/src/pages/auth/SignInUp.tsx @@ -7,8 +7,8 @@ import { import { workspacePublicDataState } from '@/auth/states/workspacePublicDataState'; import styled from '@emotion/styled'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { Logo } from '@/auth/components/Logo'; import { Title } from '@/auth/components/Title'; @@ -82,17 +82,17 @@ const StandardContent = ({ export const SignInUp = () => { const { t } = useLingui(); - const setSignInUpStep = useSetRecoilStateV2(signInUpStepState); - const clientConfigApiStatus = useRecoilValueV2(clientConfigApiStatusState); + const setSignInUpStep = useSetAtomState(signInUpStepState); + const clientConfigApiStatus = useAtomStateValue(clientConfigApiStatusState); const { form } = useSignInUpForm(); const { signInUpStep } = useSignInUp(form); const { isDefaultDomain } = useIsCurrentLocationOnDefaultDomain(); const { isOnAWorkspace } = useIsCurrentLocationOnAWorkspace(); - const workspacePublicData = useRecoilValueV2(workspacePublicDataState); + const workspacePublicData = useAtomStateValue(workspacePublicDataState); const { loading: getPublicWorkspaceDataLoading } = useGetPublicWorkspaceDataByDomain(); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); const { workspaceInviteHash, workspace: workspaceFromInviteHash } = diff --git a/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx b/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx index 74335df6c7..29c9c325ad 100644 --- a/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx +++ b/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx @@ -5,7 +5,7 @@ import { useEffect } from 'react'; import { fireEvent, within } from 'storybook/test'; import { captchaTokenState } from '@/captcha/states/captchaTokenState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser'; import { PageDecorator, @@ -17,7 +17,7 @@ import { AppPath } from 'twenty-shared/types'; import { SignInUp } from '~/pages/auth/SignInUp'; const CaptchaTokenSetterEffect = () => { - const setCaptchaToken = useSetRecoilStateV2(captchaTokenState); + const setCaptchaToken = useSetAtomState(captchaTokenState); useEffect(() => { setCaptchaToken('MOCKED_CAPTCHA_TOKEN'); diff --git a/packages/twenty-front/src/pages/auth/__stories__/SignInUpWithInvite.stories.tsx b/packages/twenty-front/src/pages/auth/__stories__/SignInUpWithInvite.stories.tsx index ba031398eb..5d12f82dd1 100644 --- a/packages/twenty-front/src/pages/auth/__stories__/SignInUpWithInvite.stories.tsx +++ b/packages/twenty-front/src/pages/auth/__stories__/SignInUpWithInvite.stories.tsx @@ -5,7 +5,7 @@ import { useEffect } from 'react'; import { fireEvent, within } from 'storybook/test'; import { captchaTokenState } from '@/captcha/states/captchaTokenState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser'; import { GET_WORKSPACE_FROM_INVITE_HASH } from '@/workspace/graphql/queries/getWorkspaceFromInviteHash'; import { @@ -18,7 +18,7 @@ import { AppPath } from 'twenty-shared/types'; import { SignInUp } from '~/pages/auth/SignInUp'; const CaptchaTokenSetterEffect = () => { - const setCaptchaToken = useSetRecoilStateV2(captchaTokenState); + const setCaptchaToken = useSetAtomState(captchaTokenState); useEffect(() => { setCaptchaToken('MOCKED_CAPTCHA_TOKEN'); diff --git a/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx b/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx index 2d5a47fc51..595c8d1dfe 100644 --- a/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx +++ b/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx @@ -4,11 +4,11 @@ import { ContextStoreComponentInstanceContext } from '@/context-store/states/con import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { RecordIndexContainerGater } from '@/object-record/record-index/components/RecordIndexContainerGater'; import { PageContainer } from '@/ui/layout/page/components/PageContainer'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { isUndefined } from '@sniptt/guards'; export const RecordIndexPage = () => { - const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2( + const contextStoreCurrentObjectMetadataItemId = useAtomComponentStateValue( contextStoreCurrentObjectMetadataItemIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/pages/object-record/RecordShowPageTitle.tsx b/packages/twenty-front/src/pages/object-record/RecordShowPageTitle.tsx index b9325cfb08..7863afe982 100644 --- a/packages/twenty-front/src/pages/object-record/RecordShowPageTitle.tsx +++ b/packages/twenty-front/src/pages/object-record/RecordShowPageTitle.tsx @@ -3,7 +3,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata import { getLabelIdentifierFieldValue } from '@/object-metadata/utils/getLabelIdentifierFieldValue'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { PageTitle } from '@/ui/utilities/page-title/components/PageTitle'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { isDefined } from 'twenty-shared/utils'; export const RecordShowPageTitle = ({ @@ -18,7 +18,10 @@ export const RecordShowPageTitle = ({ const { objectMetadataItem } = useObjectMetadataItem({ objectNameSingular }); - const record = useFamilyRecoilValueV2(recordStoreFamilyState, objectRecordId); + const record = useAtomFamilyStateValue( + recordStoreFamilyState, + objectRecordId, + ); const pageName = isDefined(record) ? getLabelIdentifierFieldValue(record, labelIdentifierFieldMetadataItem) diff --git a/packages/twenty-front/src/pages/onboarding/BookCall.tsx b/packages/twenty-front/src/pages/onboarding/BookCall.tsx index 75391b617f..17d3b540b7 100644 --- a/packages/twenty-front/src/pages/onboarding/BookCall.tsx +++ b/packages/twenty-front/src/pages/onboarding/BookCall.tsx @@ -9,7 +9,7 @@ import { Modal } from '@/ui/layout/modal/components/Modal'; import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper'; import { useTheme } from '@emotion/react'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { AppPath } from 'twenty-shared/types'; import { IconChevronLeft, IconChevronRightPipe } from 'twenty-ui/display'; import { LightButton } from 'twenty-ui/input'; @@ -37,9 +37,9 @@ const StyledScrollWrapper = styled(ScrollWrapper)<{ isMobile: boolean }>` export const BookCall = () => { const { t } = useLingui(); const theme = useTheme(); - const calendarBookingPageId = useRecoilValueV2(calendarBookingPageIdState); + const calendarBookingPageId = useAtomStateValue(calendarBookingPageIdState); const setNextOnboardingStatus = useSetNextOnboardingStatus(); - const currentUser = useRecoilValueV2(currentUserState); + const currentUser = useAtomStateValue(currentUserState); const [skipBookOnboardingStepMutation] = useSkipBookOnboardingStepMutation(); const isMobile = useIsMobile(); diff --git a/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsx b/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsx index a19145c4a3..a9ecdad682 100644 --- a/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsx +++ b/packages/twenty-front/src/pages/onboarding/ChooseYourPlan.tsx @@ -3,7 +3,7 @@ import styled from '@emotion/styled'; import { isDefined } from 'twenty-shared/utils'; import { ChooseYourPlanContent } from '~/pages/onboarding/internal/ChooseYourPlanContent'; import { billingState } from '@/client-config/states/billingState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { usePlans } from '@/billing/hooks/usePlans'; const StyledChooseYourPlanPlaceholder = styled.div` @@ -12,7 +12,7 @@ const StyledChooseYourPlanPlaceholder = styled.div` export const ChooseYourPlan = () => { const { isPlansLoaded } = usePlans(); - const billing = useRecoilValueV2(billingState); + const billing = useAtomStateValue(billingState); return ( {isDefined(billing) && isPlansLoaded ? ( diff --git a/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx b/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx index b3140336c2..ce64f43ef0 100644 --- a/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx +++ b/packages/twenty-front/src/pages/onboarding/CreateProfile.tsx @@ -2,8 +2,8 @@ import styled from '@emotion/styled'; import { zodResolver } from '@hookform/resolvers/zod'; import { useCallback, useState } from 'react'; import { Controller, type SubmitHandler, useForm } from 'react-hook-form'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { Key } from 'ts-key-enum'; import { z } from 'zod'; @@ -69,10 +69,10 @@ export const CreateProfile = () => { const { t } = useLingui(); const setNextOnboardingStatus = useSetNextOnboardingStatus(); const { enqueueErrorSnackBar } = useSnackBar(); - const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilStateV2( + const [currentWorkspaceMember, setCurrentWorkspaceMember] = useAtomState( currentWorkspaceMemberState, ); - const setCurrentUser = useSetRecoilStateV2(currentUserState); + const setCurrentUser = useSetAtomState(currentUserState); const { updateOneRecord } = useUpdateOneRecord(); // Form diff --git a/packages/twenty-front/src/pages/onboarding/CreateWorkspace.tsx b/packages/twenty-front/src/pages/onboarding/CreateWorkspace.tsx index b9a48d9020..5dbf6c87eb 100644 --- a/packages/twenty-front/src/pages/onboarding/CreateWorkspace.tsx +++ b/packages/twenty-front/src/pages/onboarding/CreateWorkspace.tsx @@ -20,7 +20,7 @@ import { ApolloError } from '@apollo/client'; import { Trans, useLingui } from '@lingui/react/macro'; import { isNonEmptyString } from '@sniptt/guards'; import { motion } from 'framer-motion'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { isDefined } from 'twenty-shared/utils'; import { H2Title } from 'twenty-ui/display'; import { Loader } from 'twenty-ui/feedback'; @@ -74,7 +74,7 @@ export const CreateWorkspace = () => { const [pendingCreationLoaderStep, setPendingCreationLoaderStep] = useState( PendingCreationLoaderStep.None, ); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const validationSchema = z .object({ diff --git a/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx b/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx index 182c8d787f..aae8ecfe82 100644 --- a/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx +++ b/packages/twenty-front/src/pages/onboarding/InviteTeam.tsx @@ -18,7 +18,7 @@ import { useFieldArray, useForm, } from 'react-hook-form'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { Key } from 'ts-key-enum'; import { isDefined } from 'twenty-shared/utils'; import { IconCopy, SeparatorLineText } from 'twenty-ui/display'; @@ -65,8 +65,8 @@ export const InviteTeam = () => { const { enqueueSuccessSnackBar } = useSnackBar(); const { sendInvitation } = useCreateWorkspaceInvitation(); const setNextOnboardingStatus = useSetNextOnboardingStatus(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); - const calendarBookingPageId = useRecoilValueV2(calendarBookingPageIdState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); + const calendarBookingPageId = useAtomStateValue(calendarBookingPageIdState); const hasCalendarBooking = isDefined(calendarBookingPageId); const { diff --git a/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx b/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx index ab85db35d9..aedac2cfef 100644 --- a/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx +++ b/packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx @@ -7,7 +7,7 @@ import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { useState } from 'react'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { AppPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { IconCheck } from 'twenty-ui/display'; @@ -32,7 +32,7 @@ export const PaymentSuccess = () => { const navigate = useNavigateApp(); const subscriptionStatus = useSubscriptionStatus(); const [getCurrentUser] = useGetCurrentUserLazyQuery(); - const setCurrentUser = useSetRecoilStateV2(currentUserState); + const setCurrentUser = useSetAtomState(currentUserState); const [isLoading, setIsLoading] = useState(false); const navigateWithSubscriptionCheck = async () => { if (isLoading) return; diff --git a/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx b/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx index 4e4368779f..3b30d917ee 100644 --- a/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx +++ b/packages/twenty-front/src/pages/onboarding/SyncEmails.tsx @@ -1,8 +1,8 @@ import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useState } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { Key } from 'ts-key-enum'; import { SubTitle } from '@/auth/components/SubTitle'; @@ -59,9 +59,7 @@ export const SyncEmails = () => { const [visibility, setVisibility] = useState( MessageChannelVisibility.SHARE_EVERYTHING, ); - const [lastAuthenticatedMethod] = useRecoilStateV2( - lastAuthenticatedMethodState, - ); + const [lastAuthenticatedMethod] = useAtomState(lastAuthenticatedMethodState); const [skipSyncEmailOnboardingStatusMutation] = useSkipSyncEmailOnboardingStepMutation(); @@ -87,18 +85,18 @@ export const SyncEmails = () => { const userAuthenticatedWithSSO = lastAuthenticatedMethod === AuthenticatedMethod.SSO; - const isGoogleMessagingEnabled = useRecoilValueV2( + const isGoogleMessagingEnabled = useAtomStateValue( isGoogleMessagingEnabledState, ); - const isMicrosoftMessagingEnabled = useRecoilValueV2( + const isMicrosoftMessagingEnabled = useAtomStateValue( isMicrosoftMessagingEnabledState, ); - const isGoogleCalendarEnabled = useRecoilValueV2( + const isGoogleCalendarEnabled = useAtomStateValue( isGoogleCalendarEnabledState, ); - const isMicrosoftCalendarEnabled = useRecoilValueV2( + const isMicrosoftCalendarEnabled = useAtomStateValue( isMicrosoftCalendarEnabledState, ); diff --git a/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx b/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx index 7e2184f7cd..8ac822acb0 100644 --- a/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx +++ b/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx @@ -12,9 +12,9 @@ import { useHandleCheckoutSession } from '@/billing/hooks/useHandleCheckoutSessi import { calendarBookingPageIdState } from '@/client-config/states/calendarBookingPageIdState'; import styled from '@emotion/styled'; import { Trans, useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { AppPath } from 'twenty-shared/types'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { isDefined } from 'twenty-shared/utils'; import { Loader } from 'twenty-ui/feedback'; import { CardPicker, MainButton } from 'twenty-ui/input'; @@ -96,14 +96,15 @@ export const ChooseYourPlanContent = ({ billing }: { billing: Billing }) => { const { getBaseLicensedPriceByPlanKeyAndInterval } = useBaseLicensedPriceByPlanKeyAndInterval(); - const [billingCheckoutSession, setBillingCheckoutSession] = useRecoilStateV2( + const [billingCheckoutSession, setBillingCheckoutSession] = useAtomState( billingCheckoutSessionState, ); - const calendarBookingPageId = useRecoilValueV2(calendarBookingPageIdState); + const calendarBookingPageId = useAtomStateValue(calendarBookingPageIdState); - const [verifyEmailRedirectPath, setVerifyEmailRedirectPath] = - useRecoilStateV2(verifyEmailRedirectPathState); + const [verifyEmailRedirectPath, setVerifyEmailRedirectPath] = useAtomState( + verifyEmailRedirectPathState, + ); if (isDefined(verifyEmailRedirectPath)) { setVerifyEmailRedirectPath(undefined); } diff --git a/packages/twenty-front/src/pages/settings/SettingsBilling.tsx b/packages/twenty-front/src/pages/settings/SettingsBilling.tsx index f274c6b075..199d2f9f09 100644 --- a/packages/twenty-front/src/pages/settings/SettingsBilling.tsx +++ b/packages/twenty-front/src/pages/settings/SettingsBilling.tsx @@ -1,6 +1,6 @@ import { Trans, useLingui } from '@lingui/react/macro'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { SettingsBillingContent } from '@/billing/components/SettingsBillingContent'; import { getSettingsPath } from 'twenty-shared/utils'; @@ -10,7 +10,7 @@ import { usePlans } from '@/billing/hooks/usePlans'; export const SettingsBilling = () => { const { t } = useLingui(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { isPlansLoaded } = usePlans(); diff --git a/packages/twenty-front/src/pages/settings/SettingsProfile.tsx b/packages/twenty-front/src/pages/settings/SettingsProfile.tsx index b172f008ff..075064b719 100644 --- a/packages/twenty-front/src/pages/settings/SettingsProfile.tsx +++ b/packages/twenty-front/src/pages/settings/SettingsProfile.tsx @@ -10,7 +10,7 @@ import { useCanChangePassword } from '@/settings/profile/hooks/useCanChangePassw import { useCurrentUserWorkspaceTwoFactorAuthentication } from '@/settings/two-factor-authentication/hooks/useCurrentUserWorkspaceTwoFactorAuthentication'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { Trans, useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; import { H2Title, IconShield, Status } from 'twenty-ui/display'; @@ -19,7 +19,7 @@ import { UndecoratedLink } from 'twenty-ui/navigation'; export const SettingsProfile = () => { const { t } = useLingui(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { currentUserWorkspaceTwoFactorAuthenticationMethods } = useCurrentUserWorkspaceTwoFactorAuthentication(); diff --git a/packages/twenty-front/src/pages/settings/SettingsTwoFactorAuthenticationMethod.tsx b/packages/twenty-front/src/pages/settings/SettingsTwoFactorAuthenticationMethod.tsx index 1f34939127..644753f22c 100644 --- a/packages/twenty-front/src/pages/settings/SettingsTwoFactorAuthenticationMethod.tsx +++ b/packages/twenty-front/src/pages/settings/SettingsTwoFactorAuthenticationMethod.tsx @@ -18,7 +18,7 @@ import { getSettingsPath } from 'twenty-shared/utils'; import { H2Title } from 'twenty-ui/display'; import { Loader } from 'twenty-ui/feedback'; import { Section } from 'twenty-ui/layout'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useCopyToClipboard } from '~/hooks/useCopyToClipboard'; const StyledQRCodeContainer = styled.div` @@ -79,7 +79,7 @@ const StyledDivider = styled.div` export const SettingsTwoFactorAuthenticationMethod = () => { const { t } = useLingui(); const { copyToClipboard } = useCopyToClipboard(); - const qrCode = useRecoilValueV2(qrCodeState); + const qrCode = useAtomStateValue(qrCodeState); const { currentUserWorkspaceTwoFactorAuthenticationMethods } = useCurrentUserWorkspaceTwoFactorAuthentication(); diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx index 7ff538ad23..2ed63ae55e 100644 --- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx +++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccounts.tsx @@ -10,7 +10,7 @@ import { SettingsAccountsSettingsSection } from '@/settings/accounts/components/ import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; import { H2Title } from 'twenty-ui/display'; @@ -18,7 +18,7 @@ import { Section } from 'twenty-ui/layout'; export const SettingsAccounts = () => { const { t } = useLingui(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { recordGqlFields } = useGenerateDepthRecordGqlFieldsFromObject({ objectNameSingular: CoreObjectNameSingular.ConnectedAccount, diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsx index 907c1dcfb4..52d74c9e92 100644 --- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsx +++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsConfiguration.tsx @@ -1,7 +1,7 @@ import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type CalendarChannel } from '@/accounts/types/CalendarChannel'; import { type MessageChannel } from '@/accounts/types/MessageChannel'; @@ -30,7 +30,7 @@ export const SettingsAccountsConfiguration = () => { const { enqueueSuccessSnackBar, enqueueErrorSnackBar } = useSnackBar(); const [startChannelSyncMutation, { loading: isSubmitting }] = useStartChannelSyncMutation(); - const setSelectedMessageChannel = useSetRecoilStateV2( + const setSelectedMessageChannel = useSetAtomState( settingsAccountsSelectedMessageChannelStateV2, ); diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminConfigVariableDetails.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminConfigVariableDetails.tsx index 804561081b..a71e25612a 100644 --- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminConfigVariableDetails.tsx +++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminConfigVariableDetails.tsx @@ -13,7 +13,7 @@ import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLo import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath, type ConfigVariableValue } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { H3Title, IconCheck, IconPencil, IconX } from 'twenty-ui/display'; @@ -54,7 +54,7 @@ export const SettingsAdminConfigVariableDetails = () => { const { t } = useLingui(); const [isEditing, setIsEditing] = useState(false); const { openModal } = useModal(); - const isConfigVariablesInDbEnabled = useRecoilValueV2( + const isConfigVariablesInDbEnabled = useAtomStateValue( isConfigVariablesInDbEnabledState, ); diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsx index fd025d016b..2c1a3985c3 100644 --- a/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsx +++ b/packages/twenty-front/src/pages/settings/ai/SettingsAI.tsx @@ -6,7 +6,7 @@ import { SettingsPageContainer } from '@/settings/components/SettingsPageContain import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; @@ -32,7 +32,7 @@ const StyledLink = styled(Link)` `; export const SettingsAI = () => { - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, SETTINGS_AI_TABS.COMPONENT_INSTANCE_ID, ); diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsAIPrompts.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsAIPrompts.tsx index 4b02534278..8d52705f64 100644 --- a/packages/twenty-front/src/pages/settings/ai/SettingsAIPrompts.tsx +++ b/packages/twenty-front/src/pages/settings/ai/SettingsAIPrompts.tsx @@ -10,8 +10,8 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { t } from '@lingui/core/macro'; import { useState } from 'react'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { H2Title } from 'twenty-ui/display'; @@ -39,10 +39,10 @@ const StyledTokenBadge = styled.span` export const SettingsAIPrompts = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const [updateWorkspace] = useUpdateWorkspaceMutation(); const { data: previewData, loading: previewLoading } = diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsAgentForm.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsAgentForm.tsx index 4d402146af..66e48e6cbb 100644 --- a/packages/twenty-front/src/pages/settings/ai/SettingsAgentForm.tsx +++ b/packages/twenty-front/src/pages/settings/ai/SettingsAgentForm.tsx @@ -13,7 +13,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { AppPath, SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; @@ -33,8 +33,8 @@ import { import { useNavigateApp } from '~/hooks/useNavigateApp'; import { useNavigateSettings } from '~/hooks/useNavigateSettings'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useEffect, useState } from 'react'; import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; import { SettingsAgentDetailSkeletonLoader } from './components/SettingsAgentDetailSkeletonLoader'; @@ -71,7 +71,7 @@ export const SettingsAgentForm = ({ mode }: { mode: 'create' | 'edit' }) => { const isCreateMode = mode === 'create'; const tabListComponentId = `${SETTINGS_AGENT_DETAIL_TABS.COMPONENT_INSTANCE_ID}-${agentId}`; - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, tabListComponentId, ); @@ -129,15 +129,15 @@ export const SettingsAgentForm = ({ mode }: { mode: 'create' | 'edit' }) => { const agent = data?.findOneAgent; - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, formValues.role || '', ); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, formValues.role || '', ); - const settingsPersistedRole = useFamilyRecoilValueV2( + const settingsPersistedRole = useAtomFamilyStateValue( settingsPersistedRoleFamilyState, formValues.role || '', ); diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAIModelsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAIModelsTab.tsx index 0cae768ec2..327cfe36c0 100644 --- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAIModelsTab.tsx +++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAIModelsTab.tsx @@ -12,8 +12,8 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { Select } from '@/ui/input/components/Select'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { t } from '@lingui/core/macro'; import { H2Title, @@ -37,12 +37,12 @@ const StyledSearchInput = styled(SettingsTextInput)` export const SettingsAIModelsTab = () => { const { enqueueErrorSnackBar } = useSnackBar(); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); const [updateWorkspace] = useUpdateWorkspaceMutation(); const [searchQuery, setSearchQuery] = useState(''); - const aiModels = useRecoilValueV2(aiModelsState); + const aiModels = useAtomStateValue(aiModelsState); const { allModelsWithAvailability, diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx index 35146908fa..08d12864e2 100644 --- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx +++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentEvalsTab.tsx @@ -10,7 +10,7 @@ import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown'; import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal'; import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { useMutation } from '@apollo/client'; import { getOperationName } from '@apollo/client/utilities'; import styled from '@emotion/styled'; @@ -70,7 +70,7 @@ export const SettingsAgentEvalsTab = ({ const navigate = useNavigate(); const tabListComponentId = `${SETTINGS_AGENT_DETAIL_TABS.COMPONENT_INSTANCE_ID}-${agentId}`; - const setActiveTabId = useSetRecoilComponentStateV2( + const setActiveTabId = useSetAtomComponentState( activeTabIdComponentState, tabListComponentId, ); diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx index 189f62412e..cb9c1462e1 100644 --- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx +++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentModelCapabilities.tsx @@ -8,7 +8,7 @@ import { isDefined } from 'twenty-shared/utils'; import { IconBrandX, IconWorld } from 'twenty-ui/display'; import { Checkbox } from 'twenty-ui/input'; import { Section } from 'twenty-ui/layout'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledCheckboxContainer = styled.div<{ disabled: boolean }>` display: flex; @@ -57,7 +57,7 @@ export const SettingsAgentModelCapabilities = ({ disabled = false, }: SettingsAgentModelCapabilitiesProps) => { const theme = useTheme(); - const aiModels = useRecoilValueV2(aiModelsState); + const aiModels = useAtomStateValue(aiModelsState); const selectedModel = aiModels.find((m) => m.modelId === selectedModelId); const nativeCapabilities = selectedModel?.nativeCapabilities; diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentRoleTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentRoleTab.tsx index d8a8817684..5665c50864 100644 --- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentRoleTab.tsx +++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentRoleTab.tsx @@ -7,7 +7,7 @@ import { v4 } from 'uuid'; import { GET_ROLES } from '@/settings/roles/graphql/queries/getRolesQuery'; import { SettingsRolePermissions } from '@/settings/roles/role-permissions/components/SettingsRolePermissions'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { isNonEmptyString } from '@sniptt/guards'; import { isDefined } from 'twenty-shared/utils'; import { H2Title, IconPlus } from 'twenty-ui/display'; @@ -50,7 +50,7 @@ export const SettingsAgentRoleTab = ({ const { data: rolesData } = useGetRolesQuery(); const [createRole] = useCreateOneRoleMutation(); const [assignRoleToAgent] = useAssignRoleToAgentMutation(); - const setSettingsDraftRole = useSetFamilyRecoilStateV2( + const setSettingsDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, formValues.role || '', ); diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx index c8d68cfb84..fc2f6f3ea9 100644 --- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx +++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSettingsTab.tsx @@ -21,7 +21,7 @@ import { SettingsAgentResponseFormat } from '~/pages/settings/ai/components/Sett import { computeMetadataNameFromLabel } from '~/pages/settings/data-model/utils/computeMetadataNameFromLabel'; import { SettingsAgentModelCapabilities } from '~/pages/settings/ai/components/SettingsAgentModelCapabilities'; import { type SettingsAIAgentFormValues } from '~/pages/settings/ai/hooks/useSettingsAgentFormState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; const StyledFormContainer = styled.div` display: flex; @@ -66,7 +66,7 @@ export const SettingsAgentSettingsTab = ({ const { t } = useLingui(); const { openModal } = useModal(); - const aiModels = useRecoilValueV2(aiModelsState); + const aiModels = useAtomStateValue(aiModelsState); const activeModelOptions = useAiModelOptions(); const currentModelLabel = useAiModelLabel(formValues.modelId); diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx index aa02c6eda6..9546945cff 100644 --- a/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx +++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsToolsTable.tsx @@ -6,7 +6,7 @@ import Skeleton from 'react-loading-skeleton'; import { useGetToolIndex } from '@/ai/hooks/useGetToolIndex'; import { usePersistLogicFunction } from '@/logic-functions/hooks/usePersistLogicFunction'; import { logicFunctionsState } from '@/settings/logic-functions/states/logicFunctionsState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput'; import { Table } from '@/ui/layout/table/components/Table'; @@ -55,7 +55,7 @@ const StyledFooterContainer = styled.div` `; export const SettingsToolsTable = () => { - const logicFunctions = useRecoilValueV2(logicFunctionsState); + const logicFunctions = useAtomStateValue(logicFunctionsState); const { toolIndex, loading: toolIndexLoading } = useGetToolIndex(); const { createLogicFunction } = usePersistLogicFunction(); diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx index e993c19fff..9ebeb558c5 100644 --- a/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx +++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplicationDetails.tsx @@ -14,7 +14,7 @@ import { import { SettingsApplicationDetailSkeletonLoader } from '~/pages/settings/applications/components/SettingsApplicationDetailSkeletonLoader'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { SettingsApplicationDetailContentTab } from '~/pages/settings/applications/tabs/SettingsApplicationDetailContentTab'; import { SettingsApplicationDetailAboutTab } from '~/pages/settings/applications/tabs/SettingsApplicationDetailAboutTab'; import { SettingsApplicationDetailSettingsTab } from '~/pages/settings/applications/tabs/SettingsApplicationDetailSettingsTab'; @@ -25,7 +25,7 @@ const APPLICATION_DETAIL_ID = 'application-detail-id'; export const SettingsApplicationDetails = () => { const { applicationId = '' } = useParams<{ applicationId: string }>(); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, APPLICATION_DETAIL_ID, ); diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsx index c636e3b61d..712db07dda 100644 --- a/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsx +++ b/packages/twenty-front/src/pages/settings/applications/SettingsApplications.tsx @@ -2,7 +2,7 @@ import { SettingsPageContainer } from '@/settings/components/SettingsPageContain import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useLingui } from '@lingui/react/macro'; import { SettingsPath } from 'twenty-shared/types'; @@ -26,7 +26,7 @@ export const SettingsApplications = () => { 'IS_MARKETPLACE_ENABLED' as FeatureFlagKey, ); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, APPLICATIONS_TAB_LIST_ID, ); diff --git a/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsx b/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsx index 62c5672030..dd5bd8df4b 100644 --- a/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsx +++ b/packages/twenty-front/src/pages/settings/applications/SettingsAvailableApplicationDetails.tsx @@ -4,7 +4,7 @@ import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFla import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import styled from '@emotion/styled'; import { t } from '@lingui/core/macro'; import { useMemo, useState } from 'react'; @@ -260,7 +260,7 @@ export const SettingsAvailableApplicationDetails = () => { } }; - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, AVAILABLE_APPLICATION_DETAIL_ID, ); diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx index b4fb826b1c..ba256ed885 100644 --- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx +++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailContentTab.tsx @@ -3,7 +3,7 @@ import { isHiddenSystemField } from '@/object-metadata/utils/isHiddenSystemField import { SettingsLogicFunctionsTable } from '@/settings/logic-functions/components/SettingsLogicFunctionsTable'; import { t } from '@lingui/core/macro'; import { useMemo } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { H2Title } from 'twenty-ui/display'; @@ -23,7 +23,7 @@ export const SettingsApplicationDetailContentTab = ({ objects: { id: string }[]; }; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const applicationObjectIds = useMemo( () => application?.objects.map((object) => object.id) ?? [], diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationPermissionsTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationPermissionsTab.tsx index 54b7296b3f..071aec8d79 100644 --- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationPermissionsTab.tsx +++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationPermissionsTab.tsx @@ -5,10 +5,10 @@ import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRo import { SettingsRolePermissions } from '@/settings/roles/role-permissions/components/SettingsRolePermissions'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { type RoleWithPartialMembers } from '@/settings/roles/types/RoleWithPartialMembers'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { t } from '@lingui/core/macro'; import { useCallback, useEffect, useMemo, useState } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { STANDARD_OBJECTS } from 'twenty-shared/metadata'; import { isDefined } from 'twenty-shared/utils'; import { v4 as uuidv4 } from 'uuid'; @@ -281,8 +281,8 @@ const MarketplaceRoleEffect = ({ items: ObjectMetadataItem[], ) => void; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const setDraftRole = useSetFamilyRecoilStateV2( + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const setDraftRole = useSetAtomFamilyState( settingsDraftRoleFamilyState, defaultRole.id, ); diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsCreateTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsCreateTab.tsx index fdd803ba17..11120f2920 100644 --- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsCreateTab.tsx +++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsCreateTab.tsx @@ -2,7 +2,7 @@ import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMembe import { getDocumentationUrl } from '@/support/utils/getDocumentationUrl'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { CommandBlock, H2Title, @@ -20,7 +20,7 @@ const StyledButtonContainer = styled.div` export const SettingsApplicationsCreateTab = () => { const { t } = useLingui(); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const { copyToClipboard } = useCopyToClipboard(); diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsAvailableApplicationDetailContentTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsAvailableApplicationDetailContentTab.tsx index 31e4bfdbbb..61e6da337a 100644 --- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsAvailableApplicationDetailContentTab.tsx +++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsAvailableApplicationDetailContentTab.tsx @@ -1,7 +1,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { t } from '@lingui/core/macro'; import { useMemo } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { type MarketplaceApp } from '~/generated-metadata/graphql'; @@ -18,7 +18,7 @@ export const SettingsAvailableApplicationDetailContentTab = ({ }: { application: MarketplaceApp; }) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const { objects, fields, logicFunctions, frontComponents } = application; diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsNewObject.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsNewObject.tsx index 241b53d61f..5ce1fad73e 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsNewObject.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsNewObject.tsx @@ -14,7 +14,7 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { useLingui } from '@lingui/react/macro'; import { useState } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { H2Title } from 'twenty-ui/display'; @@ -26,7 +26,7 @@ export const SettingsNewObject = () => { const navigate = useNavigateSettings(); const [isLoading, setIsLoading] = useState(false); const { createOneObjectMetadataItem } = useCreateOneObjectMetadataItem(); - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const formConfig = useForm({ mode: 'onChange', diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx index a7e6d810b4..34c310f9e2 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx @@ -9,15 +9,15 @@ import { ObjectSettings } from '@/settings/data-model/object-details/components/ import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import styled from '@emotion/styled'; import { AppPath, SettingsPath } from 'twenty-shared/types'; import { isObjectMetadataReadOnly } from '@/object-record/read-only/utils/isObjectMetadataReadOnly'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { useTheme } from '@emotion/react'; import { useLingui } from '@lingui/react/macro'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; @@ -51,8 +51,9 @@ export const SettingsObjectDetailPage = () => { const { findObjectMetadataItemByNamePlural } = useFilteredObjectMetadataItems(); - const [updatedObjectNamePlural, setUpdatedObjectNamePlural] = - useRecoilStateV2(updatedObjectNamePluralState); + const [updatedObjectNamePlural, setUpdatedObjectNamePlural] = useAtomState( + updatedObjectNamePluralState, + ); const objectMetadataItem = findObjectMetadataItemByNamePlural(objectNamePlural) ?? findObjectMetadataItemByNamePlural(updatedObjectNamePlural); @@ -61,12 +62,12 @@ export const SettingsObjectDetailPage = () => { objectMetadataItem, }); - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, SETTINGS_OBJECT_DETAIL_TABS.COMPONENT_INSTANCE_ID, ); - const isAdvancedModeEnabled = useRecoilValueV2(isAdvancedModeEnabledState); + const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState); const isUniqueIndexesEnabled = useIsFeatureEnabled( FeatureFlagKey.IS_UNIQUE_INDEXES_ENABLED, ); diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx index 10d91318fb..1e6ab59331 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldEdit.tsx @@ -27,7 +27,7 @@ import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; import { shouldNavigateBackToMemorizedUrlOnSaveState } from '@/ui/navigation/states/shouldNavigateBackToMemorizedUrlOnSaveState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { AppPath, SettingsPath } from 'twenty-shared/types'; @@ -67,14 +67,14 @@ export const SettingsObjectFieldEdit = () => { const navigate = useNavigate(); - const [navigationMemorizedUrl, setNavigationMemorizedUrl] = useRecoilStateV2( + const [navigationMemorizedUrl, setNavigationMemorizedUrl] = useAtomState( navigationMemorizedUrlState, ); const [ shouldNavigateBackToMemorizedUrlOnSave, setShouldNavigateBackToMemorizedUrlOnSave, - ] = useRecoilStateV2(shouldNavigateBackToMemorizedUrlOnSaveState); + ] = useAtomState(shouldNavigateBackToMemorizedUrlOnSaveState); const { objectNamePlural = '', fieldName = '' } = useParams(); diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx index 09bb471d5e..504d1a709e 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx @@ -15,12 +15,12 @@ import { TableHeader } from '@/ui/layout/table/components/TableHeader'; import { useSortedArray } from '@/ui/layout/table/hooks/useSortedArray'; import { type TableMetadata } from '@/ui/layout/table/types/TableMetadata'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { msg } from '@lingui/core/macro'; import { useLingui } from '@lingui/react/macro'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useEffect, useMemo, useState } from 'react'; import { FieldMetadataType } from 'twenty-shared/types'; import { @@ -92,18 +92,18 @@ export const SettingsObjectFieldTable = ({ const [showInactive, setShowInactive] = useState(true); const [showSystemFields, setShowSystemFields] = useState(false); - const isAdvancedModeEnabled = useRecoilValueV2(isAdvancedModeEnabledState); + const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState); const tableMetadata = SETTINGS_OBJECT_FIELD_TABLE_METADATA; const { mapFieldMetadataItemToSettingsObjectDetailTableItem } = useMapFieldMetadataItemToSettingsObjectDetailTableItem(objectMetadataItem); - const settingsObjectFields = useFamilyRecoilValueV2( + const settingsObjectFields = useAtomFamilyStateValue( settingsObjectFieldsFamilyState, { objectMetadataItemId: objectMetadataItem.id }, ); - const setSettingsObjectFields = useSetFamilyRecoilStateV2( + const setSettingsObjectFields = useSetAtomFamilyState( settingsObjectFieldsFamilyState, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectIndexTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectIndexTable.tsx index 1d8a2dcccc..2becd17199 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectIndexTable.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectIndexTable.tsx @@ -12,8 +12,8 @@ import styled from '@emotion/styled'; import { msg } from '@lingui/core/macro'; import { useLingui } from '@lingui/react/macro'; import { isNonEmptyArray } from '@sniptt/guards'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useEffect, useMemo, useState } from 'react'; import { IconSearch, IconSquareKey } from 'twenty-ui/display'; import { type SettingsObjectIndexesTableItem } from '~/pages/settings/data-model/types/SettingsObjectIndexesTableItem'; @@ -67,11 +67,11 @@ export const SettingsObjectIndexTable = ({ }, }; - const settingsObjectIndexes = useFamilyRecoilValueV2( + const settingsObjectIndexes = useAtomFamilyStateValue( settingsObjectIndexesFamilyState, { objectMetadataItemId: objectMetadataItem.id }, ); - const setSettingsObjectIndexes = useSetFamilyRecoilStateV2( + const setSettingsObjectIndexes = useSetAtomFamilyState( settingsObjectIndexesFamilyState, { objectMetadataItemId: objectMetadataItem.id }, ); diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx index aae79687b1..84cffd3251 100644 --- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx +++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx @@ -16,7 +16,7 @@ import { Table } from '@/ui/layout/table/components/Table'; import { TableHeader } from '@/ui/layout/table/components/TableHeader'; import { useSortedArray } from '@/ui/layout/table/hooks/useSortedArray'; import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; @@ -49,7 +49,7 @@ export const SettingsObjectTable = ({ const theme = useTheme(); - const isAdvancedModeEnabled = useRecoilValueV2(isAdvancedModeEnabledState); + const isAdvancedModeEnabled = useAtomStateValue(isAdvancedModeEnabledState); const [searchTerm, setSearchTerm] = useState(''); const [showDeactivated, setShowDeactivated] = useState(true); @@ -62,7 +62,7 @@ export const SettingsObjectTable = ({ const { totalCountByObjectMetadataItemNamePlural } = useCombinedGetTotalCount(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const allObjectSettingsArray = useMemo( () => diff --git a/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectNamePluralState.ts b/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectNamePluralState.ts index 3f36f790cc..31a7a33d2e 100644 --- a/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectNamePluralState.ts +++ b/packages/twenty-front/src/pages/settings/data-model/states/updatedObjectNamePluralState.ts @@ -1,5 +1,5 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; -export const updatedObjectNamePluralState = createStateV2({ +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; +export const updatedObjectNamePluralState = createAtomState({ key: 'updatedObjectNamePluralState', defaultValue: '', }); diff --git a/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx b/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx index 9603d2f528..19e93a2bb0 100644 --- a/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx +++ b/packages/twenty-front/src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx @@ -10,7 +10,7 @@ import { ApiKeyInput } from '@/settings/developers/components/ApiKeyInput'; import { ApiKeyNameInput } from '@/settings/developers/components/ApiKeyNameInput'; import { SettingsDevelopersRoleSelector } from '@/settings/developers/components/SettingsDevelopersRoleSelector'; import { apiKeyTokenFamilyState } from '@/settings/developers/states/apiKeyTokenFamilyState'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { computeNewExpirationDate } from '@/settings/developers/utils/computeNewExpirationDate'; import { formatExpiration } from '@/settings/developers/utils/formatExpiration'; import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; @@ -62,7 +62,7 @@ export const SettingsDevelopersApiKeyDetail = () => { const jotaiStore = useStore(); - const apiKeyToken = useFamilyRecoilValueV2(apiKeyTokenFamilyState, apiKeyId); + const apiKeyToken = useAtomFamilyStateValue(apiKeyTokenFamilyState, apiKeyId); const setApiKeyTokenCallback = useCallback( (apiKeyId: string, token: string) => { diff --git a/packages/twenty-front/src/pages/settings/domains/SettingsDomain.tsx b/packages/twenty-front/src/pages/settings/domains/SettingsDomain.tsx index 8d9fcd401a..bdd6e037c4 100644 --- a/packages/twenty-front/src/pages/settings/domains/SettingsDomain.tsx +++ b/packages/twenty-front/src/pages/settings/domains/SettingsDomain.tsx @@ -13,8 +13,8 @@ import { ApolloError } from '@apollo/client'; import { zodResolver } from '@hookform/resolvers/zod'; import { Trans, useLingui } from '@lingui/react/macro'; import { FormProvider, useForm } from 'react-hook-form'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; import { z } from 'zod'; @@ -35,7 +35,7 @@ export const SettingsDomain = () => { const navigate = useNavigateSettings(); const { checkCustomDomainRecords } = useCheckCustomDomainValidRecords(); const { t } = useLingui(); - const isCloudflareIntegrationEnabled = useRecoilValueV2( + const isCloudflareIntegrationEnabled = useAtomStateValue( isCloudflareIntegrationEnabledState, ); @@ -51,7 +51,7 @@ export const SettingsDomain = () => { const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain(); const [isSubmitting, setIsSubmitting] = useState(false); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); diff --git a/packages/twenty-front/src/pages/settings/emailing-domains/SettingsEmailingDomains.tsx b/packages/twenty-front/src/pages/settings/emailing-domains/SettingsEmailingDomains.tsx index 174a2df0cd..edfb786ac0 100644 --- a/packages/twenty-front/src/pages/settings/emailing-domains/SettingsEmailingDomains.tsx +++ b/packages/twenty-front/src/pages/settings/emailing-domains/SettingsEmailingDomains.tsx @@ -5,7 +5,7 @@ import { SettingsListCard } from '@/settings/components/SettingsListCard'; import { SettingsEmailingDomainRowDropdownMenu } from '@/settings/emailing-domains/components/SettingsEmailingDomainRowDropdownMenu'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { SettingsPath } from 'twenty-shared/types'; @@ -23,7 +23,7 @@ const StyledLink = styled(Link)` export const SettingsEmailingDomains = () => { const { t } = useLingui(); - const { localeCatalog } = useRecoilValueV2(dateLocaleState); + const { localeCatalog } = useAtomStateValue(dateLocaleState); const navigate = useNavigate(); const { data, loading: isLoading } = useGetEmailingDomainsQuery(); diff --git a/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsx b/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsx index 150458924c..c6b23869a0 100644 --- a/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsx +++ b/packages/twenty-front/src/pages/settings/logic-functions/SettingsLogicFunctionDetail.tsx @@ -9,7 +9,7 @@ import { SettingsLogicFunctionTriggersTab } from '@/settings/logic-functions/com import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; @@ -21,7 +21,7 @@ import { } from 'twenty-ui/display'; import { useFindOneApplicationQuery } from '~/generated-metadata/graphql'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsLogicFunctionCodeEditorTab } from '@/settings/logic-functions/components/tabs/SettingsLogicFunctionCodeEditorTab'; const LOGIC_FUNCTION_DETAIL_ID = 'logic-function-detail'; @@ -30,7 +30,7 @@ export const SettingsLogicFunctionDetail = () => { const { logicFunctionId = '', applicationId = '' } = useParams(); const navigate = useNavigate(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { data, loading: applicationLoading } = useFindOneApplicationQuery({ variables: { id: applicationId }, @@ -46,7 +46,7 @@ export const SettingsLogicFunctionDetail = () => { const instanceId = `${LOGIC_FUNCTION_DETAIL_ID}-${logicFunctionId}`; - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, instanceId, ); diff --git a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx index 8894a78262..fc7356b0f5 100644 --- a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx +++ b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMember.tsx @@ -13,9 +13,9 @@ import { useModal } from '@/ui/layout/modal/hooks/useModal'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; import { TabList } from '@/ui/layout/tab-list/components/TabList'; import { activeTabIdComponentState } from '@/ui/layout/tab-list/states/activeTabIdComponentState'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; import { t } from '@lingui/core/macro'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath } from 'twenty-shared/utils'; import { IconInfoCircle, IconLockOpen } from 'twenty-ui/display'; @@ -49,10 +49,10 @@ export const SettingsWorkspaceMember = () => { const navigateSettings = useNavigateSettings(); const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar(); const { openModal, closeModal } = useModal(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); const { executeImpersonationAuth } = useImpersonationAuth(); const [impersonate] = useImpersonateMutation(); - const isImpersonating = useRecoilValueV2(isImpersonatingState); + const isImpersonating = useAtomStateValue(isImpersonatingState); const canImpersonate = useHasPermissionFlag(PermissionFlagType.IMPERSONATE) && !isImpersonating; @@ -75,7 +75,7 @@ export const SettingsWorkspaceMember = () => { }); const tabListComponentId = `${SETTINGS_WORKSPACE_MEMBER_TABS.COMPONENT_INSTANCE_ID}-${workspaceMemberId}`; - const activeTabId = useRecoilComponentValueV2( + const activeTabId = useAtomComponentStateValue( activeTabIdComponentState, tabListComponentId, ); diff --git a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx index b12dd9e778..8403e58f70 100644 --- a/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx +++ b/packages/twenty-front/src/pages/settings/members/SettingsWorkspaceMembers.tsx @@ -4,9 +4,9 @@ import { Trans, useLingui } from '@lingui/react/macro'; import { isNonEmptyArray } from '@sniptt/guards'; import { useMemo, useState } from 'react'; import { useInView } from 'react-intersection-observer'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { useDebounce } from 'use-debounce'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; @@ -116,7 +116,7 @@ export const SettingsWorkspaceMembers = () => { const navigateSettings = useNavigateSettings(); const [isFetchingMore, setIsFetchingMore] = useState(false); const [searchFilter, setSearchFilter] = useState(''); - const currentWorkspaceMember = useRecoilValueV2(currentWorkspaceMemberState); + const currentWorkspaceMember = useAtomStateValue(currentWorkspaceMemberState); const [debouncedSearchFilter] = useDebounce(searchFilter, 300); @@ -151,12 +151,10 @@ export const SettingsWorkspaceMembers = () => { const { resendInvitation } = useResendWorkspaceInvitation(); const { deleteWorkspaceInvitation } = useDeleteWorkspaceInvitation(); - const currentWorkspace = useRecoilValueV2(currentWorkspaceState); + const currentWorkspace = useAtomStateValue(currentWorkspaceState); - const workspaceInvitations = useRecoilValueV2(workspaceInvitationsState); - const setWorkspaceInvitations = useSetRecoilStateV2( - workspaceInvitationsState, - ); + const workspaceInvitations = useAtomStateValue(workspaceInvitationsState); + const setWorkspaceInvitations = useSetAtomState(workspaceInvitationsState); const handleSearchChange = (text: string) => { setSearchFilter(text); diff --git a/packages/twenty-front/src/pages/settings/profile/appearance/components/LocalePicker.tsx b/packages/twenty-front/src/pages/settings/profile/appearance/components/LocalePicker.tsx index 8dfbd75c8d..9ad187896b 100644 --- a/packages/twenty-front/src/pages/settings/profile/appearance/components/LocalePicker.tsx +++ b/packages/twenty-front/src/pages/settings/profile/appearance/components/LocalePicker.tsx @@ -1,7 +1,7 @@ import styled from '@emotion/styled'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; import { getDateFnsLocale } from '@/ui/field/display/utils/getDateFnsLocale.util'; @@ -27,7 +27,7 @@ const StyledContainer = styled.div` export const LocalePicker = () => { const { t } = useLingui(); const store = useStore(); - const [currentWorkspaceMember, setCurrentWorkspaceMember] = useRecoilStateV2( + const [currentWorkspaceMember, setCurrentWorkspaceMember] = useAtomState( currentWorkspaceMemberState, ); const { updateOneRecord } = useUpdateOneRecord(); diff --git a/packages/twenty-front/src/pages/settings/roles/SettingsRoleAddObjectLevel.tsx b/packages/twenty-front/src/pages/settings/roles/SettingsRoleAddObjectLevel.tsx index 23edfa27e9..8050aa3854 100644 --- a/packages/twenty-front/src/pages/settings/roles/SettingsRoleAddObjectLevel.tsx +++ b/packages/twenty-front/src/pages/settings/roles/SettingsRoleAddObjectLevel.tsx @@ -3,7 +3,7 @@ import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRo import { SettingsRolePermissionsObjectLevelObjectPicker } from '@/settings/roles/role-permissions/object-level-permissions/components/SettingsRolePermissionsObjectLevelObjectPicker'; import { settingsDraftRoleFamilyState } from '@/settings/roles/states/settingsDraftRoleFamilyState'; import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { t } from '@lingui/core/macro'; import { Navigate, useParams, useSearchParams } from 'react-router-dom'; import { SettingsPath } from 'twenty-shared/types'; @@ -15,7 +15,7 @@ export const SettingsRoleAddObjectLevel = () => { const [searchParams] = useSearchParams(); const fromAgentId = searchParams.get('fromAgent'); - const settingsDraftRole = useFamilyRecoilValueV2( + const settingsDraftRole = useAtomFamilyStateValue( settingsDraftRoleFamilyState, roleId ?? '', ); diff --git a/packages/twenty-front/src/pages/settings/roles/SettingsRoleEdit.tsx b/packages/twenty-front/src/pages/settings/roles/SettingsRoleEdit.tsx index 5cc17f2961..a11c11ff89 100644 --- a/packages/twenty-front/src/pages/settings/roles/SettingsRoleEdit.tsx +++ b/packages/twenty-front/src/pages/settings/roles/SettingsRoleEdit.tsx @@ -1,7 +1,7 @@ import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect'; import { SettingsRole } from '@/settings/roles/role/components/SettingsRole'; import { SettingsRoleEditEffect } from '@/settings/roles/role/components/SettingsRoleEditEffect'; -import { useFamilyRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilyRecoilValueV2'; +import { useAtomFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilyStateValue'; import { Navigate, useParams } from 'react-router-dom'; import { SettingsPath } from 'twenty-shared/types'; import { getSettingsPath, isDefined } from 'twenty-shared/utils'; @@ -10,7 +10,7 @@ import { settingsPersistedRoleFamilyState } from '~/modules/settings/roles/state export const SettingsRoleEdit = () => { const { roleId } = useParams(); - const persistedRole = useFamilyRecoilValueV2( + const persistedRole = useAtomFamilyStateValue( settingsPersistedRoleFamilyState, roleId ?? '', ); diff --git a/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx b/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx index 08cae0db91..a7079ebc38 100644 --- a/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx +++ b/packages/twenty-front/src/pages/settings/security/SettingsSecurity.tsx @@ -34,8 +34,8 @@ import { import { Button } from 'twenty-ui/input'; import { Card, Section } from 'twenty-ui/layout'; import { useUpdateWorkspaceMutation } from '~/generated-metadata/graphql'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; const StyledContainer = styled.div` width: 100%; @@ -63,13 +63,13 @@ export const SettingsSecurity = () => { const { t } = useLingui(); const { enqueueErrorSnackBar } = useSnackBar(); - const isMultiWorkspaceEnabled = useRecoilValueV2( + const isMultiWorkspaceEnabled = useAtomStateValue( isMultiWorkspaceEnabledState, ); - const isClickHouseConfigured = useRecoilValueV2(isClickHouseConfiguredState); - const authProviders = useRecoilValueV2(authProvidersState); - const SSOIdentitiesProviders = useRecoilValueV2(SSOIdentitiesProvidersState); - const [currentWorkspace, setCurrentWorkspace] = useRecoilStateV2( + const isClickHouseConfigured = useAtomStateValue(isClickHouseConfiguredState); + const authProviders = useAtomStateValue(authProvidersState); + const SSOIdentitiesProviders = useAtomStateValue(SSOIdentitiesProvidersState); + const [currentWorkspace, setCurrentWorkspace] = useAtomState( currentWorkspaceState, ); const [updateWorkspace] = useUpdateWorkspaceMutation(); diff --git a/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogFilters.tsx b/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogFilters.tsx index fd8e8b1608..63a9c1d9b5 100644 --- a/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogFilters.tsx +++ b/packages/twenty-front/src/pages/settings/security/event-logs/components/EventLogFilters.tsx @@ -1,7 +1,7 @@ import styled from '@emotion/styled'; import { useLingui } from '@lingui/react/macro'; import { currentWorkspaceMembersState } from '@/auth/states/currentWorkspaceMembersState'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems'; import { Select } from '@/ui/input/components/Select'; import { TextInput } from '@/ui/input/components/TextInput'; @@ -38,7 +38,7 @@ export const EventLogFilters = ({ onChange, }: EventLogFiltersProps) => { const { t } = useLingui(); - const currentWorkspaceMembers = useRecoilValueV2( + const currentWorkspaceMembers = useAtomStateValue( currentWorkspaceMembersState, ); const { objectMetadataItems } = useObjectMetadataItems(); diff --git a/packages/twenty-front/src/testing/decorators/ContextStoreDecorator.tsx b/packages/twenty-front/src/testing/decorators/ContextStoreDecorator.tsx index c56334f6a6..d5e9eb2998 100644 --- a/packages/twenty-front/src/testing/decorators/ContextStoreDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/ContextStoreDecorator.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'; import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId'; import { contextStoreCurrentObjectMetadataItemIdComponentState } from '@/context-store/states/contextStoreCurrentObjectMetadataItemIdComponentState'; import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { isUndefined } from '@sniptt/guards'; import { getMockCompanyObjectMetadataItem } from '~/testing/mock-data/companies'; @@ -17,7 +17,7 @@ export const ContextStoreDecorator: Decorator = (Story, context) => { componentInstanceId = MAIN_CONTEXT_STORE_INSTANCE_ID; } - const setCurrentObjectMetadataItemId = useSetRecoilComponentStateV2( + const setCurrentObjectMetadataItemId = useSetAtomComponentState( contextStoreCurrentObjectMetadataItemIdComponentState, componentInstanceId, ); diff --git a/packages/twenty-front/src/testing/decorators/ObjectMetadataItemsDecorator.tsx b/packages/twenty-front/src/testing/decorators/ObjectMetadataItemsDecorator.tsx index e3a718e4e9..f1ac91ab47 100644 --- a/packages/twenty-front/src/testing/decorators/ObjectMetadataItemsDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/ObjectMetadataItemsDecorator.tsx @@ -4,8 +4,8 @@ import { useEffect } from 'react'; import { currentUserState } from '@/auth/states/currentUserState'; import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState'; import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { PreComputedChipGeneratorsProvider } from '@/object-metadata/components/PreComputedChipGeneratorsProvider'; import { useLoadMockedObjectMetadataItems } from '@/object-metadata/hooks/useLoadMockedObjectMetadataItems'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; @@ -13,14 +13,12 @@ import { mockedUserData } from '~/testing/mock-data/users'; import { mockWorkspaceMembers } from '~/testing/mock-data/workspace-members'; export const ObjectMetadataItemsDecorator: Decorator = (Story) => { - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); - const setCurrentWorkspaceMember = useSetRecoilStateV2( + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); + const setCurrentWorkspaceMember = useSetAtomState( currentWorkspaceMemberState, ); - const setCurrentUser = useSetRecoilStateV2(currentUserState); - const setCurrentUserWorkspace = useSetRecoilStateV2( - currentUserWorkspaceState, - ); + const setCurrentUser = useSetAtomState(currentUserState); + const setCurrentUserWorkspace = useSetAtomState(currentUserWorkspaceState); const { loadMockedObjectMetadataItems } = useLoadMockedObjectMetadataItems(); diff --git a/packages/twenty-front/src/testing/decorators/PrefetchLoadedDecorator.tsx b/packages/twenty-front/src/testing/decorators/PrefetchLoadedDecorator.tsx index 78877e50a0..71366dfdfb 100644 --- a/packages/twenty-front/src/testing/decorators/PrefetchLoadedDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/PrefetchLoadedDecorator.tsx @@ -2,14 +2,14 @@ import { type Decorator } from '@storybook/react-vite'; import { prefetchIsLoadedFamilyState } from '@/prefetch/states/prefetchIsLoadedFamilyState'; import { PrefetchKey } from '@/prefetch/types/PrefetchKey'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; export const PrefetchLoadedDecorator: Decorator = (Story) => { - const setAreFavoritesPrefetched = useSetFamilyRecoilStateV2( + const setAreFavoritesPrefetched = useSetAtomFamilyState( prefetchIsLoadedFamilyState, PrefetchKey.AllFavorites, ); - const setAreFavoritesFoldersPrefetched = useSetFamilyRecoilStateV2( + const setAreFavoritesFoldersPrefetched = useSetAtomFamilyState( prefetchIsLoadedFamilyState, PrefetchKey.AllFavoritesFolders, ); diff --git a/packages/twenty-front/src/testing/decorators/PrefetchLoadingDecorator.tsx b/packages/twenty-front/src/testing/decorators/PrefetchLoadingDecorator.tsx index cc5f29ff29..e231eb62bd 100644 --- a/packages/twenty-front/src/testing/decorators/PrefetchLoadingDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/PrefetchLoadingDecorator.tsx @@ -2,7 +2,7 @@ import { type Decorator } from '@storybook/react-vite'; import { prefetchIsLoadedFamilyState } from '@/prefetch/states/prefetchIsLoadedFamilyState'; import { PrefetchKey } from '@/prefetch/types/PrefetchKey'; -import { useSetFamilyRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetFamilyRecoilStateV2'; +import { useSetAtomFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomFamilyState'; import { useEffect, useState } from 'react'; export const PrefetchLoadingDecorator: Decorator = (Story, context) => { @@ -10,12 +10,12 @@ export const PrefetchLoadingDecorator: Decorator = (Story, context) => { const prefetchLoadingSetDelay = parameters.prefetchLoadingSetDelay ?? 0; - const setAreFavoritesFoldersPrefetched = useSetFamilyRecoilStateV2( + const setAreFavoritesFoldersPrefetched = useSetAtomFamilyState( prefetchIsLoadedFamilyState, PrefetchKey.AllFavoritesFolders, ); - const setAreFavoritesPrefetched = useSetFamilyRecoilStateV2( + const setAreFavoritesPrefetched = useSetAtomFamilyState( prefetchIsLoadedFamilyState, PrefetchKey.AllFavorites, ); diff --git a/packages/twenty-front/src/testing/decorators/ProfilerDecorator.tsx b/packages/twenty-front/src/testing/decorators/ProfilerDecorator.tsx index d4ba0dc566..6d4dea8baf 100644 --- a/packages/twenty-front/src/testing/decorators/ProfilerDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/ProfilerDecorator.tsx @@ -1,6 +1,6 @@ import { type Decorator } from '@storybook/react-vite'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { ProfilerWrapper } from '~/testing/profiling/components/ProfilerWrapper'; import { ProfilingQueueEffect } from '~/testing/profiling/components/ProfilingQueueEffect'; import { ProfilingReporter } from '~/testing/profiling/components/ProfilingReporter'; @@ -14,12 +14,12 @@ export const ProfilerDecorator: Decorator = (Story, { id, parameters }) => { const numberOfRuns = parameters.numberOfRuns ?? 2; const warmUpRounds = parameters.warmUpRounds ?? 5; - const currentProfilingRunIndex = useRecoilValueV2( + const currentProfilingRunIndex = useAtomStateValue( currentProfilingRunIndexState, ); - const profilingSessionStatus = useRecoilValueV2(profilingSessionStatusState); - const profilingSessionRuns = useRecoilValueV2(profilingSessionRunsState); + const profilingSessionStatus = useAtomStateValue(profilingSessionStatusState); + const profilingSessionRuns = useAtomStateValue(profilingSessionRunsState); const skip = profilingSessionRuns.length === 0; diff --git a/packages/twenty-front/src/testing/decorators/RecordTableDecorator.tsx b/packages/twenty-front/src/testing/decorators/RecordTableDecorator.tsx index 5308db2721..fa7b5c9904 100644 --- a/packages/twenty-front/src/testing/decorators/RecordTableDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/RecordTableDecorator.tsx @@ -1,5 +1,5 @@ import { type Decorator } from '@storybook/react-vite'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { ActionMenuComponentInstanceContext } from '@/action-menu/states/contexts/ActionMenuComponentInstanceContext'; import { getActionMenuIdFromRecordIndexId } from '@/action-menu/utils/getActionMenuIdFromRecordIndexId'; @@ -7,8 +7,8 @@ import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainCo import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; import { labelIdentifierFieldMetadataItemSelector } from '@/object-metadata/states/labelIdentifierFieldMetadataItemSelector'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; -import { useFamilySelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useFamilySelectorValueV2'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; import { formatFieldMetadataItemAsColumnDefinition } from '@/object-metadata/utils/formatFieldMetadataItemAsColumnDefinition'; import { RecordComponentInstanceContextsWrapper } from '@/object-record/components/RecordComponentInstanceContextsWrapper'; @@ -26,9 +26,9 @@ import { useSetRecordTableData } from '@/object-record/record-table/hooks/intern import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext'; import { getRecordIndexIdFromObjectNamePluralAndViewId } from '@/object-record/utils/getRecordIndexIdFromObjectNamePluralAndViewId'; import { getObjectPermissionsFromMapByObjectMetadataId } from '@/settings/roles/role-permissions/objects-permissions/utils/getObjectPermissionsFromMapByObjectMetadataId'; -import { useRecoilComponentSelectorValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentSelectorValueV2'; -import { useRecoilComponentValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilComponentValueV2'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useAtomComponentSelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentSelectorValue'; +import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext'; import { coreViewsState } from '@/views/states/coreViewState'; import { type CoreViewWithRelations } from '@/views/types/CoreViewWithRelations'; @@ -47,16 +47,16 @@ const InternalTableStateLoaderEffect = ({ }) => { const { recordTableId } = useRecordTableContextOrThrow(); const { loadRecordIndexStates } = useLoadRecordIndexStates(); - const setCurrentRecordFields = useSetRecoilComponentStateV2( + const setCurrentRecordFields = useSetAtomComponentState( currentRecordFieldsComponentState, ); - const setContextStoreCurrentViewId = useSetRecoilComponentStateV2( + const setContextStoreCurrentViewId = useSetAtomComponentState( contextStoreCurrentViewIdComponentState, MAIN_CONTEXT_STORE_INSTANCE_ID, ); - const setCoreViews = useSetRecoilStateV2(coreViewsState); + const setCoreViews = useSetAtomState(coreViewsState); const setRecordTableData = useSetRecordTableData({ recordTableId, @@ -107,11 +107,11 @@ const InternalTableContextProviders = ({ }) => { const { objectPermissionsByObjectMetadataId } = useObjectPermissions(); - const currentRecordFields = useRecoilComponentValueV2( + const currentRecordFields = useAtomComponentStateValue( currentRecordFieldsComponentState, ); - const visibleRecordFields = useRecoilComponentSelectorValueV2( + const visibleRecordFields = useAtomComponentSelectorValue( visibleRecordFieldsComponentSelector, ); @@ -145,7 +145,7 @@ const InternalTableContextProviders = ({ ]), ); - const labelIdentifierFieldMetadataItem = useFamilySelectorValueV2( + const labelIdentifierFieldMetadataItem = useAtomFamilySelectorValue( labelIdentifierFieldMetadataItemSelector, { objectMetadataItemId: objectMetadataItem.id, @@ -206,7 +206,7 @@ export const RecordTableDecorator: Decorator = (Story, context) => { const { recordTableObjectNameSingular: objectNameSingular } = context.parameters; - const objectMetadataItems = useRecoilValueV2(objectMetadataItemsState); + const objectMetadataItems = useAtomStateValue(objectMetadataItemsState); const objectMetadataItem = objectMetadataItems.find( (objectMetadataItem) => diff --git a/packages/twenty-front/src/testing/decorators/WorkspaceDecorator.tsx b/packages/twenty-front/src/testing/decorators/WorkspaceDecorator.tsx index ff2cc95921..878de0985b 100644 --- a/packages/twenty-front/src/testing/decorators/WorkspaceDecorator.tsx +++ b/packages/twenty-front/src/testing/decorators/WorkspaceDecorator.tsx @@ -1,11 +1,11 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { type Decorator } from '@storybook/react-vite'; import { useEffect } from 'react'; import { mockCurrentWorkspace } from '~/testing/mock-data/users'; export const WorkspaceDecorator: Decorator = (Story) => { - const setCurrentWorkspace = useSetRecoilStateV2(currentWorkspaceState); + const setCurrentWorkspace = useSetAtomState(currentWorkspaceState); useEffect(() => { setCurrentWorkspace(mockCurrentWorkspace); diff --git a/packages/twenty-front/src/testing/jest/JestContextStoreSetter.tsx b/packages/twenty-front/src/testing/jest/JestContextStoreSetter.tsx index 5a8755a834..de583e0324 100644 --- a/packages/twenty-front/src/testing/jest/JestContextStoreSetter.tsx +++ b/packages/twenty-front/src/testing/jest/JestContextStoreSetter.tsx @@ -16,7 +16,7 @@ import { type ContextStoreViewType } from '@/context-store/types/ContextStoreVie import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem'; import { type RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup'; import { type RecordFilter } from '@/object-record/record-filter/types/RecordFilter'; -import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilComponentStateV2'; +import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState'; export type JestContextStoreSetterMocks = { contextStoreTargetedRecordsRule?: ContextStoreTargetedRecordsRule; @@ -49,39 +49,37 @@ export const JestContextStoreSetter = ({ const instanceId = contextStoreInstanceContext?.instanceId ?? MAIN_CONTEXT_STORE_INSTANCE_ID; - const setContextStoreTargetedRecordsRule = useSetRecoilComponentStateV2( + const setContextStoreTargetedRecordsRule = useSetAtomComponentState( contextStoreTargetedRecordsRuleComponentState, instanceId, ); - const setContextStoreCurrentObjectMetadataItemId = - useSetRecoilComponentStateV2( - contextStoreCurrentObjectMetadataItemIdComponentState, - instanceId, - ); + const setContextStoreCurrentObjectMetadataItemId = useSetAtomComponentState( + contextStoreCurrentObjectMetadataItemIdComponentState, + instanceId, + ); - const setContextStoreNumberOfSelectedRecords = useSetRecoilComponentStateV2( + const setContextStoreNumberOfSelectedRecords = useSetAtomComponentState( contextStoreNumberOfSelectedRecordsComponentState, instanceId, ); - const setContextStoreFiltersComponentState = useSetRecoilComponentStateV2( + const setContextStoreFiltersComponentState = useSetAtomComponentState( contextStoreFiltersComponentState, instanceId, ); - const setContextStoreFilterGroupsComponentState = - useSetRecoilComponentStateV2( - contextStoreFilterGroupsComponentState, - instanceId, - ); + const setContextStoreFilterGroupsComponentState = useSetAtomComponentState( + contextStoreFilterGroupsComponentState, + instanceId, + ); - const setContextStoreCurrentViewId = useSetRecoilComponentStateV2( + const setContextStoreCurrentViewId = useSetAtomComponentState( contextStoreCurrentViewIdComponentState, instanceId, ); - const setContextStoreCurrentViewType = useSetRecoilComponentStateV2( + const setContextStoreCurrentViewType = useSetAtomComponentState( contextStoreCurrentViewTypeComponentState, instanceId, ); diff --git a/packages/twenty-front/src/testing/jest/JestObjectMetadataItemSetter.tsx b/packages/twenty-front/src/testing/jest/JestObjectMetadataItemSetter.tsx index 585eaafde3..aa3b47adfb 100644 --- a/packages/twenty-front/src/testing/jest/JestObjectMetadataItemSetter.tsx +++ b/packages/twenty-front/src/testing/jest/JestObjectMetadataItemSetter.tsx @@ -2,7 +2,7 @@ import { type ReactNode, useEffect, useState } from 'react'; import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; -import { useSetRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useSetRecoilStateV2'; +import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState'; import { generatedMockObjectMetadataItems } from '~/testing/utils/generatedMockObjectMetadataItems'; export const JestObjectMetadataItemSetter = ({ @@ -12,7 +12,7 @@ export const JestObjectMetadataItemSetter = ({ children: ReactNode; objectMetadataItems?: ObjectMetadataItem[]; }) => { - const setObjectMetadataItems = useSetRecoilStateV2(objectMetadataItemsState); + const setObjectMetadataItems = useSetAtomState(objectMetadataItemsState); const [isLoaded, setIsLoaded] = useState(false); useEffect(() => { diff --git a/packages/twenty-front/src/testing/profiling/components/ProfilingQueueEffect.tsx b/packages/twenty-front/src/testing/profiling/components/ProfilingQueueEffect.tsx index 31c062a631..50d8861f28 100644 --- a/packages/twenty-front/src/testing/profiling/components/ProfilingQueueEffect.tsx +++ b/packages/twenty-front/src/testing/profiling/components/ProfilingQueueEffect.tsx @@ -1,6 +1,6 @@ import { useEffect } from 'react'; -import { useRecoilStateV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilStateV2'; +import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState'; import { TIME_BETWEEN_TEST_RUNS_IN_MS } from '~/testing/profiling/constants/TimeBetweenTestRunsInMs'; import { currentProfilingRunIndexState } from '~/testing/profiling/states/currentProfilingRunIndexState'; import { profilingQueueState } from '~/testing/profiling/states/profilingQueueState'; @@ -20,19 +20,19 @@ export const ProfilingQueueEffect = ({ numberOfRuns: number; warmUpRounds: number; }) => { - const [currentProfilingRunIndex, setCurrentProfilingRunIndex] = - useRecoilStateV2(currentProfilingRunIndexState); + const [currentProfilingRunIndex, setCurrentProfilingRunIndex] = useAtomState( + currentProfilingRunIndexState, + ); - const [profilingSessionStatus, setProfilingSessionStatus] = useRecoilStateV2( + const [profilingSessionStatus, setProfilingSessionStatus] = useAtomState( profilingSessionStatusState, ); - const [profilingSessionRuns, setProfilingSessionRuns] = useRecoilStateV2( + const [profilingSessionRuns, setProfilingSessionRuns] = useAtomState( profilingSessionRunsState, ); - const [profilingQueue, setProfilingQueue] = - useRecoilStateV2(profilingQueueState); + const [profilingQueue, setProfilingQueue] = useAtomState(profilingQueueState); useEffect(() => { (async () => { diff --git a/packages/twenty-front/src/testing/profiling/components/ProfilingReporter.tsx b/packages/twenty-front/src/testing/profiling/components/ProfilingReporter.tsx index ddf56c984d..475ff2157c 100644 --- a/packages/twenty-front/src/testing/profiling/components/ProfilingReporter.tsx +++ b/packages/twenty-front/src/testing/profiling/components/ProfilingReporter.tsx @@ -1,7 +1,7 @@ import styled from '@emotion/styled'; import { useMemo } from 'react'; -import { useRecoilValueV2 } from '@/ui/utilities/state/jotai/hooks/useRecoilValueV2'; +import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue'; import { PROFILING_REPORTER_DIV_ID } from '~/testing/profiling/constants/ProfilingReporterDivId'; import { currentProfilingRunIndexState } from '~/testing/profiling/states/currentProfilingRunIndexState'; import { profilingSessionDataPointsState } from '~/testing/profiling/states/profilingSessionDataPointsState'; @@ -22,15 +22,15 @@ const StyledTable = styled.table` `; export const ProfilingReporter = () => { - const profilingSessionDataPoints = useRecoilValueV2( + const profilingSessionDataPoints = useAtomStateValue( profilingSessionDataPointsState, ); - const currentProfilingRunIndex = useRecoilValueV2( + const currentProfilingRunIndex = useAtomStateValue( currentProfilingRunIndexState, ); - const profilingSessionStatus = useRecoilValueV2(profilingSessionStatusState); + const profilingSessionStatus = useAtomStateValue(profilingSessionStatusState); const profilingReport = useMemo( () => computeProfilingReport(profilingSessionDataPoints), diff --git a/packages/twenty-front/src/testing/profiling/states/currentProfilingRunIndexState.ts b/packages/twenty-front/src/testing/profiling/states/currentProfilingRunIndexState.ts index 3a7d9f93c0..ade4e1f2e8 100644 --- a/packages/twenty-front/src/testing/profiling/states/currentProfilingRunIndexState.ts +++ b/packages/twenty-front/src/testing/profiling/states/currentProfilingRunIndexState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentProfilingRunIndexState = createStateV2({ +export const currentProfilingRunIndexState = createAtomState({ key: 'currentProfilingRunIndexState', defaultValue: 0, }); diff --git a/packages/twenty-front/src/testing/profiling/states/currentProfilingRunState.ts b/packages/twenty-front/src/testing/profiling/states/currentProfilingRunState.ts index 3a7d9f93c0..ade4e1f2e8 100644 --- a/packages/twenty-front/src/testing/profiling/states/currentProfilingRunState.ts +++ b/packages/twenty-front/src/testing/profiling/states/currentProfilingRunState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const currentProfilingRunIndexState = createStateV2({ +export const currentProfilingRunIndexState = createAtomState({ key: 'currentProfilingRunIndexState', defaultValue: 0, }); diff --git a/packages/twenty-front/src/testing/profiling/states/profilingQueueState.ts b/packages/twenty-front/src/testing/profiling/states/profilingQueueState.ts index cad4798097..fd8b96ffca 100644 --- a/packages/twenty-front/src/testing/profiling/states/profilingQueueState.ts +++ b/packages/twenty-front/src/testing/profiling/states/profilingQueueState.ts @@ -1,10 +1,10 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export type ProfilingQueue = { [runName: string]: string[]; }; -export const profilingQueueState = createStateV2({ +export const profilingQueueState = createAtomState({ key: 'profilingQueueState', defaultValue: {}, }); diff --git a/packages/twenty-front/src/testing/profiling/states/profilingSessionDataPointsState.ts b/packages/twenty-front/src/testing/profiling/states/profilingSessionDataPointsState.ts index bf91d49a88..67b9c9bb66 100644 --- a/packages/twenty-front/src/testing/profiling/states/profilingSessionDataPointsState.ts +++ b/packages/twenty-front/src/testing/profiling/states/profilingSessionDataPointsState.ts @@ -1,8 +1,8 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type ProfilingDataPoint } from '~/testing/profiling/types/ProfilingDataPoint'; -export const profilingSessionDataPointsState = createStateV2< +export const profilingSessionDataPointsState = createAtomState< ProfilingDataPoint[] >({ key: 'profilingSessionDataPointsState', diff --git a/packages/twenty-front/src/testing/profiling/states/profilingSessionRunsState.ts b/packages/twenty-front/src/testing/profiling/states/profilingSessionRunsState.ts index eb2fe577cd..89d987b0fc 100644 --- a/packages/twenty-front/src/testing/profiling/states/profilingSessionRunsState.ts +++ b/packages/twenty-front/src/testing/profiling/states/profilingSessionRunsState.ts @@ -1,6 +1,6 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; -export const profilingSessionRunsState = createStateV2({ +export const profilingSessionRunsState = createAtomState({ key: 'profilingSessionRunsState', defaultValue: [], }); diff --git a/packages/twenty-front/src/testing/profiling/states/profilingSessionState.ts b/packages/twenty-front/src/testing/profiling/states/profilingSessionState.ts index 2d47ac3eb0..88c435697c 100644 --- a/packages/twenty-front/src/testing/profiling/states/profilingSessionState.ts +++ b/packages/twenty-front/src/testing/profiling/states/profilingSessionState.ts @@ -1,8 +1,8 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; import { type ProfilingDataPoint } from '~/testing/profiling/types/ProfilingDataPoint'; -export const profilingSessionState = createStateV2< +export const profilingSessionState = createAtomState< Record >({ key: 'profilingSessionState', diff --git a/packages/twenty-front/src/testing/profiling/states/profilingSessionStatusState.ts b/packages/twenty-front/src/testing/profiling/states/profilingSessionStatusState.ts index a22c5baeb4..4cb13de9c9 100644 --- a/packages/twenty-front/src/testing/profiling/states/profilingSessionStatusState.ts +++ b/packages/twenty-front/src/testing/profiling/states/profilingSessionStatusState.ts @@ -1,9 +1,9 @@ -import { createStateV2 } from '@/ui/utilities/state/jotai/utils/createStateV2'; +import { createAtomState } from '@/ui/utilities/state/jotai/utils/createAtomState'; export type ProfilingSessionStatus = 'running' | 'finished' | 'not_started'; export const profilingSessionStatusState = - createStateV2({ + createAtomState({ key: 'profilingSessionStatusState', defaultValue: 'not_started', });