@@ -3,10 +3,10 @@ import {useDispatch} from 'react-redux';
33
44import { NavigationTree } from 'ydb-ui-components' ;
55
6- import { setCurrentSchemaPath , getSchema , preloadSchema } from '../../../../store/reducers/schema' ;
6+ import { setCurrentSchemaPath , getSchema , preloadSchemas } from '../../../../store/reducers/schema' ;
77import { getDescribe } from '../../../../store/reducers/describe' ;
88import { getSchemaAcl } from '../../../../store/reducers/schemaAcl' ;
9- import type { EPathType } from '../../../../types/api/schema' ;
9+ import type { EPathType , TEvDescribeSchemeResult } from '../../../../types/api/schema' ;
1010
1111import { mapPathTypeToNavigationTreeType } from '../../utils/schema' ;
1212import { getActions } from '../../utils/schemaActions' ;
@@ -29,15 +29,15 @@ export function SchemaTree(props: SchemaTreeProps) {
2929 . then ( ( data ) => {
3030 const { PathDescription : { Children = [ ] } = { } } = data ;
3131
32- dispatch ( preloadSchema ( path , data ) ) ;
32+ const preloadedData : Record < string , TEvDescribeSchemeResult > = {
33+ [ path ] : data
34+ } ;
3335
34- return Children . map ( ( childData ) => {
36+ const childItems = Children . map ( ( childData ) => {
3537 const { Name = '' , PathType, PathSubType} = childData ;
3638
3739 // 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 } } ;
4141
4242 return {
4343 name : Name ,
@@ -47,6 +47,10 @@ export function SchemaTree(props: SchemaTreeProps) {
4747 expandable : true ,
4848 } ;
4949 } ) ;
50+
51+ dispatch ( preloadSchemas ( preloadedData ) ) ;
52+
53+ return childItems ;
5054 } ) ;
5155
5256 const handleActivePathUpdate = ( activePath : string ) => {
0 commit comments