Refactor recoil scope states (#3097)
* Refactor recoil scope states * Complete refactoring * Fix
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { EntityForSelect } from '@/object-record/relation-picker/types/EntityForSelect';
|
||||
import { SelectableItem } from '@/ui/layout/selectable-list/components/SelectableItem';
|
||||
@ -21,10 +22,13 @@ export const SelectableMenuItemSelect = ({
|
||||
onEntitySelected,
|
||||
selectedEntity,
|
||||
}: SelectableMenuItemSelectProps) => {
|
||||
const { isSelectedItemId } = useSelectableList({
|
||||
selectableListId: 'single-entity-select-base-list',
|
||||
itemId: entity.id,
|
||||
});
|
||||
const { isSelectedItemIdFamilyState } = useSelectableList(
|
||||
'single-entity-select-base-list',
|
||||
);
|
||||
|
||||
const isSelectedItemId = useRecoilValue(
|
||||
isSelectedItemIdFamilyState(entity.id),
|
||||
);
|
||||
|
||||
return (
|
||||
<StyledSelectableItem itemId={entity.id} key={entity.id}>
|
||||
|
||||
@ -2,29 +2,29 @@ import { identifiersMapperScopedState } from '@/object-record/relation-picker/st
|
||||
import { relationPickerPreselectedIdScopedState } from '@/object-record/relation-picker/states/relationPickerPreselectedIdScopedState';
|
||||
import { relationPickerSearchFilterScopedState } from '@/object-record/relation-picker/states/relationPickerSearchFilterScopedState';
|
||||
import { searchQueryScopedState } from '@/object-record/relation-picker/states/searchQueryScopedState';
|
||||
import { getScopedState } from '@/ui/utilities/recoil-scope/utils/getScopedState';
|
||||
import { getScopedStateDeprecated } from '@/ui/utilities/recoil-scope/utils/getScopedStateDeprecated';
|
||||
|
||||
export const getRelationPickerScopedStates = ({
|
||||
relationPickerScopeId,
|
||||
}: {
|
||||
relationPickerScopeId: string;
|
||||
}) => {
|
||||
const identifiersMapperState = getScopedState(
|
||||
const identifiersMapperState = getScopedStateDeprecated(
|
||||
identifiersMapperScopedState,
|
||||
relationPickerScopeId,
|
||||
);
|
||||
|
||||
const searchQueryState = getScopedState(
|
||||
const searchQueryState = getScopedStateDeprecated(
|
||||
searchQueryScopedState,
|
||||
relationPickerScopeId,
|
||||
);
|
||||
|
||||
const relationPickerPreselectedIdState = getScopedState(
|
||||
const relationPickerPreselectedIdState = getScopedStateDeprecated(
|
||||
relationPickerPreselectedIdScopedState,
|
||||
relationPickerScopeId,
|
||||
);
|
||||
|
||||
const relationPickerSearchFilterState = getScopedState(
|
||||
const relationPickerSearchFilterState = getScopedStateDeprecated(
|
||||
relationPickerSearchFilterScopedState,
|
||||
relationPickerScopeId,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user