Removed all v2 in naming of state management logic (#13675)
This PR removes any V2 naming in state management logic and some minor utils and hooks. It has a lot of changes but nearly all of them were made by the rename functionality of vscode which is deterministic, so it shouldn't introduce any regression. QA has been made on this PR on the main features of the app without any noticeable issue. Also renamed some other v2 naming related items : - TextInputV2 => TextInput - TextInput => SettingsTextInput - ObjectFilterDropdownFilterSelectMenuItemV2 => ObjectFilterDropdownFilterSelectMenuItem - useInitDraftValueV2 => useInitDraftValue - useOpenRecordTableCellV2 => useOpenRecordTableCell
This commit is contained in:
+14
-13
@@ -4,16 +4,16 @@ import { Key } from 'ts-key-enum';
|
||||
import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMetadataItemById';
|
||||
import { IconPicker } from '@/ui/input/components/IconPicker';
|
||||
import { Select } from '@/ui/input/components/Select';
|
||||
import { TextInputV2 } from '@/ui/input/components/TextInputV2';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
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 { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
||||
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
|
||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentState';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
import { viewObjectMetadataIdComponentState } from '@/views/states/viewObjectMetadataIdComponentState';
|
||||
import { ViewType, viewTypeIconMapping } from '@/views/types/ViewType';
|
||||
import { ViewPickerCreateButton } from '@/views/view-picker/components/ViewPickerCreateButton';
|
||||
@@ -50,30 +50,31 @@ export const ViewPickerContentCreateMode = () => {
|
||||
const { viewPickerMode, setViewPickerMode } = useViewPickerMode();
|
||||
const [hasManuallySelectedIcon, setHasManuallySelectedIcon] = useState(false);
|
||||
|
||||
const viewObjectMetadataId = useRecoilComponentValueV2(
|
||||
const viewObjectMetadataId = useRecoilComponentValue(
|
||||
viewObjectMetadataIdComponentState,
|
||||
);
|
||||
const { objectMetadataItem } = useObjectMetadataItemById({
|
||||
objectId: viewObjectMetadataId ?? '',
|
||||
});
|
||||
|
||||
const [viewPickerInputName, setViewPickerInputName] =
|
||||
useRecoilComponentStateV2(viewPickerInputNameComponentState);
|
||||
const [viewPickerInputName, setViewPickerInputName] = useRecoilComponentState(
|
||||
viewPickerInputNameComponentState,
|
||||
);
|
||||
|
||||
const [viewPickerSelectedIcon, setViewPickerSelectedIcon] =
|
||||
useRecoilComponentStateV2(viewPickerSelectedIconComponentState);
|
||||
useRecoilComponentState(viewPickerSelectedIconComponentState);
|
||||
|
||||
const viewPickerIsPersisting = useRecoilComponentValueV2(
|
||||
const viewPickerIsPersisting = useRecoilComponentValue(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
const setViewPickerIsDirty = useSetRecoilComponentStateV2(
|
||||
const setViewPickerIsDirty = useSetRecoilComponentState(
|
||||
viewPickerIsDirtyComponentState,
|
||||
);
|
||||
|
||||
const [viewPickerKanbanFieldMetadataId, setViewPickerKanbanFieldMetadataId] =
|
||||
useRecoilComponentStateV2(viewPickerKanbanFieldMetadataIdComponentState);
|
||||
useRecoilComponentState(viewPickerKanbanFieldMetadataIdComponentState);
|
||||
|
||||
const [viewPickerType, setViewPickerType] = useRecoilComponentStateV2(
|
||||
const [viewPickerType, setViewPickerType] = useRecoilComponentState(
|
||||
viewPickerTypeComponentState,
|
||||
);
|
||||
|
||||
@@ -145,7 +146,7 @@ export const ViewPickerContentCreateMode = () => {
|
||||
<DropdownMenuItemsContainer>
|
||||
<ViewPickerIconAndNameContainer>
|
||||
<IconPicker onChange={onIconChange} selectedIconKey={selectedIcon} />
|
||||
<TextInputV2
|
||||
<TextInput
|
||||
value={viewPickerInputName}
|
||||
onChange={(value) => {
|
||||
setViewPickerIsDirty(true);
|
||||
|
||||
+11
-10
@@ -1,16 +1,16 @@
|
||||
import { Key } from 'ts-key-enum';
|
||||
|
||||
import { IconPicker } from '@/ui/input/components/IconPicker';
|
||||
import { TextInputV2 } from '@/ui/input/components/TextInputV2';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
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 { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
||||
import { useHotkeysOnFocusedElement } from '@/ui/utilities/hotkey/hooks/useHotkeysOnFocusedElement';
|
||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentState';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
import { ViewPickerEditButton } from '@/views/view-picker/components/ViewPickerEditButton';
|
||||
import { ViewPickerIconAndNameContainer } from '@/views/view-picker/components/ViewPickerIconAndNameContainer';
|
||||
import { ViewPickerSaveButtonContainer } from '@/views/view-picker/components/ViewPickerSaveButtonContainer';
|
||||
@@ -26,15 +26,16 @@ import { IconChevronLeft } from 'twenty-ui/display';
|
||||
export const ViewPickerContentEditMode = () => {
|
||||
const { setViewPickerMode } = useViewPickerMode();
|
||||
|
||||
const [viewPickerInputName, setViewPickerInputName] =
|
||||
useRecoilComponentStateV2(viewPickerInputNameComponentState);
|
||||
const [viewPickerInputName, setViewPickerInputName] = useRecoilComponentState(
|
||||
viewPickerInputNameComponentState,
|
||||
);
|
||||
const [viewPickerSelectedIcon, setViewPickerSelectedIcon] =
|
||||
useRecoilComponentStateV2(viewPickerSelectedIconComponentState);
|
||||
useRecoilComponentState(viewPickerSelectedIconComponentState);
|
||||
|
||||
const viewPickerIsPersisting = useRecoilComponentValueV2(
|
||||
const viewPickerIsPersisting = useRecoilComponentValue(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
const setViewPickerIsDirty = useSetRecoilComponentStateV2(
|
||||
const setViewPickerIsDirty = useSetRecoilComponentState(
|
||||
viewPickerIsDirtyComponentState,
|
||||
);
|
||||
|
||||
@@ -82,7 +83,7 @@ export const ViewPickerContentEditMode = () => {
|
||||
onChange={onIconChange}
|
||||
selectedIconKey={viewPickerSelectedIcon}
|
||||
/>
|
||||
<TextInputV2
|
||||
<TextInput
|
||||
value={viewPickerInputName}
|
||||
onChange={(value) => {
|
||||
setViewPickerIsDirty(true);
|
||||
|
||||
+10
-10
@@ -2,9 +2,9 @@ import { useEffect } from 'react';
|
||||
|
||||
import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow';
|
||||
import { prefetchViewsFromObjectMetadataItemFamilySelector } from '@/prefetch/states/selector/prefetchViewsFromObjectMetadataItemFamilySelector';
|
||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentState';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
import { viewTypeIconMapping } from '@/views/types/ViewType';
|
||||
import { useGetAvailableFieldsForKanban } from '@/views/view-picker/hooks/useGetAvailableFieldsForKanban';
|
||||
import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode';
|
||||
@@ -19,30 +19,30 @@ import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const ViewPickerContentEffect = () => {
|
||||
const setViewPickerSelectedIcon = useSetRecoilComponentStateV2(
|
||||
const setViewPickerSelectedIcon = useSetRecoilComponentState(
|
||||
viewPickerSelectedIconComponentState,
|
||||
);
|
||||
const setViewPickerInputName = useSetRecoilComponentStateV2(
|
||||
const setViewPickerInputName = useSetRecoilComponentState(
|
||||
viewPickerInputNameComponentState,
|
||||
);
|
||||
const { viewPickerMode } = useViewPickerMode();
|
||||
|
||||
const [viewPickerKanbanFieldMetadataId, setViewPickerKanbanFieldMetadataId] =
|
||||
useRecoilComponentStateV2(viewPickerKanbanFieldMetadataIdComponentState);
|
||||
useRecoilComponentState(viewPickerKanbanFieldMetadataIdComponentState);
|
||||
|
||||
const [viewPickerType, setViewPickerType] = useRecoilComponentStateV2(
|
||||
const [viewPickerType, setViewPickerType] = useRecoilComponentState(
|
||||
viewPickerTypeComponentState,
|
||||
);
|
||||
|
||||
const viewPickerReferenceViewId = useRecoilComponentValueV2(
|
||||
const viewPickerReferenceViewId = useRecoilComponentValue(
|
||||
viewPickerReferenceViewIdComponentState,
|
||||
);
|
||||
|
||||
const viewPickerIsDirty = useRecoilComponentValueV2(
|
||||
const viewPickerIsDirty = useRecoilComponentValue(
|
||||
viewPickerIsDirtyComponentState,
|
||||
);
|
||||
|
||||
const viewPickerIsPersisting = useRecoilComponentValueV2(
|
||||
const viewPickerIsPersisting = useRecoilComponentValue(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
|
||||
|
||||
+4
-6
@@ -1,4 +1,4 @@
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { ViewType } from '@/views/types/ViewType';
|
||||
import { useCreateViewFromCurrentState } from '@/views/view-picker/hooks/useCreateViewFromCurrentState';
|
||||
import { useDeleteViewFromCurrentState } from '@/views/view-picker/hooks/useDeleteViewFromCurrentState';
|
||||
@@ -16,13 +16,11 @@ export const ViewPickerCreateButton = () => {
|
||||
useGetAvailableFieldsForKanban();
|
||||
|
||||
const { viewPickerMode } = useViewPickerMode();
|
||||
const viewPickerType = useRecoilComponentValueV2(
|
||||
viewPickerTypeComponentState,
|
||||
);
|
||||
const viewPickerIsPersisting = useRecoilComponentValueV2(
|
||||
const viewPickerType = useRecoilComponentValue(viewPickerTypeComponentState);
|
||||
const viewPickerIsPersisting = useRecoilComponentValue(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
const viewPickerKanbanFieldMetadataId = useRecoilComponentValueV2(
|
||||
const viewPickerKanbanFieldMetadataId = useRecoilComponentValue(
|
||||
viewPickerKanbanFieldMetadataIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import styled from '@emotion/styled';
|
||||
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/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { useGetRecordIndexTotalCount } from '@/views/hooks/internal/useGetRecordIndexTotalCount';
|
||||
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
|
||||
import { ViewPickerContentCreateMode } from '@/views/view-picker/components/ViewPickerContentCreateMode';
|
||||
@@ -52,7 +52,7 @@ export const ViewPickerDropdown = () => {
|
||||
|
||||
const { totalCount } = useGetRecordIndexTotalCount();
|
||||
|
||||
const isDropdownOpen = useRecoilComponentValueV2(
|
||||
const isDropdownOpen = useRecoilComponentValue(
|
||||
isDropdownOpenComponentState,
|
||||
VIEW_PICKER_DROPDOWN_ID,
|
||||
);
|
||||
|
||||
+4
-6
@@ -1,4 +1,4 @@
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { ViewType } from '@/views/types/ViewType';
|
||||
import { useCreateViewFromCurrentState } from '@/views/view-picker/hooks/useCreateViewFromCurrentState';
|
||||
import { useDeleteViewFromCurrentState } from '@/views/view-picker/hooks/useDeleteViewFromCurrentState';
|
||||
@@ -15,13 +15,11 @@ export const ViewPickerEditButton = () => {
|
||||
useGetAvailableFieldsForKanban();
|
||||
|
||||
const { viewPickerMode } = useViewPickerMode();
|
||||
const viewPickerType = useRecoilComponentValueV2(
|
||||
viewPickerTypeComponentState,
|
||||
);
|
||||
const viewPickerIsPersisting = useRecoilComponentValueV2(
|
||||
const viewPickerType = useRecoilComponentValue(viewPickerTypeComponentState);
|
||||
const viewPickerIsPersisting = useRecoilComponentValue(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
const viewPickerKanbanFieldMetadataId = useRecoilComponentValueV2(
|
||||
const viewPickerKanbanFieldMetadataId = useRecoilComponentValue(
|
||||
viewPickerKanbanFieldMetadataIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -2,13 +2,13 @@ import { FavoriteFolderPicker } from '@/favorites/favorite-folder-picker/compone
|
||||
import { FavoriteFolderPickerEffect } from '@/favorites/favorite-folder-picker/components/FavoriteFolderPickerEffect';
|
||||
import { FavoriteFolderPickerInstanceContext } from '@/favorites/favorite-folder-picker/states/context/FavoriteFolderPickerInstanceContext';
|
||||
import { prefetchViewFromViewIdFamilySelector } from '@/prefetch/states/selector/prefetchViewFromViewIdFamilySelector';
|
||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||
import { useRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentState';
|
||||
import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId';
|
||||
import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/states/viewPickerReferenceViewIdComponentState';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
export const ViewPickerFavoriteFoldersDropdown = () => {
|
||||
const [viewPickerReferenceViewId] = useRecoilComponentStateV2(
|
||||
const [viewPickerReferenceViewId] = useRecoilComponentState(
|
||||
viewPickerReferenceViewIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ 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 { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
import { useChangeView } from '@/views/hooks/useChangeView';
|
||||
import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly';
|
||||
import { useUpdateView } from '@/views/hooks/useUpdateView';
|
||||
@@ -42,7 +42,7 @@ export const ViewPickerListContent = () => {
|
||||
|
||||
const { currentView } = useGetCurrentViewOnly();
|
||||
|
||||
const setViewPickerReferenceViewId = useSetRecoilComponentStateV2(
|
||||
const setViewPickerReferenceViewId = useSetRecoilComponentState(
|
||||
viewPickerReferenceViewIdComponentState,
|
||||
);
|
||||
|
||||
|
||||
+2
-2
@@ -4,7 +4,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/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
import { View } from '@/views/types/View';
|
||||
import { useDeleteViewFromCurrentState } from '@/views/view-picker/hooks/useDeleteViewFromCurrentState';
|
||||
import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode';
|
||||
@@ -40,7 +40,7 @@ export const ViewPickerOptionDropdown = ({
|
||||
const { getIcon } = useIcons();
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const { deleteViewFromCurrentState } = useDeleteViewFromCurrentState();
|
||||
const setViewPickerReferenceViewId = useSetRecoilComponentStateV2(
|
||||
const setViewPickerReferenceViewId = useSetRecoilComponentState(
|
||||
viewPickerReferenceViewIdComponentState,
|
||||
);
|
||||
const { setViewPickerMode } = useViewPickerMode();
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
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 = useSetRecoilComponentState(
|
||||
viewPickerModeComponentState,
|
||||
);
|
||||
|
||||
const setViewPickerIsPersisting = useSetRecoilComponentStateV2(
|
||||
const setViewPickerIsPersisting = useSetRecoilComponentState(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
|
||||
import { useRecoilComponentCallbackState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackState';
|
||||
import { getSnapshotValue } from '@/ui/utilities/state/utils/getSnapshotValue';
|
||||
import { useChangeView } from '@/views/hooks/useChangeView';
|
||||
import { useCreateViewFromCurrentView } from '@/views/hooks/useCreateViewFromCurrentView';
|
||||
@@ -16,32 +16,32 @@ import { v4 } from 'uuid';
|
||||
export const useCreateViewFromCurrentState = () => {
|
||||
const { closeAndResetViewPicker } = useCloseAndResetViewPicker();
|
||||
|
||||
const viewPickerInputNameCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerInputNameCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerInputNameComponentState,
|
||||
);
|
||||
|
||||
const viewPickerSelectedIconCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerSelectedIconCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerSelectedIconComponentState,
|
||||
);
|
||||
|
||||
const viewPickerTypeCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerTypeCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerTypeComponentState,
|
||||
);
|
||||
|
||||
const viewPickerKanbanFieldMetadataIdCallbackState =
|
||||
useRecoilComponentCallbackStateV2(
|
||||
useRecoilComponentCallbackState(
|
||||
viewPickerKanbanFieldMetadataIdComponentState,
|
||||
);
|
||||
|
||||
const viewPickerIsPersistingCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerIsPersistingCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
|
||||
const viewPickerIsDirtyCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerIsDirtyCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerIsDirtyComponentState,
|
||||
);
|
||||
|
||||
const viewPickerModeCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerModeCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerModeComponentState,
|
||||
);
|
||||
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ import { useRecoilCallback, useRecoilValue } from 'recoil';
|
||||
|
||||
import { useContextStoreObjectMetadataItemOrThrow } from '@/context-store/hooks/useContextStoreObjectMetadataItemOrThrow';
|
||||
import { prefetchViewsFromObjectMetadataItemFamilySelector } from '@/prefetch/states/selector/prefetchViewsFromObjectMetadataItemFamilySelector';
|
||||
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
|
||||
import { useRecoilComponentCallbackState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackState';
|
||||
import { getSnapshotValue } from '@/ui/utilities/state/utils/getSnapshotValue';
|
||||
import { useChangeView } from '@/views/hooks/useChangeView';
|
||||
import { useDeleteView } from '@/views/hooks/useDeleteView';
|
||||
@@ -15,18 +15,18 @@ import { viewPickerReferenceViewIdComponentState } from '@/views/view-picker/sta
|
||||
export const useDeleteViewFromCurrentState = (viewBarInstanceId?: string) => {
|
||||
const { closeAndResetViewPicker } = useCloseAndResetViewPicker();
|
||||
|
||||
const viewPickerIsPersistingCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerIsPersistingCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerIsPersistingComponentState,
|
||||
viewBarInstanceId,
|
||||
);
|
||||
|
||||
const viewPickerIsDirtyCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerIsDirtyCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerIsDirtyComponentState,
|
||||
viewBarInstanceId,
|
||||
);
|
||||
|
||||
const viewPickerReferenceViewIdCallbackState =
|
||||
useRecoilComponentCallbackStateV2(
|
||||
useRecoilComponentCallbackState(
|
||||
viewPickerReferenceViewIdComponentState,
|
||||
viewBarInstanceId,
|
||||
);
|
||||
|
||||
+3
-3
@@ -5,14 +5,14 @@ import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { viewObjectMetadataIdComponentState } from '@/views/states/viewObjectMetadataIdComponentState';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const useGetAvailableFieldsForKanban = () => {
|
||||
const viewObjectMetadataId = useRecoilComponentValueV2(
|
||||
const viewObjectMetadataId = useRecoilComponentValue(
|
||||
viewObjectMetadataIdComponentState,
|
||||
);
|
||||
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
|
||||
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
import { useRecoilComponentCallbackStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackStateV2';
|
||||
import { useRecoilComponentCallbackState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentCallbackState';
|
||||
import { getSnapshotValue } from '@/ui/utilities/state/utils/getSnapshotValue';
|
||||
import { useChangeView } from '@/views/hooks/useChangeView';
|
||||
import { useUpdateView } from '@/views/hooks/useUpdateView';
|
||||
@@ -13,24 +13,24 @@ import { useRecoilCallback } from 'recoil';
|
||||
export const useUpdateViewFromCurrentState = () => {
|
||||
const { closeAndResetViewPicker } = useCloseAndResetViewPicker();
|
||||
|
||||
const viewPickerInputNameCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerInputNameCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerInputNameComponentState,
|
||||
);
|
||||
|
||||
const viewPickerSelectedIconCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerSelectedIconCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerSelectedIconComponentState,
|
||||
);
|
||||
|
||||
const viewPickerIsPersistingCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerIsPersistingCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerIsPersistingComponentState,
|
||||
);
|
||||
|
||||
const viewPickerIsDirtyCallbackState = useRecoilComponentCallbackStateV2(
|
||||
const viewPickerIsDirtyCallbackState = useRecoilComponentCallbackState(
|
||||
viewPickerIsDirtyComponentState,
|
||||
);
|
||||
|
||||
const viewPickerReferenceViewIdCallbackState =
|
||||
useRecoilComponentCallbackStateV2(viewPickerReferenceViewIdComponentState);
|
||||
useRecoilComponentCallbackState(viewPickerReferenceViewIdComponentState);
|
||||
|
||||
const { updateView } = useUpdateView();
|
||||
const { changeView } = useChangeView();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentStateV2';
|
||||
import { useRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentState';
|
||||
import { viewPickerModeComponentState } from '@/views/view-picker/states/viewPickerModeComponentState';
|
||||
|
||||
export const useViewPickerMode = (viewBarComponentId?: string) => {
|
||||
const [viewPickerMode, setViewPickerMode] = useRecoilComponentStateV2(
|
||||
const [viewPickerMode, setViewPickerMode] = useRecoilComponentState(
|
||||
viewPickerModeComponentState,
|
||||
viewBarComponentId,
|
||||
);
|
||||
|
||||
+6
-8
@@ -1,10 +1,8 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
|
||||
export const viewPickerInputNameComponentState = createComponentStateV2<string>(
|
||||
{
|
||||
key: 'viewPickerInputNameComponentState',
|
||||
defaultValue: '',
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
},
|
||||
);
|
||||
export const viewPickerInputNameComponentState = createComponentState<string>({
|
||||
key: 'viewPickerInputNameComponentState',
|
||||
defaultValue: '',
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
|
||||
export const viewPickerIsDirtyComponentState = createComponentStateV2<boolean>({
|
||||
export const viewPickerIsDirtyComponentState = createComponentState<boolean>({
|
||||
key: 'viewPickerIsDirtyComponentState',
|
||||
defaultValue: false,
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
|
||||
export const viewPickerIsPersistingComponentState =
|
||||
createComponentStateV2<boolean>({
|
||||
createComponentState<boolean>({
|
||||
key: 'viewPickerIsPersistingComponentState',
|
||||
defaultValue: false,
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
|
||||
export const viewPickerKanbanFieldMetadataIdComponentState =
|
||||
createComponentStateV2<string>({
|
||||
createComponentState<string>({
|
||||
key: 'viewPickerKanbanFieldMetadataIdComponentState',
|
||||
defaultValue: '',
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
import { ViewPickerMode } from '@/views/view-picker/types/ViewPickerMode';
|
||||
|
||||
export const viewPickerModeComponentState =
|
||||
createComponentStateV2<ViewPickerMode>({
|
||||
createComponentState<ViewPickerMode>({
|
||||
key: 'viewPickerModeComponentState',
|
||||
defaultValue: 'list',
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
|
||||
export const viewPickerReferenceViewIdComponentState =
|
||||
createComponentStateV2<string>({
|
||||
createComponentState<string>({
|
||||
key: 'viewPickerReferenceViewIdComponentState',
|
||||
defaultValue: '',
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
|
||||
export const viewPickerSelectedIconComponentState =
|
||||
createComponentStateV2<string>({
|
||||
createComponentState<string>({
|
||||
key: 'viewPickerSelectedIconComponentState',
|
||||
defaultValue: '',
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
import { ViewComponentInstanceContext } from '@/views/states/contexts/ViewComponentInstanceContext';
|
||||
import { ViewType } from '@/views/types/ViewType';
|
||||
|
||||
export const viewPickerTypeComponentState = createComponentStateV2<ViewType>({
|
||||
export const viewPickerTypeComponentState = createComponentState<ViewType>({
|
||||
key: 'viewPickerTypeComponentState',
|
||||
defaultValue: ViewType.Table,
|
||||
componentInstanceContext: ViewComponentInstanceContext,
|
||||
|
||||
Reference in New Issue
Block a user