diff --git a/src/hooks/useExtendedComponentMap.ts b/src/hooks/useExtendedComponentMap.ts index 5b6becaf..71628ce7 100644 --- a/src/hooks/useExtendedComponentMap.ts +++ b/src/hooks/useExtendedComponentMap.ts @@ -1,22 +1,15 @@ import {useMemo} from 'react'; -import {CustomConfig} from '@gravity-ui/page-constructor'; +import {CustomConfig, getCustomItems} from '@gravity-ui/page-constructor'; import componentMap from '../constructor/blocksMap'; export const useExtendedComponentMap = (custom: CustomConfig | undefined) => useMemo( - () => - custom - ? { - ...custom, - blocks: custom.blocks - ? {...componentMap.blocks, ...custom.blocks} - : componentMap.blocks, - headers: custom.headers - ? {...componentMap.headers, ...custom.headers} - : componentMap.headers, - } - : componentMap, + () => ({ + ...custom, + blocks: {...componentMap.blocks, ...getCustomItems(['blocks'], custom)}, + headers: {...componentMap.headers, ...getCustomItems(['headers'], custom)}, + }), [custom], );