@@ -2,12 +2,12 @@ import copy from 'copy-to-clipboard';
2
2
import type { NavigationTreeNodeType , NavigationTreeProps } from 'ydb-ui-components' ;
3
3
4
4
import type { AppDispatch } from '../../../store' ;
5
- import { changeUserInput } from '../../../store/reducers/executeQuery' ;
6
5
import type { GetTableSchemaDataParams } from '../../../store/reducers/tableSchemaData' ;
7
6
import { TENANT_PAGES_IDS , TENANT_QUERY_TABS_ID } from '../../../store/reducers/tenant/constants' ;
8
7
import { setQueryTab , setTenantPage } from '../../../store/reducers/tenant/tenant' ;
9
8
import type { QuerySettings } from '../../../types/store/query' ;
10
9
import createToast from '../../../utils/createToast' ;
10
+ import { insertSnippetToEditor } from '../../../utils/monaco/insertSnippet' ;
11
11
import { transformPath } from '../ObjectSummary/transformPath' ;
12
12
import type { SchemaData } from '../Schema/SchemaViewer/types' ;
13
13
import i18n from '../i18n' ;
@@ -75,13 +75,13 @@ const bindActions = (
75
75
} )
76
76
: Promise . resolve ( undefined ) ;
77
77
78
- userInputDataPromise . then ( ( tableData ) => {
79
- dispatch ( changeUserInput ( { input : tmpl ( { ...params , tableData} ) } ) ) ;
80
- } ) ;
81
-
78
+ //order is important here: firstly we should open query tab and initialize editor (it will be set to window.ydbEditor), after that it is possible to insert snippet
82
79
dispatch ( setTenantPage ( TENANT_PAGES_IDS . query ) ) ;
83
80
dispatch ( setQueryTab ( TENANT_QUERY_TABS_ID . newQuery ) ) ;
84
81
setActivePath ( params . path ) ;
82
+ userInputDataPromise . then ( ( tableData ) => {
83
+ insertSnippetToEditor ( tmpl ( { ...params , tableData} ) ) ;
84
+ } ) ;
85
85
} ;
86
86
if ( getConfirmation ) {
87
87
const confirmedPromise = getConfirmation ( ) ;
0 commit comments