@@ -13,7 +13,6 @@ import { ILoadableState, isContainsException, useMapResource, useObservableRef }
1313import { ConnectionInfoResource } from '@cloudbeaver/core-connections' ;
1414import { useService } from '@cloudbeaver/core-di' ;
1515import { NavNodeManagerService } from '@cloudbeaver/core-navigation-tree' ;
16- import { CachedMapAllKey } from '@cloudbeaver/core-sdk' ;
1716import type { ITab } from '@cloudbeaver/plugin-navigation-tabs' ;
1817import type { IObjectViewerTabState } from '@cloudbeaver/plugin-object-viewer' ;
1918
@@ -38,26 +37,30 @@ export function useDataViewerDatabaseDataModel(tab: ITab<IObjectViewerTabState>)
3837 const dataPresentationService = useService ( DataPresentationService ) ;
3938 const dataViewerDataChangeConfirmationService = useService ( DataViewerDataChangeConfirmationService ) ;
4039
41- const connections = useMapResource ( useDataViewerDatabaseDataModel , connectionInfoResource , CachedMapAllKey ) ;
40+ const connection = useMapResource (
41+ useDataViewerDatabaseDataModel ,
42+ ConnectionInfoResource ,
43+ tab . handlerState . connectionKey ?? null
44+ ) ;
4245
4346 const state = useObservableRef < IDataViewerDatabaseDataModel > ( ( ) => ( {
4447 _exception : null ,
4548 _loading : false ,
4649 get exception ( ) {
47- if ( isContainsException ( connections . exception ) ) {
48- return connections . exception ;
50+ if ( isContainsException ( connection . exception ) ) {
51+ return connection . exception ;
4952 }
5053 return this . _exception ;
5154 } ,
5255 isLoading ( ) : boolean {
53- return connections . isLoading ( ) || this . _loading ;
56+ return connection . isLoading ( ) || this . _loading ;
5457 } ,
5558 isLoaded ( ) : boolean {
56- return connections . isLoaded ( ) && dataViewerTableService . get ( this . tab . handlerState . tableId || '' ) !== undefined ;
59+ return connection . isLoaded ( ) && dataViewerTableService . get ( this . tab . handlerState . tableId || '' ) !== undefined ;
5760 } ,
5861 async reload ( ) {
59- if ( isContainsException ( connections . exception ) ) {
60- connections . reload ?.( ) ;
62+ if ( isContainsException ( connection . exception ) ) {
63+ connection . reload ?.( ) ;
6164 }
6265 this . init ( ) ;
6366 } ,
0 commit comments