diff --git a/src/Explorer/Tabs/MongoQueryTab/MongoQueryTab.tsx b/src/Explorer/Tabs/MongoQueryTab/MongoQueryTab.tsx index cd64b2712..80ce4c4f8 100644 --- a/src/Explorer/Tabs/MongoQueryTab/MongoQueryTab.tsx +++ b/src/Explorer/Tabs/MongoQueryTab/MongoQueryTab.tsx @@ -74,6 +74,7 @@ export class NewMongoQueryTab extends NewQueryTab { public duplicateTab(): void { const id = useTabs.getState().getTabs(ViewModels.CollectionTabKind.Query).length + 1; + const queryText = this.iTabAccessor?.onSaveClickEvent() ?? this.persistedState?.query?.text ?? ""; const newTab = new NewMongoQueryTab( { tabKind: ViewModels.CollectionTabKind.Query, @@ -81,7 +82,7 @@ export class NewMongoQueryTab extends NewQueryTab { tabPath: "", collection: this.collection, node: this.collection, - queryText: this.persistedState?.query?.text ?? "", + queryText, partitionKey: this.partitionKey, splitterDirection: this.persistedState?.splitterDirection, queryViewSizePercent: this.persistedState?.queryViewSizePercent, diff --git a/src/Explorer/Tabs/QueryTab/QueryTab.tsx b/src/Explorer/Tabs/QueryTab/QueryTab.tsx index 2adb8017b..d209cd760 100644 --- a/src/Explorer/Tabs/QueryTab/QueryTab.tsx +++ b/src/Explorer/Tabs/QueryTab/QueryTab.tsx @@ -78,7 +78,7 @@ export class NewQueryTab extends TabsBase { } public duplicateTab(): void { - const queryText = this.persistedState?.query?.text ?? ""; + const queryText = this.iTabAccessor?.onSaveClickEvent() ?? this.persistedState?.query?.text ?? ""; const id = useTabs.getState().getTabs(ViewModels.CollectionTabKind.Query).length + 1; const newTab = new NewQueryTab( {