@@ -10,6 +10,8 @@ import {schemaApi} from '../../../../store/reducers/schema/schema';
1010import type { GetTableSchemaDataParams } from '../../../../store/reducers/tableSchemaData' ;
1111import { useGetTableSchemaDataMutation } from '../../../../store/reducers/tableSchemaData' ;
1212import type { EPathType , TEvDescribeSchemeResult } from '../../../../types/api/schema' ;
13+ import { wait } from '../../../../utils' ;
14+ import { SECOND_IN_MS } from '../../../../utils/constants' ;
1315import { useQueryExecutionSettings , useTypedDispatch } from '../../../../utils/hooks' ;
1416import { getSchemaControls } from '../../utils/controls' ;
1517import { isChildlessPathType , mapPathTypeToNavigationTreeType } from '../../utils/schema' ;
@@ -24,6 +26,8 @@ interface SchemaTreeProps {
2426 onActivePathUpdate : ( path : string ) => void ;
2527}
2628
29+ const TABLE_SCHEMA_TIMEOUT = SECOND_IN_MS * 2 ;
30+
2731export function SchemaTree ( props : SchemaTreeProps ) {
2832 const createDirectoryFeatureAvailable = useCreateDirectoryFeatureAvailable ( ) ;
2933 const { rootPath, rootName, rootType, currentPath, onActivePathUpdate} = props ;
@@ -33,7 +37,10 @@ export function SchemaTree(props: SchemaTreeProps) {
3337 const getTableSchemaDataPromise = React . useCallback (
3438 async ( args : GetTableSchemaDataParams ) => {
3539 try {
36- const result = await getTableSchemaDataMutation ( args ) . unwrap ( ) ;
40+ const result = await Promise . race ( [
41+ getTableSchemaDataMutation ( args ) . unwrap ( ) ,
42+ wait < undefined > ( TABLE_SCHEMA_TIMEOUT ) ,
43+ ] ) ;
3744 return result ;
3845 } catch ( e ) {
3946 return undefined ;
0 commit comments