From f09ed728e94d3b43bf078518748b111f04fc08c4 Mon Sep 17 00:00:00 2001 From: Siarhei Karol Date: Fri, 29 Nov 2024 15:16:33 +0300 Subject: [PATCH] selectors refactoring --- src/common/hooks/useProfileSchema.ts | 2 +- src/components/CommonStatus/CommonStatus.tsx | 2 +- src/store/index.ts | 2 ++ src/test/__mocks__/setupMocks.ts | 1 + src/test/__mocks__/store/index.ts | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/test/__mocks__/store/index.ts diff --git a/src/common/hooks/useProfileSchema.ts b/src/common/hooks/useProfileSchema.ts index a2157c9b..a31c5141 100644 --- a/src/common/hooks/useProfileSchema.ts +++ b/src/common/hooks/useProfileSchema.ts @@ -9,8 +9,8 @@ export const useProfileSchema = () => { const [schema, setSchema] = useRecoilState(state.config.schema); const setSelectedEntries = useSetRecoilState(state.config.selectedEntries); const setCollapsibleEntries = useSetRecoilState(state.ui.collapsibleEntries); - const { setIsEditedRecord: setIsEdited } = useStatusStore(); const setUserValues = useSetRecoilState(state.inputs.userValues); + const { setIsEditedRecord: setIsEdited } = useStatusStore(); const getSchemaWithCopiedEntries = (entry: SchemaEntry, selectedEntries: string[]) => { selectedEntriesService.set(selectedEntries); diff --git a/src/components/CommonStatus/CommonStatus.tsx b/src/components/CommonStatus/CommonStatus.tsx index 22ac7a7e..8ca0d2b8 100644 --- a/src/components/CommonStatus/CommonStatus.tsx +++ b/src/components/CommonStatus/CommonStatus.tsx @@ -3,12 +3,12 @@ import classNames from 'classnames'; import { FormattedMessage } from 'react-intl'; import { StatusType } from '@common/constants/status.constants'; import { Button, ButtonType } from '@components/Button'; +import { useStatusStore } from '@src/store'; import CloseIcon from '@src/assets/times-16.svg?react'; import CheckCircleIcon from '@src/assets/check-circle.svg?react'; import WarningIcon from '@src/assets/exclamation-triangle.svg?react'; import ErrorIcon from '@src/assets/exclamation-circle.svg?react'; import './CommonStatus.scss'; -import { useStatusStore } from '@src/store'; const DELETE_TIMEOUT = 10000; diff --git a/src/store/index.ts b/src/store/index.ts index 8c9698fe..8723169d 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1 +1,3 @@ +export * from './status'; +export * from './marcPreview'; export * from './selectors'; diff --git a/src/test/__mocks__/setupMocks.ts b/src/test/__mocks__/setupMocks.ts index 22757a4a..6751a01c 100644 --- a/src/test/__mocks__/setupMocks.ts +++ b/src/test/__mocks__/setupMocks.ts @@ -1,3 +1,4 @@ import './common/helpers/env.helper.mock'; import './lib/intl.mock'; import './lib/window.mock'; +import './store'; diff --git a/src/test/__mocks__/store/index.ts b/src/test/__mocks__/store/index.ts new file mode 100644 index 00000000..16ac7f56 --- /dev/null +++ b/src/test/__mocks__/store/index.ts @@ -0,0 +1 @@ +jest.mock('@src/store'); \ No newline at end of file