@@ -5,9 +5,10 @@ import {shallowEqual} from 'react-redux';
55
66import { ResponseError } from '../../../../components/Errors/ResponseError' ;
77import { Loader } from '../../../../components/Loader' ;
8- import { describeApi } from '../../../../store/reducers/describe ' ;
8+ import { overviewApi } from '../../../../store/reducers/overview/overview ' ;
99import { selectSchemaMergedChildrenPaths } from '../../../../store/reducers/schema/schema' ;
1010import type { EPathType } from '../../../../types/api/schema' ;
11+ import type { IDescribeData } from '../../../../types/store/describe' ;
1112import { cn } from '../../../../utils/cn' ;
1213import { useAutoRefreshInterval , useTypedSelector } from '../../../../utils/hooks' ;
1314import { isEntityWithMergedImplementation } from '../../utils/schema' ;
@@ -25,6 +26,8 @@ interface IDescribeProps {
2526 type ?: EPathType ;
2627}
2728
29+ const emptyObject : IDescribeData = { } ;
30+
2831const Describe = ( { path, database, type} : IDescribeProps ) => {
2932 const [ autoRefreshInterval ] = useAutoRefreshInterval ( ) ;
3033
@@ -41,14 +44,29 @@ const Describe = ({path, database, type}: IDescribeProps) => {
4144 } else if ( mergedChildrenPaths ) {
4245 paths = [ path , ...mergedChildrenPaths ] ;
4346 }
44- const { currentData, isFetching, error} = describeApi . useGetDescribeQuery (
47+ const { currentDescribe , currentData, isFetching, error} = overviewApi . useGetOverviewQuery (
4548 paths . length ? { paths, database} : skipToken ,
4649 {
4750 pollingInterval : autoRefreshInterval ,
51+ selectFromResult : ( props ) => {
52+ const { currentData} = props ;
53+ if ( ! currentData ) {
54+ return { currentDescribe : emptyObject , ...props } ;
55+ }
56+
57+ const mergedData = [ currentData . data , ...currentData . additionalData ] ;
58+
59+ const data = mergedData . reduce < IDescribeData > ( ( acc , item ) => {
60+ if ( item ?. Path ) {
61+ acc [ item . Path ] = item ;
62+ }
63+ return acc ;
64+ } , { } ) ;
65+ return { currentDescribe : data , ...props } ;
66+ } ,
4867 } ,
4968 ) ;
5069 const loading = isFetching && currentData === undefined ;
51- const currentDescribe = currentData ;
5270
5371 let preparedDescribeData : Object | undefined ;
5472 if ( currentDescribe ) {
0 commit comments