@@ -22,13 +22,18 @@ import {
2222import { telemetryListener } from "../common/vscode/telemetry" ;
2323import { redactableError } from "../common/errors" ;
2424import { App } from "../common/app" ;
25- import { findResultSetNames } from "./result-set-names" ;
25+ import {
26+ findCommonResultSetNames ,
27+ findResultSetNames ,
28+ } from "./result-set-names" ;
2629
2730interface ComparePair {
2831 from : CompletedLocalQueryInfo ;
2932 fromSchemas : BQRSInfo ;
3033 to : CompletedLocalQueryInfo ;
3134 toSchemas : BQRSInfo ;
35+
36+ commonResultSetNames : readonly string [ ] ;
3237}
3338
3439export class CompareView extends AbstractWebview <
@@ -62,11 +67,17 @@ export class CompareView extends AbstractWebview<
6267 to . completedQuery . query . resultsPaths . resultsPath ,
6368 ) ;
6469
70+ const commonResultSetNames = await findCommonResultSetNames (
71+ fromSchemas ,
72+ toSchemas ,
73+ ) ;
74+
6575 this . comparePair = {
6676 from,
6777 fromSchemas,
6878 to,
6979 toSchemas,
80+ commonResultSetNames,
7081 } ;
7182
7283 await this . postMessage ( {
@@ -87,6 +98,7 @@ export class CompareView extends AbstractWebview<
8798 } ,
8899 } ,
89100 databaseUri : to . initialInfo . databaseInfo . databaseUri ,
101+ commonResultSetNames,
90102 } ) ;
91103
92104 await this . showResultsInternal ( selectedResultSetName ) ;
@@ -101,15 +113,11 @@ export class CompareView extends AbstractWebview<
101113 panel . reveal ( undefined , true ) ;
102114
103115 await this . waitForPanelLoaded ( ) ;
104- const {
105- commonResultSetNames,
106- currentResultSetDisplayName,
107- fromResultSet,
108- toResultSet,
109- } = await this . findResultSetsToCompare (
110- this . comparePair ,
111- selectedResultSetName ,
112- ) ;
116+ const { currentResultSetDisplayName, fromResultSet, toResultSet } =
117+ await this . findResultSetsToCompare (
118+ this . comparePair ,
119+ selectedResultSetName ,
120+ ) ;
113121 if ( currentResultSetDisplayName ) {
114122 let result : RawQueryCompareResult | undefined ;
115123 let message : string | undefined ;
@@ -122,7 +130,6 @@ export class CompareView extends AbstractWebview<
122130 await this . postMessage ( {
123131 t : "setComparisons" ,
124132 result,
125- commonResultSetNames,
126133 currentResultSetName : currentResultSetDisplayName ,
127134 message,
128135 } ) ;
@@ -192,15 +199,16 @@ export class CompareView extends AbstractWebview<
192199 }
193200
194201 private async findResultSetsToCompare (
195- { from, fromSchemas, to, toSchemas } : ComparePair ,
202+ { from, fromSchemas, to, toSchemas, commonResultSetNames } : ComparePair ,
196203 selectedResultSetName : string | undefined ,
197204 ) {
198- const {
199- commonResultSetNames,
200- currentResultSetDisplayName,
201- fromResultSetName,
202- toResultSetName,
203- } = await findResultSetNames ( fromSchemas , toSchemas , selectedResultSetName ) ;
205+ const { currentResultSetDisplayName, fromResultSetName, toResultSetName } =
206+ await findResultSetNames (
207+ fromSchemas ,
208+ toSchemas ,
209+ commonResultSetNames ,
210+ selectedResultSetName ,
211+ ) ;
204212
205213 const fromResultSet = await this . getResultSet (
206214 fromSchemas ,
@@ -213,7 +221,6 @@ export class CompareView extends AbstractWebview<
213221 to . completedQuery . query . resultsPaths . resultsPath ,
214222 ) ;
215223 return {
216- commonResultSetNames,
217224 currentResultSetDisplayName,
218225 fromResultSet,
219226 toResultSet,
0 commit comments