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:
+2
-2
@@ -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/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
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 = useSetRecoilComponentState(
|
||||
selectableItemIdsComponentState,
|
||||
selectableListInstanceId,
|
||||
);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import { ReactNode, useEffect, useRef } from 'react';
|
||||
|
||||
import { SelectableListItemHotkeyEffect } from '@/ui/layout/selectable-list/components/SelectableListItemHotkeyEffect';
|
||||
import { isSelectedItemIdComponentFamilySelector } from '@/ui/layout/selectable-list/states/selectors/isSelectedItemIdComponentFamilySelector';
|
||||
import { useRecoilComponentFamilyValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentFamilyValueV2';
|
||||
import { useRecoilComponentFamilyValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentFamilyValue';
|
||||
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 = useRecoilComponentFamilyValue(
|
||||
isSelectedItemIdComponentFamilySelector,
|
||||
itemId,
|
||||
);
|
||||
|
||||
+6
-6
@@ -5,8 +5,8 @@ import { RecoilRoot } from 'recoil';
|
||||
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/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { useSetRecoilComponentStateV2 } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentStateV2';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { useSetRecoilComponentState } from '@/ui/utilities/state/component-state/hooks/useSetRecoilComponentState';
|
||||
|
||||
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 = useSetRecoilComponentState(
|
||||
selectableItemIdsComponentState,
|
||||
selectableListComponentInstanceId,
|
||||
);
|
||||
|
||||
const selectableItemIds = useRecoilComponentValueV2(
|
||||
const selectableItemIds = useRecoilComponentValue(
|
||||
selectableItemIdsComponentState,
|
||||
selectableListComponentInstanceId,
|
||||
);
|
||||
@@ -52,11 +52,11 @@ describe('useSelectableList', () => {
|
||||
selectableListComponentInstanceId,
|
||||
);
|
||||
|
||||
const selectedItemId = useRecoilComponentValueV2(
|
||||
const selectedItemId = useRecoilComponentValue(
|
||||
selectedItemIdComponentState,
|
||||
selectableListComponentInstanceId,
|
||||
);
|
||||
const setSelectedItemId = useSetRecoilComponentStateV2(
|
||||
const setSelectedItemId = useSetRecoilComponentState(
|
||||
selectedItemIdComponentState,
|
||||
selectableListComponentInstanceId,
|
||||
);
|
||||
|
||||
+9
-7
@@ -1,9 +1,11 @@
|
||||
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
|
||||
import { createComponentFamilyStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentFamilyStateV2';
|
||||
import { createComponentFamilyState } from '@/ui/utilities/state/component-state/utils/createComponentFamilyState';
|
||||
|
||||
export const isSelectedItemIdComponentFamilyState =
|
||||
createComponentFamilyStateV2<boolean, string>({
|
||||
key: 'isSelectedItemIdComponentFamilyState',
|
||||
defaultValue: false,
|
||||
componentInstanceContext: SelectableListComponentInstanceContext,
|
||||
});
|
||||
export const isSelectedItemIdComponentFamilyState = createComponentFamilyState<
|
||||
boolean,
|
||||
string
|
||||
>({
|
||||
key: 'isSelectedItemIdComponentFamilyState',
|
||||
defaultValue: false,
|
||||
componentInstanceContext: SelectableListComponentInstanceContext,
|
||||
});
|
||||
|
||||
+8
-8
@@ -1,10 +1,10 @@
|
||||
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
|
||||
export const selectableItemIdsComponentState = createComponentStateV2<
|
||||
string[][]
|
||||
>({
|
||||
key: 'selectableItemIdsComponentState',
|
||||
defaultValue: [[]],
|
||||
componentInstanceContext: SelectableListComponentInstanceContext,
|
||||
});
|
||||
export const selectableItemIdsComponentState = createComponentState<string[][]>(
|
||||
{
|
||||
key: 'selectableItemIdsComponentState',
|
||||
defaultValue: [[]],
|
||||
componentInstanceContext: SelectableListComponentInstanceContext,
|
||||
},
|
||||
);
|
||||
|
||||
+8
-8
@@ -1,10 +1,10 @@
|
||||
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
|
||||
import { createComponentStateV2 } from '@/ui/utilities/state/component-state/utils/createComponentStateV2';
|
||||
import { createComponentState } from '@/ui/utilities/state/component-state/utils/createComponentState';
|
||||
|
||||
export const selectedItemIdComponentState = createComponentStateV2<
|
||||
string | null
|
||||
>({
|
||||
key: 'selectedItemIdComponentState',
|
||||
defaultValue: null,
|
||||
componentInstanceContext: SelectableListComponentInstanceContext,
|
||||
});
|
||||
export const selectedItemIdComponentState = createComponentState<string | null>(
|
||||
{
|
||||
key: 'selectedItemIdComponentState',
|
||||
defaultValue: null,
|
||||
componentInstanceContext: SelectableListComponentInstanceContext,
|
||||
},
|
||||
);
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import { SelectableListComponentInstanceContext } from '@/ui/layout/selectable-list/states/contexts/SelectableListComponentInstanceContext';
|
||||
import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState';
|
||||
import { createComponentFamilySelectorV2 } from '@/ui/utilities/state/component-state/utils/createComponentFamilySelectorV2';
|
||||
import { createComponentFamilySelector } from '@/ui/utilities/state/component-state/utils/createComponentFamilySelector';
|
||||
|
||||
export const isSelectedItemIdComponentFamilySelector =
|
||||
createComponentFamilySelectorV2<boolean, string>({
|
||||
createComponentFamilySelector<boolean, string>({
|
||||
key: 'isSelectedItemIdComponentFamilySelector',
|
||||
componentInstanceContext: SelectableListComponentInstanceContext,
|
||||
get:
|
||||
|
||||
Reference in New Issue
Block a user