Skip to content

The open alternative to Salesforce, designed for AI.

Refactor recoil v4 (#3266)

Charles Bochet96264e264ccf
diff --git a/packages/twenty-front/package.json b/packages/twenty-front/package.json
index 506e35d1341..4d95ea994be 100644
--- a/packages/twenty-front/package.json
+++ b/packages/twenty-front/package.json
@@ -9,8 +9,8 @@
"start:clean": "yarn start --force",
"build": "tsc && vite build && yarn build:inject-runtime-env",
"build:inject-runtime-env": "sh ./scripts/inject-runtime-env.sh",
- "tsc": "tsc --watch",
- "tsc:ci": "tsc",
+ "tsc": "tsc --project tsconfig.app.json --watch",
+ "tsc:ci": "tsc --project tsconfig.app.json",
"preview": "vite preview",
"lint": "eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs",
"lint:ci": "yarn lint --config .eslintrc-ci.cjs",
diff --git a/packages/twenty-front/src/modules/activities/blocks/slashMenu.tsx b/packages/twenty-front/src/modules/activities/blocks/slashMenu.tsx
index ced25f9c86c..c36d3e86247 100644
--- a/packages/twenty-front/src/modules/activities/blocks/slashMenu.tsx
+++ b/packages/twenty-front/src/modules/activities/blocks/slashMenu.tsx
@@ -42,7 +42,7 @@ export const getSlashMenu = (imagesActivated: boolean) => {
];
if (!imagesActivated) {
- items = items.filter((x) => x.name != 'Image');
+ items = items.filter((x) => x.name !== 'Image');
}
return items;
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 0ab61d11ca9..52e4a307c3f 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx
@@ -32,8 +32,8 @@ export const CommandMenuItem = ({
Icon = IconArrowUpRight;
}
- const { isSelectedItemIdFamilyState } = useSelectableList();
- const isSelectedItemId = useRecoilValue(isSelectedItemIdFamilyState(id));
+ const { isSelectedItemIdSelector } = useSelectableList();
+ const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(id));
return (
<MenuItemCommand
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/scopes/scope-internal-context/ObjectFilterDropdownScopeInternalContext.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/scopes/scope-internal-context/ObjectFilterDropdownScopeInternalContext.ts
index 1a818e43dc8..30869a8a618 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/scopes/scope-internal-context/ObjectFilterDropdownScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/scopes/scope-internal-context/ObjectFilterDropdownScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type ObjectFilterDropdownScopeInternalContextProps = ScopedStateKey;
+type ObjectFilterDropdownScopeInternalContextProps = StateScopeMapKey;
export const ObjectFilterDropdownScopeInternalContext =
createScopeInternalContext<ObjectFilterDropdownScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/availableFilterDefinitionsScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/availableFilterDefinitionsScopedState.ts
index 17d0cd61664..4ed3c9ce777 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/availableFilterDefinitionsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/availableFilterDefinitionsScopedState.ts
@@ -1,7 +1,7 @@
import { FilterDefinition } from '@/object-record/object-filter-dropdown/types/FilterDefinition';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const availableFilterDefinitionsScopedState = createScopedState<
+export const availableFilterDefinitionsScopedState = createStateScopeMap<
FilterDefinition[]
>({
key: 'availableFilterDefinitionsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/filterDefinitionUsedInDropdownScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/filterDefinitionUsedInDropdownScopedState.ts
index c848f40520b..1ee8f0b45d7 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/filterDefinitionUsedInDropdownScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/filterDefinitionUsedInDropdownScopedState.ts
@@ -1,9 +1,9 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { FilterDefinition } from '../types/FilterDefinition';
export const filterDefinitionUsedInDropdownScopedState =
- createScopedState<FilterDefinition | null>({
+ createStateScopeMap<FilterDefinition | null>({
key: 'filterDefinitionUsedInDropdownScopedState',
defaultValue: null,
});
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedScopedState.ts
index ed25013a9ae..bec9fee84d3 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownOperandSelectUnfoldedScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isObjectFilterDropdownOperandSelectUnfoldedScopedState =
- createScopedState<boolean>({
+ createStateScopeMap<boolean>({
key: 'isObjectFilterDropdownOperandSelectUnfoldedScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedScopedState.ts
index 178886c5a12..432df347555 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/isObjectFilterDropdownUnfoldedScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isObjectFilterDropdownUnfoldedScopedState =
- createScopedState<boolean>({
+ createStateScopeMap<boolean>({
key: 'isObjectFilterDropdownUnfoldedScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputScopedState.ts
index bfdd12e32b5..b5cd0c1e43a 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSearchInputScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectFilterDropdownSearchInputScopedState =
- createScopedState<string>({
+ createStateScopeMap<string>({
key: 'objectFilterDropdownSearchInputScopedState',
defaultValue: '',
});
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedEntityIdScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedEntityIdScopedState.ts
index a0bd47aa778..a96a2c5e94e 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedEntityIdScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedEntityIdScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectFilterDropdownSelectedEntityIdScopedState =
- createScopedState<string | null>({
+ createStateScopeMap<string | null>({
key: 'objectFilterDropdownSelectedEntityIdScopedState',
defaultValue: null,
});
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedRecordIdsScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedRecordIdsScopedState.ts
index 70d8979716c..10c1dab0b6a 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedRecordIdsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/objectFilterDropdownSelectedRecordIdsScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectFilterDropdownSelectedRecordIdsScopedState =
- createScopedState<string[]>({
+ createStateScopeMap<string[]>({
key: 'objectFilterDropdownSelectedRecordIdsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/onFilterSelectScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/onFilterSelectScopedState.ts
index fe0f84d0e14..90e2140da32 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/onFilterSelectScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/onFilterSelectScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Filter } from '../types/Filter';
-export const onFilterSelectScopedState = createScopedState<
+export const onFilterSelectScopedState = createStateScopeMap<
((filter: Filter) => void) | undefined
>({
key: 'onFilterSelectScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedFilterScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedFilterScopedState.ts
index a7e81e80dce..c2161049b1d 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedFilterScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedFilterScopedState.ts
@@ -1,8 +1,10 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Filter } from '../types/Filter';
-export const selectedFilterScopedState = createScopedState<Filter | undefined>({
+export const selectedFilterScopedState = createStateScopeMap<
+ Filter | undefined
+>({
key: 'selectedFilterScopedState',
defaultValue: undefined,
});
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownScopedState.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownScopedState.ts
index 2a5dbd9cbae..2cb8e270c6b 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/states/selectedOperandInDropdownScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
export const selectedOperandInDropdownScopedState =
- createScopedState<ViewFilterOperand | null>({
+ createStateScopeMap<ViewFilterOperand | null>({
key: 'selectedOperandInDropdownScopedState',
defaultValue: null,
});
diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/scopes/scope-internal-context/ObjectSortDropdownScopeInternalContext.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/scopes/scope-internal-context/ObjectSortDropdownScopeInternalContext.ts
index 628b843a95f..45a636d5fcb 100644
--- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/scopes/scope-internal-context/ObjectSortDropdownScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/scopes/scope-internal-context/ObjectSortDropdownScopeInternalContext.ts
@@ -1,9 +1,9 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
import { Sort } from '../../types/Sort';
-type ObjectSortDropdownScopeInternalContextProps = ScopedStateKey & {
+type ObjectSortDropdownScopeInternalContextProps = StateScopeMapKey & {
onSortSelect?: (sort: Sort) => void;
};
diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/availableSortDefinitionsScopedState.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/availableSortDefinitionsScopedState.ts
index 0258a0d858d..27da40c6b74 100644
--- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/availableSortDefinitionsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/availableSortDefinitionsScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { SortDefinition } from '../types/SortDefinition';
-export const availableSortDefinitionsScopedState = createScopedState<
+export const availableSortDefinitionsScopedState = createStateScopeMap<
SortDefinition[]
>({
key: 'availableSortDefinitionsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isSortSelectedScopedState.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isSortSelectedScopedState.ts
index b377baea8c2..02514a4c4d4 100644
--- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isSortSelectedScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/isSortSelectedScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const isSortSelectedScopedState = createScopedState<boolean>({
+export const isSortSelectedScopedState = createStateScopeMap<boolean>({
key: 'isSortSelectedScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/onSortSelectScopedState.ts b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/onSortSelectScopedState.ts
index ee77698b684..0b76031e6ab 100644
--- a/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/onSortSelectScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/object-sort-dropdown/states/onSortSelectScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Sort } from '../types/Sort';
-export const onSortSelectScopedState = createScopedState<
+export const onSortSelectScopedState = createStateScopeMap<
((sort: Sort) => void) | undefined
>({
key: 'onSortSelectScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/scopes/scope-internal-context/RecordBoardScopeInternalContext.ts b/packages/twenty-front/src/modules/object-record/record-board/scopes/scope-internal-context/RecordBoardScopeInternalContext.ts
index a20426426f5..1ea057c983b 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/scopes/scope-internal-context/RecordBoardScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/scopes/scope-internal-context/RecordBoardScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type RecordBoardScopeInternalContextProps = ScopedStateKey;
+type RecordBoardScopeInternalContextProps = StateScopeMapKey;
export const RecordBoardScopeInternalContext =
createScopeInternalContext<RecordBoardScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIdsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIdsScopedState.ts
index a0e788c6e8e..19d449f00cf 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIdsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/activeRecordBoardCardIdsScopedState.ts
@@ -1,6 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const activeRecordBoardCardIdsScopedState = createScopedState<string[]>({
+export const activeRecordBoardCardIdsScopedState = createStateScopeMap<
+ string[]
+>({
key: 'activeRecordBoardCardIdsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/availableRecordBoardCardFieldsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/availableRecordBoardCardFieldsScopedState.ts
index 20450c15806..8f1cb784880 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/availableRecordBoardCardFieldsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/availableRecordBoardCardFieldsScopedState.ts
@@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
-export const availableRecordBoardCardFieldsScopedState = createScopedState<
+export const availableRecordBoardCardFieldsScopedState = createStateScopeMap<
BoardFieldDefinition<FieldMetadata>[]
>({
key: 'availableRecordBoardCardFieldsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/isCompactViewEnabledScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/isCompactViewEnabledScopedState.ts
index 4a9ab49a373..2e7a35df21d 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/isCompactViewEnabledScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/isCompactViewEnabledScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const isCompactViewEnabledScopedState = createScopedState<boolean>({
+export const isCompactViewEnabledScopedState = createStateScopeMap<boolean>({
key: 'isCompactViewEnabledScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardLoadedScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardLoadedScopedState.ts
index 7c201cb1cf4..5206edf9c14 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardLoadedScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/isRecordBoardLoadedScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const isRecordBoardLoadedScopedState = createScopedState<boolean>({
+export const isRecordBoardLoadedScopedState = createStateScopeMap<boolean>({
key: 'isRecordBoardLoadedScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/onFieldsChangeScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/onFieldsChangeScopedState.ts
index 33da3163189..06914e686cd 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/onFieldsChangeScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/onFieldsChangeScopedState.ts
@@ -1,8 +1,8 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { BoardFieldDefinition } from '@/object-record/record-board/types/BoardFieldDefinition';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const onFieldsChangeScopedState = createScopedState<
+export const onFieldsChangeScopedState = createStateScopeMap<
(fields: BoardFieldDefinition<FieldMetadata>[]) => void
>({
key: 'onFieldsChangeScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCardFieldsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCardFieldsScopedState.ts
index ee38ec75ba3..3aae12e9e9a 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCardFieldsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardCardFieldsScopedState.ts
@@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
-export const recordBoardCardFieldsScopedState = createScopedState<
+export const recordBoardCardFieldsScopedState = createStateScopeMap<
BoardFieldDefinition<FieldMetadata>[]
>({
key: 'recordBoardCardFieldsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardColumnsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardColumnsScopedState.ts
index 5b4f0c82bca..0480f8f2ad5 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardColumnsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardColumnsScopedState.ts
@@ -1,7 +1,7 @@
import { BoardColumnDefinition } from '@/object-record/record-board/types/BoardColumnDefinition';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const recordBoardColumnsScopedState = createScopedState<
+export const recordBoardColumnsScopedState = createStateScopeMap<
BoardColumnDefinition[]
>({
key: 'recordBoardColumnsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardFiltersScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardFiltersScopedState.ts
index 3ea2c2a28f9..a0d02927e5a 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardFiltersScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardFiltersScopedState.ts
@@ -1,7 +1,7 @@
import { Filter } from '@/object-record/object-filter-dropdown/types/Filter';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const recordBoardFiltersScopedState = createScopedState<Filter[]>({
+export const recordBoardFiltersScopedState = createStateScopeMap<Filter[]>({
key: 'recordBoardFiltersScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardSortsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardSortsScopedState.ts
index 28ee2daa933..b19b5f4837b 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardSortsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/recordBoardSortsScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Sort } from '../../object-sort-dropdown/types/Sort';
-export const recordBoardSortsScopedState = createScopedState<Sort[]>({
+export const recordBoardSortsScopedState = createStateScopeMap<Sort[]>({
key: 'recordBoardSortsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/savedOpportunitiesScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/savedOpportunitiesScopedState.ts
index b3da8ff9d62..57443838c59 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/savedOpportunitiesScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/savedOpportunitiesScopedState.ts
@@ -1,7 +1,9 @@
import { Opportunity } from '@/pipeline/types/Opportunity';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const savedOpportunitiesScopedState = createScopedState<Opportunity[]>({
- key: 'savedOpportunitiesScopedState',
- defaultValue: [],
-});
+export const savedOpportunitiesScopedState = createStateScopeMap<Opportunity[]>(
+ {
+ key: 'savedOpportunitiesScopedState',
+ defaultValue: [],
+ },
+);
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/savedPipelineStepsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/savedPipelineStepsScopedState.ts
index b9f651ed6ef..347ae076a23 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/savedPipelineStepsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/savedPipelineStepsScopedState.ts
@@ -1,7 +1,9 @@
import { PipelineStep } from '@/pipeline/types/PipelineStep';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const savedPipelineStepsScopedState = createScopedState<PipelineStep[]>({
+export const savedPipelineStepsScopedState = createStateScopeMap<
+ PipelineStep[]
+>({
key: 'savedPipelineStepsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardCardFieldsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardCardFieldsScopedState.ts
index 80997547e5e..ef2d6463339 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardCardFieldsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardCardFieldsScopedState.ts
@@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
-export const savedRecordBoardCardFieldsScopedState = createScopedState<
+export const savedRecordBoardCardFieldsScopedState = createStateScopeMap<
BoardFieldDefinition<FieldMetadata>[]
>({
key: 'savedRecordBoardCardFieldsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardColumnsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardColumnsScopedState.ts
index e285bc94efd..e8e76c9742b 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardColumnsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordBoardColumnsScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardColumnDefinition } from '../types/BoardColumnDefinition';
-export const savedRecordBoardColumnsScopedState = createScopedState<
+export const savedRecordBoardColumnsScopedState = createStateScopeMap<
BoardColumnDefinition[]
>({
key: 'savedRecordBoardColumnsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordsScopedState.ts
index 5b6c0103957..ac17469e4b9 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/savedRecordsScopedState.ts
@@ -1,7 +1,7 @@
import { Company } from '@/companies/types/Company';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const savedRecordsScopedState = createScopedState<Company[]>({
+export const savedRecordsScopedState = createStateScopeMap<Company[]>({
key: 'savedRecordsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/hiddenRecordBoardCardFieldsScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/hiddenRecordBoardCardFieldsScopedSelector.ts
index f3c7bba3586..7924b73c66c 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/hiddenRecordBoardCardFieldsScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/hiddenRecordBoardCardFieldsScopedSelector.ts
@@ -1,22 +1,24 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { availableRecordBoardCardFieldsScopedState } from '../availableRecordBoardCardFieldsScopedState';
import { recordBoardCardFieldsScopedState } from '../recordBoardCardFieldsScopedState';
-export const hiddenRecordBoardCardFieldsScopedSelector = createScopedSelector({
- key: 'hiddenRecordBoardCardFieldsScopedSelector',
- get:
- ({ scopeId }) =>
- ({ get }) => {
- const fields = get(recordBoardCardFieldsScopedState({ scopeId }));
- const fieldKeys = fields.map(({ fieldMetadataId }) => fieldMetadataId);
- const otherAvailableKeys = get(
- availableRecordBoardCardFieldsScopedState({ scopeId }),
- ).filter(({ fieldMetadataId }) => !fieldKeys.includes(fieldMetadataId));
+export const hiddenRecordBoardCardFieldsScopedSelector = createSelectorScopeMap(
+ {
+ key: 'hiddenRecordBoardCardFieldsScopedSelector',
+ get:
+ ({ scopeId }) =>
+ ({ get }) => {
+ const fields = get(recordBoardCardFieldsScopedState({ scopeId }));
+ const fieldKeys = fields.map(({ fieldMetadataId }) => fieldMetadataId);
+ const otherAvailableKeys = get(
+ availableRecordBoardCardFieldsScopedState({ scopeId }),
+ ).filter(({ fieldMetadataId }) => !fieldKeys.includes(fieldMetadataId));
- return [
- ...fields.filter((field) => !field.isVisible),
- ...otherAvailableKeys,
- ];
- },
-});
+ return [
+ ...fields.filter((field) => !field.isVisible),
+ ...otherAvailableKeys,
+ ];
+ },
+ },
+);
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/selectedRecordBoardCardIdsScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/selectedRecordBoardCardIdsScopedSelector.ts
index a93e65544cf..0c75069e31f 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/selectedRecordBoardCardIdsScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/selectedRecordBoardCardIdsScopedSelector.ts
@@ -1,10 +1,10 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { isRecordBoardCardSelectedFamilyState } from '../isRecordBoardCardSelectedFamilyState';
import { recordBoardCardIdsByColumnIdFamilyState } from '../recordBoardCardIdsByColumnIdFamilyState';
import { recordBoardColumnsScopedState } from '../recordBoardColumnsScopedState';
-export const selectedRecordBoardCardIdsScopedSelector = createScopedSelector<
+export const selectedRecordBoardCardIdsScopedSelector = createSelectorScopeMap<
string[]
>({
key: 'selectedRecordBoardCardIdsScopedSelector',
diff --git a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/visibleRecordBoardCardFieldsScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/visibleRecordBoardCardFieldsScopedSelector.ts
index 47ee4ac2d89..bca23f30336 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/states/selectors/visibleRecordBoardCardFieldsScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/states/selectors/visibleRecordBoardCardFieldsScopedSelector.ts
@@ -1,13 +1,14 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { recordBoardCardFieldsScopedState } from '../recordBoardCardFieldsScopedState';
-export const visibleRecordBoardCardFieldsScopedSelector = createScopedSelector({
- key: 'visibleRecordBoardCardFieldsScopedSelector',
- get:
- ({ scopeId }) =>
- ({ get }) =>
- get(recordBoardCardFieldsScopedState({ scopeId }))
- .filter((field) => field.isVisible)
- .sort((a, b) => a.position - b.position),
-});
+export const visibleRecordBoardCardFieldsScopedSelector =
+ createSelectorScopeMap({
+ key: 'visibleRecordBoardCardFieldsScopedSelector',
+ get:
+ ({ scopeId }) =>
+ ({ get }) =>
+ get(recordBoardCardFieldsScopedState({ scopeId }))
+ .filter((field) => field.isVisible)
+ .sort((a, b) => a.position - b.position),
+ });
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedScopedFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedScopedFamilyState.ts
index 8a684cec6dc..5ea9257c669 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-row/states/isRowSelectedScopedFamilyState.ts
@@ -1,6 +1,6 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
-export const isRowSelectedScopedFamilyState = createScopedFamilyState<
+export const isRowSelectedScopedFamilyState = createFamilyStateScopeMap<
boolean,
string
>({
diff --git a/packages/twenty-front/src/modules/object-record/record-table/scopes/scope-internal-context/RecordTableScopeInternalContext.ts b/packages/twenty-front/src/modules/object-record/record-table/scopes/scope-internal-context/RecordTableScopeInternalContext.ts
index b63b07132d4..b621b6777c0 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/scopes/scope-internal-context/RecordTableScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/scopes/scope-internal-context/RecordTableScopeInternalContext.ts
@@ -1,10 +1,10 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
import { ColumnDefinition } from '../../types/ColumnDefinition';
-type RecordTableScopeInternalContextProps = ScopedStateKey & {
+type RecordTableScopeInternalContextProps = StateScopeMapKey & {
onColumnsChange: (columns: ColumnDefinition<FieldMetadata>[]) => void;
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/availableTableColumnsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/availableTableColumnsScopedState.ts
index 9b3cf7c7c8e..2cd00c1850c 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/availableTableColumnsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/availableTableColumnsScopedState.ts
@@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ColumnDefinition } from '../types/ColumnDefinition';
-export const availableTableColumnsScopedState = createScopedState<
+export const availableTableColumnsScopedState = createStateScopeMap<
ColumnDefinition<FieldMetadata>[]
>({
key: 'availableTableColumnsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/currentTableCellInEditModePositionScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/currentTableCellInEditModePositionScopedState.ts
index c6560c4b15d..1e9e3123aee 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/currentTableCellInEditModePositionScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/currentTableCellInEditModePositionScopedState.ts
@@ -1,9 +1,9 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
export const currentTableCellInEditModePositionScopedState =
- createScopedState<TableCellPosition>({
+ createStateScopeMap<TableCellPosition>({
key: 'currentTableCellInEditModePositionScopedState',
defaultValue: {
row: 0,
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingScopedState.ts
index e7637024f97..56dbcbadf78 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/isRecordTableInitialLoadingScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isRecordTableInitialLoadingScopedState =
- createScopedState<boolean>({
+ createStateScopeMap<boolean>({
key: 'isRecordTableInitialLoadingScopedState',
defaultValue: true,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusActiveScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusActiveScopedState.ts
index a81b5c1ba96..a967e74deb1 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusActiveScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusActiveScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const isSoftFocusActiveScopedState = createScopedState<boolean>({
+export const isSoftFocusActiveScopedState = createStateScopeMap<boolean>({
key: 'isSoftFocusActiveScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusOnTableCellScopedFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusOnTableCellScopedFamilyState.ts
index 24fd6769abf..1ee7324dd8b 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusOnTableCellScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/isSoftFocusOnTableCellScopedFamilyState.ts
@@ -1,11 +1,9 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
-export const isSoftFocusOnTableCellScopedFamilyState = createScopedFamilyState<
- boolean,
- TableCellPosition
->({
- key: 'isSoftFocusOnTableCellScopedFamilyState',
- defaultValue: false,
-});
+export const isSoftFocusOnTableCellScopedFamilyState =
+ createFamilyStateScopeMap<boolean, TableCellPosition>({
+ key: 'isSoftFocusOnTableCellScopedFamilyState',
+ defaultValue: false,
+ });
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/isTableCellInEditModeScopedFamilyState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/isTableCellInEditModeScopedFamilyState.ts
index ea9ec0889ba..3a4c90777ea 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/isTableCellInEditModeScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/isTableCellInEditModeScopedFamilyState.ts
@@ -1,8 +1,8 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
-export const isTableCellInEditModeScopedFamilyState = createScopedFamilyState<
+export const isTableCellInEditModeScopedFamilyState = createFamilyStateScopeMap<
boolean,
TableCellPosition
>({
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsScopedState.ts
index f7111d95eeb..a5b136b559e 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/numberOfTableRowsScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const numberOfTableRowsScopedState = createScopedState<number>({
+export const numberOfTableRowsScopedState = createStateScopeMap<number>({
key: 'numberOfTableRowsScopedState',
defaultValue: 0,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/objectMetadataConfigScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/objectMetadataConfigScopedState.ts
index ed3ef2fa43a..cb8bb728c8e 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/objectMetadataConfigScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/objectMetadataConfigScopedState.ts
@@ -1,8 +1,8 @@
import { ObjectMetadataConfig } from '@/object-record/record-table/types/ObjectMetadataConfig';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectMetadataConfigScopedState =
- createScopedState<ObjectMetadataConfig | null>({
+ createStateScopeMap<ObjectMetadataConfig | null>({
key: 'objectMetadataConfigScopedState',
defaultValue: null,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/onColumnsChangeScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/onColumnsChangeScopedState.ts
index 88c183a5874..9f34a0aa0cd 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/onColumnsChangeScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/onColumnsChangeScopedState.ts
@@ -1,9 +1,9 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { FieldMetadata } from '../../field/types/FieldMetadata';
import { ColumnDefinition } from '../types/ColumnDefinition';
-export const onColumnsChangeScopedState = createScopedState<
+export const onColumnsChangeScopedState = createStateScopeMap<
((columns: ColumnDefinition<FieldMetadata>[]) => void) | undefined
>({
key: 'onColumnsChangeScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/onEntityCountChangeScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/onEntityCountChangeScopedState.ts
index b2889693637..cfd6c3738d1 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/onEntityCountChangeScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/onEntityCountChangeScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const onEntityCountChangeScopedState = createScopedState<
+export const onEntityCountChangeScopedState = createStateScopeMap<
((entityCount: number) => void) | undefined
>({
key: 'onEntityCountChangeScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetScopedState.ts
index 06f88bdf5dd..70a570f941e 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/resizeFieldOffsetScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const resizeFieldOffsetScopedState = createScopedState<number>({
+export const resizeFieldOffsetScopedState = createStateScopeMap<number>({
key: 'resizeFieldOffsetScopedState',
defaultValue: 0,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusScopedSelector.ts
index 8eb788e21ba..d3d269866df 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/allRowsSelectedStatusScopedSelector.ts
@@ -1,4 +1,4 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { AllRowsSelectedStatus } from '../../types/AllRowSelectedStatus';
import { numberOfTableRowsScopedState } from '../numberOfTableRowsScopedState';
@@ -6,7 +6,7 @@ import { numberOfTableRowsScopedState } from '../numberOfTableRowsScopedState';
import { selectedRowIdsScopedSelector } from './selectedRowIdsScopedSelector';
export const allRowsSelectedStatusScopedSelector =
- createScopedSelector<AllRowsSelectedStatus>({
+ createSelectorScopeMap<AllRowsSelectedStatus>({
key: 'allRowsSelectedStatusScopedSelector',
get:
({ scopeId }) =>
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/hiddenTableColumnsScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/hiddenTableColumnsScopedSelector.ts
index a6eabee8d87..4a6695ac642 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/hiddenTableColumnsScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/hiddenTableColumnsScopedSelector.ts
@@ -1,9 +1,9 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { availableTableColumnsScopedState } from '../availableTableColumnsScopedState';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
-export const hiddenTableColumnsScopedSelector = createScopedSelector({
+export const hiddenTableColumnsScopedSelector = createSelectorScopeMap({
key: 'hiddenTableColumnsScopedSelector',
get:
({ scopeId }) =>
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/numberOfTableColumnsScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/numberOfTableColumnsScopedSelector.ts
index 1e74626af2b..887683e6094 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/numberOfTableColumnsScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/numberOfTableColumnsScopedSelector.ts
@@ -1,8 +1,8 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
-export const numberOfTableColumnsScopedSelector = createScopedSelector({
+export const numberOfTableColumnsScopedSelector = createSelectorScopeMap({
key: 'numberOfTableColumnsScopedSelector',
get:
({ scopeId }) =>
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsScopedSelector.ts
index 5988954c30e..74abdda2697 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/selectedRowIdsScopedSelector.ts
@@ -1,9 +1,9 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { isRowSelectedScopedFamilyState } from '../../record-table-row/states/isRowSelectedScopedFamilyState';
import { tableRowIdsScopedState } from '../tableRowIdsScopedState';
-export const selectedRowIdsScopedSelector = createScopedSelector<string[]>({
+export const selectedRowIdsScopedSelector = createSelectorScopeMap<string[]>({
key: 'selectedRowIdsScopedSelector',
get:
({ scopeId }) =>
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/tableColumnsByKeyScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/tableColumnsByKeyScopedSelector.ts
index 743d541db97..ccc4a281c69 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/tableColumnsByKeyScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/tableColumnsByKeyScopedSelector.ts
@@ -1,10 +1,10 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { ColumnDefinition } from '../../types/ColumnDefinition';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
-export const tableColumnsByKeyScopedSelector = createScopedSelector({
+export const tableColumnsByKeyScopedSelector = createSelectorScopeMap({
key: 'tableColumnsByKeyScopedSelector',
get:
({ scopeId }) =>
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/visibleTableColumnsScopedSelector.ts b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/visibleTableColumnsScopedSelector.ts
index 35e57373bbe..1e26e5ac1cf 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/selectors/visibleTableColumnsScopedSelector.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/selectors/visibleTableColumnsScopedSelector.ts
@@ -1,9 +1,9 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { availableTableColumnsScopedState } from '../availableTableColumnsScopedState';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
-export const visibleTableColumnsScopedSelector = createScopedSelector({
+export const visibleTableColumnsScopedSelector = createSelectorScopeMap({
key: 'visibleTableColumnsScopedSelector',
get:
({ scopeId }) =>
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/softFocusPositionScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/softFocusPositionScopedState.ts
index ab46025c291..df114dd1421 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/softFocusPositionScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/softFocusPositionScopedState.ts
@@ -1,9 +1,9 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
export const softFocusPositionScopedState =
- createScopedState<TableCellPosition>({
+ createStateScopeMap<TableCellPosition>({
key: 'softFocusPositionScopedState',
defaultValue: {
row: 0,
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/tableColumnsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/tableColumnsScopedState.ts
index 45489b2ccbd..bcb95a9d5ca 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/tableColumnsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/tableColumnsScopedState.ts
@@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ColumnDefinition } from '../types/ColumnDefinition';
-export const tableColumnsScopedState = createScopedState<
+export const tableColumnsScopedState = createStateScopeMap<
ColumnDefinition<FieldMetadata>[]
>({
key: 'tableColumnsScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/tableFiltersScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/tableFiltersScopedState.ts
index 5206f3fd7c3..bc1d3d65d67 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/tableFiltersScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/tableFiltersScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Filter } from '../../object-filter-dropdown/types/Filter';
-export const tableFiltersScopedState = createScopedState<Filter[]>({
+export const tableFiltersScopedState = createStateScopeMap<Filter[]>({
key: 'tableFiltersScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/tableLastRowVisibleScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/tableLastRowVisibleScopedState.ts
index db2363d29d2..c4857afe337 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/tableLastRowVisibleScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/tableLastRowVisibleScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const tableLastRowVisibleScopedState = createScopedState<boolean>({
+export const tableLastRowVisibleScopedState = createStateScopeMap<boolean>({
key: 'tableLastRowVisibleScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/tableRowIdsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/tableRowIdsScopedState.ts
index 79d5c2dc324..4e55d0c5db9 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/tableRowIdsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/tableRowIdsScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const tableRowIdsScopedState = createScopedState<string[]>({
+export const tableRowIdsScopedState = createStateScopeMap<string[]>({
key: 'tableRowIdsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/states/tableSortsScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/states/tableSortsScopedState.ts
index 1d555cc9b66..37f4e568cc5 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/states/tableSortsScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/states/tableSortsScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Sort } from '../../object-sort-dropdown/types/Sort';
-export const tableSortsScopedState = createScopedState<Sort[]>({
+export const tableSortsScopedState = createStateScopeMap<Sort[]>({
key: 'tableSortsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/components/SelectableMenuItemSelect.tsx b/packages/twenty-front/src/modules/object-record/relation-picker/components/SelectableMenuItemSelect.tsx
index 0a8815257b5..5d8784fab5c 100644
--- a/packages/twenty-front/src/modules/object-record/relation-picker/components/SelectableMenuItemSelect.tsx
+++ b/packages/twenty-front/src/modules/object-record/relation-picker/components/SelectableMenuItemSelect.tsx
@@ -22,13 +22,11 @@ export const SelectableMenuItemSelect = ({
onEntitySelected,
selectedEntity,
}: SelectableMenuItemSelectProps) => {
- const { isSelectedItemIdFamilyState } = useSelectableList(
+ const { isSelectedItemIdSelector } = useSelectableList(
'single-entity-select-base-list',
);
- const isSelectedItemId = useRecoilValue(
- isSelectedItemIdFamilyState(entity.id),
- );
+ const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(entity.id));
return (
<StyledSelectableItem itemId={entity.id} key={entity.id}>
diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/scopes/scope-internal-context/RelationPickerScopeInternalContext.ts b/packages/twenty-front/src/modules/object-record/relation-picker/scopes/scope-internal-context/RelationPickerScopeInternalContext.ts
index 6458f60650e..8e49b1267aa 100644
--- a/packages/twenty-front/src/modules/object-record/relation-picker/scopes/scope-internal-context/RelationPickerScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/object-record/relation-picker/scopes/scope-internal-context/RelationPickerScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type RelationPickerScopeInternalContextProps = ScopedStateKey;
+type RelationPickerScopeInternalContextProps = StateScopeMapKey;
export const RelationPickerScopeInternalContext =
createScopeInternalContext<RelationPickerScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/states/identifiersMapperScopedState.ts b/packages/twenty-front/src/modules/object-record/relation-picker/states/identifiersMapperScopedState.ts
index 0153df80c96..7b2683e250d 100644
--- a/packages/twenty-front/src/modules/object-record/relation-picker/states/identifiersMapperScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/relation-picker/states/identifiersMapperScopedState.ts
@@ -1,8 +1,8 @@
import { IdentifiersMapper } from '@/object-record/relation-picker/types/IdentifiersMapper';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const identifiersMapperScopedState =
- createScopedState<IdentifiersMapper | null>({
+ createStateScopeMap<IdentifiersMapper | null>({
key: 'identifiersMapperScopedState',
defaultValue: null,
});
diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerPreselectedIdScopedState.ts b/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerPreselectedIdScopedState.ts
index 33707973bc9..2266afc5b33 100644
--- a/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerPreselectedIdScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerPreselectedIdScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const relationPickerPreselectedIdScopedState = createScopedState<
+export const relationPickerPreselectedIdScopedState = createStateScopeMap<
string | undefined
>({
key: 'relationPickerPreselectedIdScopedState',
diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerSearchFilterScopedState.ts b/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerSearchFilterScopedState.ts
index 113d2f4ce9d..5184ff81074 100644
--- a/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerSearchFilterScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/relation-picker/states/relationPickerSearchFilterScopedState.ts
@@ -1,6 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const relationPickerSearchFilterScopedState = createScopedState<string>({
- key: 'relationPickerSearchFilterScopedState',
- defaultValue: '',
-});
+export const relationPickerSearchFilterScopedState =
+ createStateScopeMap<string>({
+ key: 'relationPickerSearchFilterScopedState',
+ defaultValue: '',
+ });
diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/states/searchQueryScopedState.ts b/packages/twenty-front/src/modules/object-record/relation-picker/states/searchQueryScopedState.ts
index f9dd1a64f4a..5f94b225a2d 100644
--- a/packages/twenty-front/src/modules/object-record/relation-picker/states/searchQueryScopedState.ts
+++ b/packages/twenty-front/src/modules/object-record/relation-picker/states/searchQueryScopedState.ts
@@ -1,7 +1,7 @@
import { SearchQuery } from '@/object-record/relation-picker/types/SearchQuery';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const searchQueryScopedState = createScopedState<SearchQuery | null>({
+export const searchQueryScopedState = createStateScopeMap<SearchQuery | null>({
key: 'searchQueryScopedState',
defaultValue: null,
});
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsCard.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsCard.tsx
index 742e479f991..362be4c2422 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsCard.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsEmailsCard.tsx
@@ -30,7 +30,7 @@ export const SettingsAccountsEmailsCard = ({
<Card>
{accounts.map((account, index) => (
<SettingsAccountRow
- key={account.uuid}
+ key={account.id}
LeftIcon={IconGmail}
account={account}
rightComponent={
@@ -43,7 +43,7 @@ export const SettingsAccountsEmailsCard = ({
<LightIconButton Icon={IconChevronRight} accent="tertiary" />
</StyledRightContainer>
}
- onClick={() => navigate(`/settings/accounts/emails/${account.uuid}`)}
+ onClick={() => navigate(`/settings/accounts/emails/${account.id}`)}
divider={index < accounts.length - 1}
/>
))}
diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/scopes/scope-internal-context/DialogManagerScopeInternalContext.ts b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/scopes/scope-internal-context/DialogManagerScopeInternalContext.ts
index 346dcc5fb80..428596e8f44 100644
--- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/scopes/scope-internal-context/DialogManagerScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/scopes/scope-internal-context/DialogManagerScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type DialogManagerScopeInternalContextProps = ScopedStateKey;
+type DialogManagerScopeInternalContextProps = StateScopeMapKey;
export const DialogManagerScopeInternalContext =
createScopeInternalContext<DialogManagerScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalScopedState.ts b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalScopedState.ts
index 797e07c6223..13bc5cb7df0 100644
--- a/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalScopedState.ts
+++ b/packages/twenty-front/src/modules/ui/feedback/dialog-manager/states/dialogInternalScopedState.ts
@@ -1,4 +1,4 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { DialogOptions } from '../types/DialogOptions';
@@ -7,7 +7,7 @@ type DialogState = {
queue: DialogOptions[];
};
-export const dialogInternalScopedState = createScopedState<DialogState>({
+export const dialogInternalScopedState = createStateScopeMap<DialogState>({
key: 'dialog/internal-state',
defaultValue: {
maxQueue: 2,
diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/scopes/scope-internal-context/SnackBarManagerScopeInternalContext.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/scopes/scope-internal-context/SnackBarManagerScopeInternalContext.ts
index c7be54b3800..274d356a84c 100644
--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/scopes/scope-internal-context/SnackBarManagerScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/scopes/scope-internal-context/SnackBarManagerScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type SnackBarManagerScopeInternalContextProps = ScopedStateKey;
+type SnackBarManagerScopeInternalContextProps = StateScopeMapKey;
export const SnackBarManagerScopeInternalContext =
createScopeInternalContext<SnackBarManagerScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalScopedState.ts b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalScopedState.ts
index 18dc03e4f3a..e92de1f5f25 100644
--- a/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalScopedState.ts
+++ b/packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/states/snackBarInternalScopedState.ts
@@ -1,4 +1,4 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { SnackBarProps } from '../components/SnackBar';
@@ -11,7 +11,7 @@ type SnackBarState = {
queue: SnackBarOptions[];
};
-export const snackBarInternalScopedState = createScopedState<SnackBarState>({
+export const snackBarInternalScopedState = createStateScopeMap<SnackBarState>({
key: 'snackBarState',
defaultValue: {
maxQueue: 3,
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 0beec0fbf4d..97182ec1c55 100644
--- a/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
@@ -61,9 +61,9 @@ const IconPickerIcon = ({
selectedIconKey,
Icon,
}: IconPickerIconProps) => {
- const { isSelectedItemIdFamilyState } = useSelectableList();
+ const { isSelectedItemIdSelector } = useSelectableList();
- const isSelectedItemId = useRecoilValue(isSelectedItemIdFamilyState(iconKey));
+ const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(iconKey));
return (
<StyledLightIconButton
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/scopes/scope-internal-context/DropdownScopeInternalContext.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/scopes/scope-internal-context/DropdownScopeInternalContext.ts
index de5e7d3f12e..5b6ae045b9c 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/scopes/scope-internal-context/DropdownScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/scopes/scope-internal-context/DropdownScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type DropdownScopeInternalContextProps = ScopedStateKey;
+type DropdownScopeInternalContextProps = StateScopeMapKey;
export const DropdownScopeInternalContext =
createScopeInternalContext<DropdownScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownHotkeyScopeScopedState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownHotkeyScopeScopedState.ts
index fbcac52b38c..d4701563379 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownHotkeyScopeScopedState.ts
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownHotkeyScopeScopedState.ts
@@ -1,7 +1,7 @@
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const dropdownHotkeyScopeScopedState = createScopedState<
+export const dropdownHotkeyScopeScopedState = createStateScopeMap<
HotkeyScope | null | undefined
>({
key: 'dropdownHotkeyScopeScopedState',
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownWidthScopedState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownWidthScopedState.ts
index b620687c695..717a3a1cd65 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownWidthScopedState.ts
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/dropdownWidthScopedState.ts
@@ -1,6 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const dropdownWidthScopedState = createScopedState<number | undefined>({
- key: 'dropdownWidthScopedState',
- defaultValue: 160,
-});
+export const dropdownWidthScopedState = createStateScopeMap<number | undefined>(
+ {
+ key: 'dropdownWidthScopedState',
+ defaultValue: 160,
+ },
+);
diff --git a/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenScopedState.ts b/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenScopedState.ts
index 56d6f905ec3..65d0c073ca6 100644
--- a/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenScopedState.ts
+++ b/packages/twenty-front/src/modules/ui/layout/dropdown/states/isDropdownOpenScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const isDropdownOpenScopedState = createScopedState<boolean>({
+export const isDropdownOpenScopedState = createStateScopeMap<boolean>({
key: 'isDropdownOpenScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableItem.tsx b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableItem.tsx
index 9c6315a423f..c4678f4d2d8 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableItem.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/components/SelectableItem.tsx
@@ -14,9 +14,9 @@ export const SelectableItem = ({
children,
className,
}: SelectableItemProps) => {
- const { isSelectedItemIdFamilyState } = useSelectableList();
+ const { isSelectedItemIdSelector } = useSelectableList();
- const isSelectedItemId = useRecoilValue(isSelectedItemIdFamilyState(itemId));
+ const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(itemId));
const scrollRef = useRef<HTMLDivElement>(null);
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.tsx b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.tsx
index 924c61c56b5..9a9d74cfc4b 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys.tsx
@@ -1,9 +1,9 @@
import { useRecoilCallback } from 'recoil';
import { Key } from 'ts-key-enum';
-import { useSelectableListScopedState } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListScopedState';
-import { getSelectableListScopeInjectors } from '@/ui/layout/selectable-list/utils/internal/getSelectableListScopeInjectors';
+import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListStates';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
+import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
type Direction = 'up' | 'down' | 'left' | 'right';
@@ -27,27 +27,22 @@ export const useSelectableListHotKeys = (
}
};
- const { injectSnapshotValueWithSelectableListScopeId } =
- useSelectableListScopedState({
- selectableListScopeId: scopeId,
- });
+ const {
+ selectedItemIdState,
+ selectableItemIdsState,
+ isSelectedItemIdSelector,
+ selectableListOnEnterState,
+ } = useSelectableListStates({
+ selectableListScopeId: scopeId,
+ });
const handleSelect = useRecoilCallback(
({ snapshot, set }) =>
(direction: Direction) => {
- const {
- selectedItemIdScopeInjector,
- selectableItemIdsScopeInjector,
- isSelectedItemIdFamilyScopeInjector,
- } = getSelectableListScopeInjectors();
-
- const selectedItemId = injectSnapshotValueWithSelectableListScopeId(
- snapshot,
- selectedItemIdScopeInjector,
- );
- const selectableItemIds = injectSnapshotValueWithSelectableListScopeId(
+ const selectedItemId = getSnapshotValue(snapshot, selectedItemIdState);
+ const selectableItemIds = getSnapshotValue(
snapshot,
- selectableItemIdsScopeInjector,
+ selectableItemIdsState,
);
const currentPosition = findPosition(selectableItemIds, selectedItemId);
@@ -107,19 +102,16 @@ export const useSelectableListHotKeys = (
if (selectedItemId !== nextId) {
if (nextId) {
- set(isSelectedItemIdFamilyScopeInjector(scopeId, nextId), true);
- set(selectedItemIdScopeInjector(scopeId), nextId);
+ set(isSelectedItemIdSelector(nextId), true);
+ set(selectedItemIdState, nextId);
}
if (selectedItemId) {
- set(
- isSelectedItemIdFamilyScopeInjector(scopeId, selectedItemId),
- false,
- );
+ set(isSelectedItemIdSelector(selectedItemId), false);
}
}
},
- [injectSnapshotValueWithSelectableListScopeId, scopeId],
+ [isSelectedItemIdSelector, selectableItemIdsState, selectedItemIdState],
);
useScopedHotkeys(Key.ArrowUp, () => handleSelect('up'), hotkeyScope, []);
@@ -140,25 +132,20 @@ export const useSelectableListHotKeys = (
useRecoilCallback(
({ snapshot }) =>
() => {
- const {
- selectedItemIdScopeInjector,
- selectableListOnEnterScopeInjector,
- } = getSelectableListScopeInjectors();
- const selectedItemId = injectSnapshotValueWithSelectableListScopeId(
+ const selectedItemId = getSnapshotValue(
snapshot,
- selectedItemIdScopeInjector,
+ selectedItemIdState,
);
-
- const onEnter = injectSnapshotValueWithSelectableListScopeId(
+ const onEnter = getSnapshotValue(
snapshot,
- selectableListOnEnterScopeInjector,
+ selectableListOnEnterState,
);
if (selectedItemId) {
onEnter?.(selectedItemId);
}
},
- [injectSnapshotValueWithSelectableListScopeId],
+ [selectableListOnEnterState, selectedItemIdState],
),
hotkeyScope,
[],
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListScopedState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListScopedState.ts
deleted file mode 100644
index 2388ebb1162..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListScopedState.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { SelectableListScopeInternalContext } from '@/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext';
-import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
-import { useScopedState } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useScopedState';
-
-type UseSelectableListScopedStatesProps = {
- selectableListScopeId?: string;
-};
-
-export const useSelectableListScopedState = ({
- selectableListScopeId,
-}: UseSelectableListScopedStatesProps) => {
- const scopeId = useAvailableScopeIdOrThrow(
- SelectableListScopeInternalContext,
- selectableListScopeId,
- );
-
- const {
- getScopedState,
- getScopedFamilyState,
- getScopedSnapshotValue,
- getScopedFamilySnapshotValue,
- } = useScopedState(scopeId);
-
- return {
- scopeId,
- injectStateWithSelectableListScopeId: getScopedState,
- injectFamilyStateWithSelectableListScopeId: getScopedFamilyState,
- injectSnapshotValueWithSelectableListScopeId: getScopedSnapshotValue,
- injectFamilySnapshotValueWithSelectableListScopeId:
- getScopedFamilySnapshotValue,
- };
-};
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListStates.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListStates.ts
new file mode 100644
index 00000000000..97179525c1a
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/internal/useSelectableListStates.ts
@@ -0,0 +1,35 @@
+import { SelectableListScopeInternalContext } from '@/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext';
+import { selectableItemIdsStateScopeMap } from '@/ui/layout/selectable-list/states/selectableItemIdsStateScopeMap';
+import { selectableListOnEnterStateScopeMap } from '@/ui/layout/selectable-list/states/selectableListOnEnterStateScopeMap';
+import { selectedItemIdStateScopeMap } from '@/ui/layout/selectable-list/states/selectedItemIdStateScopeMap';
+import { isSelectedItemIdFamilySelectorScopeMap } from '@/ui/layout/selectable-list/states/selectors/isSelectedItemIdFamilySelectorScopeMap';
+import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
+import { getFamilyState } from '@/ui/utilities/recoil-scope/utils/getFamilyState';
+import { getState } from '@/ui/utilities/recoil-scope/utils/getState';
+
+type useSelectableListStatesProps = {
+ selectableListScopeId?: string;
+};
+
+export const useSelectableListStates = ({
+ selectableListScopeId,
+}: useSelectableListStatesProps) => {
+ const scopeId = useAvailableScopeIdOrThrow(
+ SelectableListScopeInternalContext,
+ selectableListScopeId,
+ );
+
+ return {
+ scopeId,
+ isSelectedItemIdSelector: getFamilyState(
+ isSelectedItemIdFamilySelectorScopeMap,
+ scopeId,
+ ),
+ selectableItemIdsState: getState(selectableItemIdsStateScopeMap, scopeId),
+ selectableListOnEnterState: getState(
+ selectableListOnEnterStateScopeMap,
+ scopeId,
+ ),
+ selectedItemIdState: getState(selectedItemIdStateScopeMap, scopeId),
+ };
+};
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableList.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableList.ts
index ccadbba6502..37098d3c90c 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableList.ts
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/hooks/useSelectableList.ts
@@ -1,38 +1,24 @@
import { useResetRecoilState, useSetRecoilState } from 'recoil';
-import { useSelectableListScopedState } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListScopedState';
-import { getSelectableListScopeInjectors } from '@/ui/layout/selectable-list/utils/internal/getSelectableListScopeInjectors';
+import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListStates';
export const useSelectableList = (selectableListId?: string) => {
const {
- injectStateWithSelectableListScopeId,
- injectFamilyStateWithSelectableListScopeId,
scopeId,
- } = useSelectableListScopedState({
+ selectableItemIdsState,
+ selectableListOnEnterState,
+ isSelectedItemIdSelector,
+ selectedItemIdState,
+ } = useSelectableListStates({
selectableListScopeId: selectableListId,
});
- const {
- selectedItemIdScopeInjector,
- selectableItemIdsScopeInjector,
- selectableListOnEnterScopeInjector,
- isSelectedItemIdFamilyScopeInjector,
- } = getSelectableListScopeInjectors();
-
- const setSelectableItemIds = useSetRecoilState(
- injectStateWithSelectableListScopeId(selectableItemIdsScopeInjector),
- );
+ const setSelectableItemIds = useSetRecoilState(selectableItemIdsState);
const setSelectableListOnEnter = useSetRecoilState(
- injectStateWithSelectableListScopeId(selectableListOnEnterScopeInjector),
+ selectableListOnEnterState,
);
- const isSelectedItemIdFamilyState =
- injectFamilyStateWithSelectableListScopeId(
- isSelectedItemIdFamilyScopeInjector,
- );
- const resetSelectedItemIdState = useResetRecoilState(
- injectStateWithSelectableListScopeId(selectedItemIdScopeInjector),
- );
+ const resetSelectedItemIdState = useResetRecoilState(selectedItemIdState);
const resetSelectedItem = () => {
resetSelectedItemIdState();
@@ -42,7 +28,7 @@ export const useSelectableList = (selectableListId?: string) => {
selectableListId: scopeId,
setSelectableItemIds,
- isSelectedItemIdFamilyState,
+ isSelectedItemIdSelector,
setSelectableListOnEnter,
resetSelectedItem,
};
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext.ts
index 57285e0eaf0..7857bfdd37b 100644
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type SelectableListScopeInternalContextProps = ScopedStateKey;
+type SelectableListScopeInternalContextProps = StateScopeMapKey;
export const SelectableListScopeInternalContext =
createScopeInternalContext<SelectableListScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdFamilyStateScopeMap.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdFamilyStateScopeMap.ts
new file mode 100644
index 00000000000..84bc20fd41c
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdFamilyStateScopeMap.ts
@@ -0,0 +1,9 @@
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
+
+export const isSelectedItemIdFamilyStateScopeMap = createFamilyStateScopeMap<
+ boolean,
+ string
+>({
+ key: 'isSelectedItemIdMapScopedFamilyState',
+ defaultValue: false,
+});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdMapScopedFamilyState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdMapScopedFamilyState.ts
deleted file mode 100644
index ed527c59aeb..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/isSelectedItemIdMapScopedFamilyState.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
-
-export const isSelectedItemIdMapScopedFamilyState = createScopedFamilyState<
- boolean,
- string
->({
- key: 'isSelectedItemIdMapScopedFamilyState',
- defaultValue: false,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsScopedState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsScopedState.ts
deleted file mode 100644
index 1e56312e992..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsScopedState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
-
-export const selectableItemIdsScopedState = createScopedState<string[][]>({
- key: 'selectableItemIdsScopedState',
- defaultValue: [[]],
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsStateScopeMap.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsStateScopeMap.ts
new file mode 100644
index 00000000000..19c3e68eb60
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableItemIdsStateScopeMap.ts
@@ -0,0 +1,6 @@
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
+
+export const selectableItemIdsStateScopeMap = createStateScopeMap<string[][]>({
+ key: 'selectableItemIdsScopedState',
+ defaultValue: [[]],
+});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableListOnEnterScopedState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableListOnEnterScopedState.ts
deleted file mode 100644
index ef6752569a3..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableListOnEnterScopedState.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
-
-export const selectableListOnEnterScopedState = createScopedState<
- ((itemId: string) => void) | undefined
->({
- key: 'selectableListOnEnterScopedState',
- defaultValue: undefined,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableListOnEnterStateScopeMap.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableListOnEnterStateScopeMap.ts
new file mode 100644
index 00000000000..055b1d117f4
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectableListOnEnterStateScopeMap.ts
@@ -0,0 +1,8 @@
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
+
+export const selectableListOnEnterStateScopeMap = createStateScopeMap<
+ ((itemId: string) => void) | undefined
+>({
+ key: 'selectableListOnEnterScopedState',
+ defaultValue: undefined,
+});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdScopedState.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdScopedState.ts
deleted file mode 100644
index b1b41c3cff8..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdScopedState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
-
-export const selectedItemIdScopedState = createScopedState<string | null>({
- key: 'selectedItemIdScopedState',
- defaultValue: null,
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdStateScopeMap.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdStateScopeMap.ts
new file mode 100644
index 00000000000..8445a2c2ec1
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectedItemIdStateScopeMap.ts
@@ -0,0 +1,6 @@
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
+
+export const selectedItemIdStateScopeMap = createStateScopeMap<string | null>({
+ key: 'selectedItemIdScopedState',
+ defaultValue: null,
+});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectors/isSelectedItemIdFamilySelectorScopeMap.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectors/isSelectedItemIdFamilySelectorScopeMap.ts
new file mode 100644
index 00000000000..6eae4ad0c1c
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectors/isSelectedItemIdFamilySelectorScopeMap.ts
@@ -0,0 +1,26 @@
+import { isSelectedItemIdFamilyStateScopeMap } from '@/ui/layout/selectable-list/states/isSelectedItemIdFamilyStateScopeMap';
+import { createFamilySelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilySelectorScopeMap';
+
+export const isSelectedItemIdFamilySelectorScopeMap =
+ createFamilySelectorScopeMap<boolean, string>({
+ key: 'isSelectedItemIdScopedFamilySelector',
+ get:
+ ({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
+ ({ get }) =>
+ get(
+ isSelectedItemIdFamilyStateScopeMap({
+ scopeId: scopeId,
+ familyKey: familyKey,
+ }),
+ ),
+ set:
+ ({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
+ ({ set }, newValue) =>
+ set(
+ isSelectedItemIdFamilyStateScopeMap({
+ scopeId: scopeId,
+ familyKey: familyKey,
+ }),
+ newValue,
+ ),
+ });
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectors/isSelectedItemIdScopedFamilySelector.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectors/isSelectedItemIdScopedFamilySelector.ts
deleted file mode 100644
index 31cb4b048d4..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/states/selectors/isSelectedItemIdScopedFamilySelector.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { isSelectedItemIdMapScopedFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdMapScopedFamilyState';
-import { createScopedFamilySelector } from '@/ui/utilities/recoil-scope/utils/createScopedFamilySelector';
-
-export const isSelectedItemIdScopedFamilySelector = createScopedFamilySelector<
- boolean,
- string
->({
- key: 'isSelectedItemIdScopedFamilySelector',
- get:
- ({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
- ({ get }) =>
- get(
- isSelectedItemIdMapScopedFamilyState({
- scopeId: scopeId,
- familyKey: familyKey,
- }),
- ),
- set:
- ({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
- ({ set }, newValue) =>
- set(
- isSelectedItemIdMapScopedFamilyState({
- scopeId: scopeId,
- familyKey: familyKey,
- }),
- newValue,
- ),
-});
diff --git a/packages/twenty-front/src/modules/ui/layout/selectable-list/utils/internal/getSelectableListScopeInjectors.ts b/packages/twenty-front/src/modules/ui/layout/selectable-list/utils/internal/getSelectableListScopeInjectors.ts
deleted file mode 100644
index c02eebbc4ec..00000000000
--- a/packages/twenty-front/src/modules/ui/layout/selectable-list/utils/internal/getSelectableListScopeInjectors.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { selectableItemIdsScopedState } from '@/ui/layout/selectable-list/states/selectableItemIdsScopedState';
-import { selectableListOnEnterScopedState } from '@/ui/layout/selectable-list/states/selectableListOnEnterScopedState';
-import { selectedItemIdScopedState } from '@/ui/layout/selectable-list/states/selectedItemIdScopedState';
-import { isSelectedItemIdScopedFamilySelector } from '@/ui/layout/selectable-list/states/selectors/isSelectedItemIdScopedFamilySelector';
-import { getFamilyScopeInjector } from '@/ui/utilities/recoil-scope/utils/getFamilyScopeInjector';
-import { getScopeInjector } from '@/ui/utilities/recoil-scope/utils/getScopeInjector';
-
-export const getSelectableListScopeInjectors = () => {
- const selectedItemIdScopeInjector = getScopeInjector(
- selectedItemIdScopedState,
- );
- const selectableItemIdsScopeInjector = getScopeInjector(
- selectableItemIdsScopedState,
- );
- const selectableListOnEnterScopeInjector = getScopeInjector(
- selectableListOnEnterScopedState,
- );
- const isSelectedItemIdFamilyScopeInjector = getFamilyScopeInjector(
- isSelectedItemIdScopedFamilySelector,
- );
-
- return {
- selectedItemIdScopeInjector,
- selectableItemIdsScopeInjector,
- selectableListOnEnterScopeInjector,
- isSelectedItemIdFamilyScopeInjector,
- };
-};
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedFamilyState.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedFamilyState.ts
index 76b4efcf24f..457a8fb09ba 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedFamilyState.ts
@@ -1,13 +1,13 @@
import { RecoilState, SerializableParam, useRecoilState } from 'recoil';
-import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
+import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
export const useRecoilScopedFamilyState = <
StateType,
FamilyKey extends SerializableParam,
>(
recoilState: (
- scopedFamilyKey: ScopedFamilyStateKey<FamilyKey>,
+ scopedFamilyKey: FamilyStateScopeMapKey<FamilyKey>,
) => RecoilState<StateType>,
scopeId: string,
familyKey?: FamilyKey,
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedStateV2.ts
index 8e81182f6a4..389a4aa32f8 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedStateV2.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedStateV2.ts
@@ -1,9 +1,9 @@
import { RecoilState, useRecoilState } from 'recoil';
-import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
export const useRecoilScopedStateV2 = <StateType>(
- recoilState: (scopedKey: ScopedStateKey) => RecoilState<StateType>,
+ recoilState: (scopedKey: StateScopeMapKey) => RecoilState<StateType>,
scopeId: string,
) => {
return useRecoilState<StateType>(
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedValueV2.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedValueV2.ts
index b3b2126b70d..f3f90d1e8da 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedValueV2.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useRecoilScopedValueV2.ts
@@ -1,9 +1,9 @@
import { RecoilState, useRecoilValue } from 'recoil';
-import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
export const useRecoilScopedValueV2 = <StateType>(
- recoilState: (scopedKey: ScopedStateKey) => RecoilState<StateType>,
+ recoilState: (scopedKey: StateScopeMapKey) => RecoilState<StateType>,
scopeId: string,
) => {
return useRecoilValue<StateType>(
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedFamilyState.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedFamilyState.ts
index ee1a3be8edb..e74d1f171f5 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedFamilyState.ts
@@ -1,13 +1,13 @@
import { RecoilState, SerializableParam, useSetRecoilState } from 'recoil';
-import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
+import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
export const useSetRecoilScopedFamilyState = <
StateType,
FamilyKey extends SerializableParam,
>(
recoilState: (
- scopedFamilyKey: ScopedFamilyStateKey<FamilyKey>,
+ scopedFamilyKey: FamilyStateScopeMapKey<FamilyKey>,
) => RecoilState<StateType>,
scopeId: string,
familyKey?: FamilyKey,
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedStateV2.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedStateV2.ts
index fc043036fff..35396eebcd5 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedStateV2.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/hooks/useSetRecoilScopedStateV2.ts
@@ -1,9 +1,9 @@
import { RecoilState, useSetRecoilState } from 'recoil';
-import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
export const useSetRecoilScopedStateV2 = <StateType>(
- recoilState: (scopedKey: ScopedStateKey) => RecoilState<StateType>,
+ recoilState: (scopedKey: StateScopeMapKey) => RecoilState<StateType>,
scopeId: string,
) => {
return useSetRecoilState<StateType>(
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/ScopedFamilyStateKey.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/FamilyStateScopeMapKey.ts
similarity index 54%
rename from packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/ScopedFamilyStateKey.ts
rename to packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/FamilyStateScopeMapKey.ts
index 2930aaed432..96733c979d9 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/ScopedFamilyStateKey.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/FamilyStateScopeMapKey.ts
@@ -1,6 +1,6 @@
import { SerializableParam } from 'recoil';
-export type ScopedFamilyStateKey<FamilyKey extends SerializableParam> = {
+export type FamilyStateScopeMapKey<FamilyKey extends SerializableParam> = {
scopeId: string;
familyKey: FamilyKey;
};
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey.ts
deleted file mode 100644
index e0904f87ff0..00000000000
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export type ScopedStateKey = {
- scopeId: string;
-};
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey.ts
new file mode 100644
index 00000000000..3915d9478ee
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey.ts
@@ -0,0 +1,3 @@
+export type StateScopeMapKey = {
+ scopeId: string;
+};
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext.ts
index e5a3c0ab23a..8789a15726c 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext.ts
@@ -1,10 +1,10 @@
import { Context, createContext } from 'react';
-import { ScopedStateKey } from '../types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
-type ScopeInternalContext<T extends ScopedStateKey> = Context<T | null>;
+type ScopeInternalContext<T extends StateScopeMapKey> = Context<T | null>;
-export const createScopeInternalContext = <T extends ScopedStateKey>(
+export const createScopeInternalContext = <T extends StateScopeMapKey>(
initialValue?: T,
) => {
return createContext<T | null>(
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedSelector.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedSelector.ts
index 99d96b736df..69803560096 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedSelector.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedSelector.ts
@@ -1,7 +1,7 @@
import { RecoilValueReadOnly } from 'recoil';
-import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
export type RecoilScopedSelector<StateType> = (
- scopedKey: ScopedStateKey,
+ scopedKey: StateScopeMapKey,
) => RecoilValueReadOnly<StateType>;
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedState.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedState.ts
index f17cc4d71e7..ace7ab39ec9 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedState.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/types/RecoilScopedState.ts
@@ -1,7 +1,7 @@
import { RecoilState } from 'recoil';
-import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
export type RecoilScopedState<StateType> = (
- scopedKey: ScopedStateKey,
+ scopedKey: StateScopeMapKey,
) => RecoilState<StateType>;
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedFamilySelector.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createFamilySelectorScopeMap.ts
similarity index 66%
rename from packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedFamilySelector.ts
rename to packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createFamilySelectorScopeMap.ts
index 7701f0d4663..cdfbc6a102d 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedFamilySelector.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createFamilySelectorScopeMap.ts
@@ -11,7 +11,7 @@ import {
WrappedValue,
} from 'recoil';
-import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
+import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
type SelectorGetter<T, P> = (
param: P,
@@ -27,7 +27,7 @@ type SelectorSetter<T, P> = (
newValue: T | DefaultValue,
) => void;
-export const createScopedFamilySelector = <
+export const createFamilySelectorScopeMap = <
ValueType,
FamilyKey extends SerializableParam,
>({
@@ -36,10 +36,10 @@ export const createScopedFamilySelector = <
set,
}: {
key: string;
- get: SelectorGetter<ValueType, ScopedFamilyStateKey<FamilyKey>>;
- set: SelectorSetter<ValueType, ScopedFamilyStateKey<FamilyKey>>;
+ get: SelectorGetter<ValueType, FamilyStateScopeMapKey<FamilyKey>>;
+ set: SelectorSetter<ValueType, FamilyStateScopeMapKey<FamilyKey>>;
}) => {
- return selectorFamily<ValueType, ScopedFamilyStateKey<FamilyKey>>({
+ return selectorFamily<ValueType, FamilyStateScopeMapKey<FamilyKey>>({
key,
get,
set,
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedFamilyState.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap.ts
similarity index 51%
rename from packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedFamilyState.ts
rename to packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap.ts
index e73a891ef36..0c44711cc2f 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap.ts
@@ -1,8 +1,8 @@
import { atomFamily, SerializableParam } from 'recoil';
-import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
+import { FamilyStateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/FamilyStateScopeMapKey';
-export const createScopedFamilyState = <
+export const createFamilyStateScopeMap = <
ValueType,
FamilyKey extends SerializableParam,
>({
@@ -12,7 +12,7 @@ export const createScopedFamilyState = <
key: string;
defaultValue: ValueType;
}) => {
- return atomFamily<ValueType, ScopedFamilyStateKey<FamilyKey>>({
+ return atomFamily<ValueType, FamilyStateScopeMapKey<FamilyKey>>({
key,
default: defaultValue,
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedState.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedState.ts
deleted file mode 100644
index 74d128ac014..00000000000
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedState.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { atomFamily } from 'recoil';
-
-export const createScopedState = <ValueType>({
- key,
- defaultValue,
-}: {
- key: string;
- defaultValue: ValueType;
-}) => {
- return atomFamily<ValueType, { scopeId: string }>({
- key,
- default: defaultValue,
- });
-};
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedSelector.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createSelectorScopeMap.ts
similarity index 58%
rename from packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedSelector.ts
rename to packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createSelectorScopeMap.ts
index 53e9ca6723a..5f8db8343eb 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createScopedSelector.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createSelectorScopeMap.ts
@@ -7,7 +7,7 @@ import {
WrappedValue,
} from 'recoil';
-import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
type SelectorGetter<T, P> = (
param: P,
@@ -16,14 +16,14 @@ type SelectorGetter<T, P> = (
getCallback: GetCallback;
}) => Promise<T> | RecoilValue<T> | Loadable<T> | WrappedValue<T> | T;
-export const createScopedSelector = <ValueType>({
+export const createSelectorScopeMap = <ValueType>({
key,
get,
}: {
key: string;
- get: SelectorGetter<ValueType, ScopedStateKey>;
+ get: SelectorGetter<ValueType, StateScopeMapKey>;
}) => {
- return selectorFamily<ValueType, ScopedStateKey>({
+ return selectorFamily<ValueType, StateScopeMapKey>({
key,
get,
});
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createStateScopeMap.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createStateScopeMap.ts
new file mode 100644
index 00000000000..58efdf2ec08
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/createStateScopeMap.ts
@@ -0,0 +1,16 @@
+import { atomFamily } from 'recoil';
+
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
+
+export const createStateScopeMap = <ValueType>({
+ key,
+ defaultValue,
+}: {
+ key: string;
+ defaultValue: ValueType;
+}) => {
+ return atomFamily<ValueType, StateScopeMapKey>({
+ key,
+ default: defaultValue,
+ });
+};
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getFamilyScopeInjector.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getFamilyScopeInjector.ts
index dc328ddc7a4..ffde95aa1f9 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getFamilyScopeInjector.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getFamilyScopeInjector.ts
@@ -1,6 +1,6 @@
import { RecoilState, SerializableParam } from 'recoil';
-import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
+import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
export type FamilyScopeInjector<
StateType,
@@ -12,7 +12,7 @@ export const getFamilyScopeInjector = <
FamilyKey extends SerializableParam,
>(
scopedFamilyState: (
- scopedFamilyKey: ScopedFamilyStateKey<FamilyKey>,
+ scopedFamilyKey: FamilyStateScopeMapKey<FamilyKey>,
) => RecoilState<StateType>,
) => {
return (scopeId: string, familyKey: FamilyKey) =>
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getFamilyState.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getFamilyState.ts
new file mode 100644
index 00000000000..932920bab57
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getFamilyState.ts
@@ -0,0 +1,16 @@
+import { RecoilState, SerializableParam } from 'recoil';
+
+import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
+
+export const getFamilyState = <StateType, FamilyKey extends SerializableParam>(
+ familyStateScopeMap: (
+ scopedFamilyKey: FamilyStateScopeMapKey<FamilyKey>,
+ ) => RecoilState<StateType>,
+ scopeId: string,
+) => {
+ return (familyKey: FamilyKey) =>
+ familyStateScopeMap({
+ scopeId,
+ familyKey: familyKey || ('' as FamilyKey),
+ });
+};
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getScopedFamilyStateDeprecated.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getScopedFamilyStateDeprecated.ts
index b95fbe01c73..771d61a1cb0 100644
--- a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getScopedFamilyStateDeprecated.ts
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getScopedFamilyStateDeprecated.ts
@@ -1,13 +1,13 @@
import { RecoilState, SerializableParam } from 'recoil';
-import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
+import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
export const getScopedFamilyStateDeprecated = <
StateType,
FamilyKey extends SerializableParam,
>(
recoilState: (
- scopedFamilyKey: ScopedFamilyStateKey<FamilyKey>,
+ scopedFamilyKey: FamilyStateScopeMapKey<FamilyKey>,
) => RecoilState<StateType>,
scopeId: string,
familyKey: FamilyKey,
diff --git a/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getState.ts b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getState.ts
new file mode 100644
index 00000000000..60717e2d81c
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/utilities/recoil-scope/utils/getState.ts
@@ -0,0 +1,10 @@
+import { RecoilState } from 'recoil';
+
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
+
+export const getState = <StateType>(
+ stateScopeMap: (stateScopeMapKey: StateScopeMapKey) => RecoilState<StateType>,
+ scopeId: string,
+) => {
+ return stateScopeMap({ scopeId });
+};
diff --git a/packages/twenty-front/src/modules/views/scopes/scope-internal-context/ViewScopeInternalContext.ts b/packages/twenty-front/src/modules/views/scopes/scope-internal-context/ViewScopeInternalContext.ts
index 18824dc9938..39dcf968432 100644
--- a/packages/twenty-front/src/modules/views/scopes/scope-internal-context/ViewScopeInternalContext.ts
+++ b/packages/twenty-front/src/modules/views/scopes/scope-internal-context/ViewScopeInternalContext.ts
@@ -1,7 +1,7 @@
-import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
+import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
-type ViewScopeInternalContextProps = ScopedStateKey;
+type ViewScopeInternalContextProps = StateScopeMapKey;
export const ViewScopeInternalContext =
createScopeInternalContext<ViewScopeInternalContextProps>();
diff --git a/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsScopedState.ts b/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsScopedState.ts
index d488fdbbe26..c91b8bb8272 100644
--- a/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/availableFieldDefinitionsScopedState.ts
@@ -1,8 +1,8 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const availableFieldDefinitionsScopedState = createScopedState<
+export const availableFieldDefinitionsScopedState = createStateScopeMap<
ColumnDefinition<FieldMetadata>[]
>({
key: 'availableFieldDefinitionsScopedState',
diff --git a/packages/twenty-front/src/modules/views/states/availableFilterDefinitionsScopedState.ts b/packages/twenty-front/src/modules/views/states/availableFilterDefinitionsScopedState.ts
index 17d0cd61664..4ed3c9ce777 100644
--- a/packages/twenty-front/src/modules/views/states/availableFilterDefinitionsScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/availableFilterDefinitionsScopedState.ts
@@ -1,7 +1,7 @@
import { FilterDefinition } from '@/object-record/object-filter-dropdown/types/FilterDefinition';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const availableFilterDefinitionsScopedState = createScopedState<
+export const availableFilterDefinitionsScopedState = createStateScopeMap<
FilterDefinition[]
>({
key: 'availableFilterDefinitionsScopedState',
diff --git a/packages/twenty-front/src/modules/views/states/availableSortDefinitionsScopedState.ts b/packages/twenty-front/src/modules/views/states/availableSortDefinitionsScopedState.ts
index f61eda447b9..43912ec2429 100644
--- a/packages/twenty-front/src/modules/views/states/availableSortDefinitionsScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/availableSortDefinitionsScopedState.ts
@@ -1,7 +1,7 @@
import { SortDefinition } from '@/object-record/object-sort-dropdown/types/SortDefinition';
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const availableSortDefinitionsScopedState = createScopedState<
+export const availableSortDefinitionsScopedState = createStateScopeMap<
SortDefinition[]
>({
key: 'availableSortDefinitionsScopedState',
diff --git a/packages/twenty-front/src/modules/views/states/currentViewFieldsScopedFamilyState.ts b/packages/twenty-front/src/modules/views/states/currentViewFieldsScopedFamilyState.ts
index fbc327b4d53..4c071e69bea 100644
--- a/packages/twenty-front/src/modules/views/states/currentViewFieldsScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/views/states/currentViewFieldsScopedFamilyState.ts
@@ -1,8 +1,8 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { ViewField } from '../types/ViewField';
-export const currentViewFieldsScopedFamilyState = createScopedFamilyState<
+export const currentViewFieldsScopedFamilyState = createFamilyStateScopeMap<
ViewField[],
string
>({
diff --git a/packages/twenty-front/src/modules/views/states/currentViewFiltersScopedFamilyState.ts b/packages/twenty-front/src/modules/views/states/currentViewFiltersScopedFamilyState.ts
index 41a8eb9e0ca..fa807a56ddc 100644
--- a/packages/twenty-front/src/modules/views/states/currentViewFiltersScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/views/states/currentViewFiltersScopedFamilyState.ts
@@ -1,8 +1,8 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { ViewFilter } from '../types/ViewFilter';
-export const currentViewFiltersScopedFamilyState = createScopedFamilyState<
+export const currentViewFiltersScopedFamilyState = createFamilyStateScopeMap<
ViewFilter[],
string
>({
diff --git a/packages/twenty-front/src/modules/views/states/currentViewIdScopedState.ts b/packages/twenty-front/src/modules/views/states/currentViewIdScopedState.ts
index 748d3c04c87..98a46cbbd3f 100644
--- a/packages/twenty-front/src/modules/views/states/currentViewIdScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/currentViewIdScopedState.ts
@@ -1,6 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const currentViewIdScopedState = createScopedState<string | undefined>({
- key: 'currentViewIdScopedState',
- defaultValue: undefined,
-});
+export const currentViewIdScopedState = createStateScopeMap<string | undefined>(
+ {
+ key: 'currentViewIdScopedState',
+ defaultValue: undefined,
+ },
+);
diff --git a/packages/twenty-front/src/modules/views/states/currentViewSortsScopedFamilyState.ts b/packages/twenty-front/src/modules/views/states/currentViewSortsScopedFamilyState.ts
index d4cedc66c8b..f12bd262636 100644
--- a/packages/twenty-front/src/modules/views/states/currentViewSortsScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/views/states/currentViewSortsScopedFamilyState.ts
@@ -1,8 +1,8 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { ViewSort } from '../types/ViewSort';
-export const currentViewSortsScopedFamilyState = createScopedFamilyState<
+export const currentViewSortsScopedFamilyState = createFamilyStateScopeMap<
ViewSort[],
string
>({
diff --git a/packages/twenty-front/src/modules/views/states/entityCountInCurrentViewScopedState.ts b/packages/twenty-front/src/modules/views/states/entityCountInCurrentViewScopedState.ts
index 837cac87bd2..6bea66a6d0d 100644
--- a/packages/twenty-front/src/modules/views/states/entityCountInCurrentViewScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/entityCountInCurrentViewScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const entityCountInCurrentViewScopedState = createScopedState<number>({
+export const entityCountInCurrentViewScopedState = createStateScopeMap<number>({
key: 'entityCountInCurrentViewScopedState',
defaultValue: 0,
});
diff --git a/packages/twenty-front/src/modules/views/states/isPersistingViewScopedState.ts b/packages/twenty-front/src/modules/views/states/isPersistingViewScopedState.ts
index aadf01e8f0a..24b11da0ce2 100644
--- a/packages/twenty-front/src/modules/views/states/isPersistingViewScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/isPersistingViewScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const isPersistingViewScopedState = createScopedState<boolean>({
+export const isPersistingViewScopedState = createStateScopeMap<boolean>({
key: 'isPersistingViewScopedState',
defaultValue: false,
});
diff --git a/packages/twenty-front/src/modules/views/states/isViewBarExpandedScopedState.ts b/packages/twenty-front/src/modules/views/states/isViewBarExpandedScopedState.ts
index c51fd165c93..acd1a312ea1 100644
--- a/packages/twenty-front/src/modules/views/states/isViewBarExpandedScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/isViewBarExpandedScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const isViewBarExpandedScopedState = createScopedState<boolean>({
+export const isViewBarExpandedScopedState = createStateScopeMap<boolean>({
key: 'isViewBarExpandedScopedState',
defaultValue: true,
});
diff --git a/packages/twenty-front/src/modules/views/states/noneScopedFamilyState.ts b/packages/twenty-front/src/modules/views/states/noneScopedFamilyState.ts
index feeacd2147a..0c318836ddb 100644
--- a/packages/twenty-front/src/modules/views/states/noneScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/views/states/noneScopedFamilyState.ts
@@ -1,6 +1,6 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
-export const noneScopedFamilyState = createScopedFamilyState<any, string>({
+export const noneScopedFamilyState = createFamilyStateScopeMap<any, string>({
key: 'noneScopedFamilyState',
defaultValue: null,
});
diff --git a/packages/twenty-front/src/modules/views/states/onViewFieldsChangeScopedState.ts b/packages/twenty-front/src/modules/views/states/onViewFieldsChangeScopedState.ts
index cd2e1183238..baed107d650 100644
--- a/packages/twenty-front/src/modules/views/states/onViewFieldsChangeScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/onViewFieldsChangeScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ViewField } from '../types/ViewField';
-export const onViewFieldsChangeScopedState = createScopedState<
+export const onViewFieldsChangeScopedState = createStateScopeMap<
((fields: ViewField[]) => void | Promise<void>) | undefined
>({
key: 'onViewFieldsChangeScopedState',
diff --git a/packages/twenty-front/src/modules/views/states/onViewFiltersChangeScopedState.ts b/packages/twenty-front/src/modules/views/states/onViewFiltersChangeScopedState.ts
index 0d4b30ab0a1..a2abce59f20 100644
--- a/packages/twenty-front/src/modules/views/states/onViewFiltersChangeScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/onViewFiltersChangeScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ViewFilter } from '@/views/types/ViewFilter';
-export const onViewFiltersChangeScopedState = createScopedState<
+export const onViewFiltersChangeScopedState = createStateScopeMap<
((filters: ViewFilter[]) => void | Promise<void>) | undefined
>({
key: 'onViewFiltersChangeScopedState',
diff --git a/packages/twenty-front/src/modules/views/states/onViewSortsChangeScopedState.ts b/packages/twenty-front/src/modules/views/states/onViewSortsChangeScopedState.ts
index a76a2da1a76..d72a0dfa98b 100644
--- a/packages/twenty-front/src/modules/views/states/onViewSortsChangeScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/onViewSortsChangeScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ViewSort } from '@/views/types/ViewSort';
-export const onViewSortsChangeScopedState = createScopedState<
+export const onViewSortsChangeScopedState = createStateScopeMap<
((sorts: ViewSort[]) => void | Promise<void>) | undefined
>({
key: 'onViewSortsChangeScopedState',
diff --git a/packages/twenty-front/src/modules/views/states/savedViewFieldsScopedFamilyState.ts b/packages/twenty-front/src/modules/views/states/savedViewFieldsScopedFamilyState.ts
index 130a812c5f9..1610e5d6bc7 100644
--- a/packages/twenty-front/src/modules/views/states/savedViewFieldsScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/views/states/savedViewFieldsScopedFamilyState.ts
@@ -1,8 +1,8 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { ViewField } from '../types/ViewField';
-export const savedViewFieldsScopedFamilyState = createScopedFamilyState<
+export const savedViewFieldsScopedFamilyState = createFamilyStateScopeMap<
ViewField[],
string
>({
diff --git a/packages/twenty-front/src/modules/views/states/savedViewFiltersScopedFamilyState.ts b/packages/twenty-front/src/modules/views/states/savedViewFiltersScopedFamilyState.ts
index 96b0cac6737..06a49096b78 100644
--- a/packages/twenty-front/src/modules/views/states/savedViewFiltersScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/views/states/savedViewFiltersScopedFamilyState.ts
@@ -1,8 +1,8 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { ViewFilter } from '../types/ViewFilter';
-export const savedViewFiltersScopedFamilyState = createScopedFamilyState<
+export const savedViewFiltersScopedFamilyState = createFamilyStateScopeMap<
ViewFilter[],
string
>({
diff --git a/packages/twenty-front/src/modules/views/states/savedViewSortsScopedFamilyState.ts b/packages/twenty-front/src/modules/views/states/savedViewSortsScopedFamilyState.ts
index 14316cc7ca6..ea0a9811d0c 100644
--- a/packages/twenty-front/src/modules/views/states/savedViewSortsScopedFamilyState.ts
+++ b/packages/twenty-front/src/modules/views/states/savedViewSortsScopedFamilyState.ts
@@ -1,8 +1,8 @@
-import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
+import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { ViewSort } from '../types/ViewSort';
-export const savedViewSortsScopedFamilyState = createScopedFamilyState<
+export const savedViewSortsScopedFamilyState = createFamilyStateScopeMap<
ViewSort[],
string
>({
diff --git a/packages/twenty-front/src/modules/views/states/selectors/currentViewScopedSelector.ts b/packages/twenty-front/src/modules/views/states/selectors/currentViewScopedSelector.ts
index fbecda59709..a40f831258b 100644
--- a/packages/twenty-front/src/modules/views/states/selectors/currentViewScopedSelector.ts
+++ b/packages/twenty-front/src/modules/views/states/selectors/currentViewScopedSelector.ts
@@ -1,11 +1,11 @@
-import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
+import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { GraphQLView } from '@/views/types/GraphQLView';
import { currentViewIdScopedState } from '../currentViewIdScopedState';
import { viewsByIdScopedSelector } from './viewsByIdScopedSelector';
-export const currentViewScopedSelector = createScopedSelector<
+export const currentViewScopedSelector = createSelectorScopeMap<
GraphQLView | undefined
>({
key: 'currentViewScopedSelector',
diff --git a/packages/twenty-front/src/modules/views/states/viewEditModeScopedState.ts b/packages/twenty-front/src/modules/views/states/viewEditModeScopedState.ts
index 3a3ba3abc7b..5234afb9694 100644
--- a/packages/twenty-front/src/modules/views/states/viewEditModeScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/viewEditModeScopedState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const viewEditModeScopedState = createScopedState<
+export const viewEditModeScopedState = createStateScopeMap<
'none' | 'edit' | 'create'
>({
key: 'viewEditModeScopedState',
diff --git a/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdScopeState.ts b/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdScopeState.ts
index c39aece365f..a67bc387d68 100644
--- a/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdScopeState.ts
+++ b/packages/twenty-front/src/modules/views/states/viewObjectMetadataIdScopeState.ts
@@ -1,6 +1,6 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
-export const viewObjectMetadataIdScopeState = createScopedState<
+export const viewObjectMetadataIdScopeState = createStateScopeMap<
string | undefined
>({
key: 'viewObjectMetadataIdScopeState',
diff --git a/packages/twenty-front/src/modules/views/states/viewTypeScopedState.ts b/packages/twenty-front/src/modules/views/states/viewTypeScopedState.ts
index 312b6112e90..2424bc19ce0 100644
--- a/packages/twenty-front/src/modules/views/states/viewTypeScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/viewTypeScopedState.ts
@@ -1,8 +1,8 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ViewType } from '../types/ViewType';
-export const viewTypeScopedState = createScopedState<ViewType>({
+export const viewTypeScopedState = createStateScopeMap<ViewType>({
key: 'viewTypeScopedState',
defaultValue: ViewType.Table,
});
diff --git a/packages/twenty-front/src/modules/views/states/viewsScopedState.ts b/packages/twenty-front/src/modules/views/states/viewsScopedState.ts
index 3f141877b19..23c2c29b062 100644
--- a/packages/twenty-front/src/modules/views/states/viewsScopedState.ts
+++ b/packages/twenty-front/src/modules/views/states/viewsScopedState.ts
@@ -1,7 +1,7 @@
-import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
+import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { GraphQLView } from '@/views/types/GraphQLView';
-export const viewsScopedState = createScopedState<GraphQLView[]>({
+export const viewsScopedState = createStateScopeMap<GraphQLView[]>({
key: 'viewsScopedState',
defaultValue: [],
});
diff --git a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmailsInboxSettings.tsx b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmailsInboxSettings.tsx
index 93570ecf12a..b3138a9d28a 100644
--- a/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmailsInboxSettings.tsx
+++ b/packages/twenty-front/src/pages/settings/accounts/SettingsAccountsEmailsInboxSettings.tsx
@@ -17,9 +17,7 @@ import { mockedAccounts } from '~/testing/mock-data/accounts';
export const SettingsAccountsEmailsInboxSettings = () => {
const navigate = useNavigate();
const { accountUuid = '' } = useParams();
- const account = mockedAccounts.find(
- (account) => account.uuid === accountUuid,
- );
+ const account = mockedAccounts.find((account) => account.id === accountUuid);
useEffect(() => {
if (!account) navigate(AppPath.NotFound);
@@ -40,7 +38,7 @@ export const SettingsAccountsEmailsInboxSettings = () => {
links={[
{ children: 'Accounts', href: '/settings/accounts' },
{ children: 'Emails', href: '/settings/accounts/emails' },
- { children: account?.email || '' },
+ { children: account?.handle || '' },
]}
/>
<SettingsAccountsInboxSettingsSynchronizationSection
diff --git a/packages/twenty-front/src/testing/mock-data/accounts.ts b/packages/twenty-front/src/testing/mock-data/accounts.ts
index 9cc48eb1753..b9526089f6f 100644
--- a/packages/twenty-front/src/testing/mock-data/accounts.ts
+++ b/packages/twenty-front/src/testing/mock-data/accounts.ts
@@ -4,17 +4,17 @@ import { InboxSettingsVisibilityValue } from '@/settings/accounts/components/Set
export const mockedAccounts: Account[] = [
{
- email: '[email protected]',
+ handle: '[email protected]',
isSynced: true,
isContactAutoCreationEnabled: true,
- uuid: '0794b782-f52e-48c3-977e-b0f57f90de24',
+ id: '0794b782-f52e-48c3-977e-b0f57f90de24',
visibility: InboxSettingsVisibilityValue.Everything,
},
{
- email: '[email protected]',
+ handle: '[email protected]',
isSynced: false,
isContactAutoCreationEnabled: true,
- uuid: 'dc66a7ec-56b2-425b-a8e8-26ff0396c3aa',
+ id: 'dc66a7ec-56b2-425b-a8e8-26ff0396c3aa',
visibility: InboxSettingsVisibilityValue.Metadata,
},
];
diff --git a/packages/twenty-front/tsconfig.app.json b/packages/twenty-front/tsconfig.app.json
index 4b6b7d6c532..98eac967ee9 100644
--- a/packages/twenty-front/tsconfig.app.json
+++ b/packages/twenty-front/tsconfig.app.json
@@ -8,7 +8,8 @@
"**/*.test.ts",
"**/*.spec.tsx",
"**/*.test.tsx",
- "jest.config.ts"
+ "jest.config.ts",
+ "tsup.config.ts"
],
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
}