Refactor recoil v4 (#3266)

* Refactor recoil v4

* Fix ci
This commit is contained in:
Charles Bochet
2024-01-05 19:18:22 +01:00
committed by GitHub
parent 8455e15443
commit 96264e264c
140 changed files with 467 additions and 482 deletions

View File

@ -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}>

View File

@ -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>();

View File

@ -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,
});

View File

@ -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',

View File

@ -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: '',
});

View File

@ -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,
});