@@ -3,10 +3,10 @@ import {useDispatch} from 'react-redux';
3
3
4
4
import { NavigationTree } from 'ydb-ui-components' ;
5
5
6
- import { setCurrentSchemaPath , getSchema , preloadSchema } from '../../../../store/reducers/schema' ;
6
+ import { setCurrentSchemaPath , getSchema , preloadSchemas } from '../../../../store/reducers/schema' ;
7
7
import { getDescribe } from '../../../../store/reducers/describe' ;
8
8
import { getSchemaAcl } from '../../../../store/reducers/schemaAcl' ;
9
- import type { EPathType } from '../../../../types/api/schema' ;
9
+ import type { EPathType , TEvDescribeSchemeResult } from '../../../../types/api/schema' ;
10
10
11
11
import { mapPathTypeToNavigationTreeType } from '../../utils/schema' ;
12
12
import { getActions } from '../../utils/schemaActions' ;
@@ -29,15 +29,15 @@ export function SchemaTree(props: SchemaTreeProps) {
29
29
. then ( ( data ) => {
30
30
const { PathDescription : { Children = [ ] } = { } } = data ;
31
31
32
- dispatch ( preloadSchema ( path , data ) ) ;
32
+ const preloadedData : Record < string , TEvDescribeSchemeResult > = {
33
+ [ path ] : data
34
+ } ;
33
35
34
- return Children . map ( ( childData ) => {
36
+ const childItems = Children . map ( ( childData ) => {
35
37
const { Name = '' , PathType, PathSubType} = childData ;
36
38
37
39
// not full data, but it contains PathType, which ensures seamless switch between nodes
38
- dispatch (
39
- preloadSchema ( `${ path } /${ Name } ` , { PathDescription : { Self : childData } } ) ,
40
- ) ;
40
+ preloadedData [ `${ path } /${ Name } ` ] = { PathDescription : { Self : childData } } ;
41
41
42
42
return {
43
43
name : Name ,
@@ -47,6 +47,10 @@ export function SchemaTree(props: SchemaTreeProps) {
47
47
expandable : true ,
48
48
} ;
49
49
} ) ;
50
+
51
+ dispatch ( preloadSchemas ( preloadedData ) ) ;
52
+
53
+ return childItems ;
50
54
} ) ;
51
55
52
56
const handleActivePathUpdate = ( activePath : string ) => {
0 commit comments