@@ -7,6 +7,7 @@ import { CompletedQueryInfo, LocalQueryInfo } from './query-results';
77import { QueryHistoryInfo } from './query-history-info' ;
88import { QueryStatus } from './query-status' ;
99import { QueryEvaluationInfo } from './run-queries-shared' ;
10+ import { QueryResultType } from './pure/legacy-messages' ;
1011
1112export async function slurpQueryHistory ( fsPath : string ) : Promise < QueryHistoryInfo [ ] > {
1213 try {
@@ -39,6 +40,17 @@ export async function slurpQueryHistory(fsPath: string): Promise<QueryHistoryInf
3940 Object . setPrototypeOf ( q . completedQuery . query , QueryEvaluationInfo . prototype ) ;
4041 // slurped queries do not need to be disposed
4142 q . completedQuery . dispose = ( ) => { /**/ } ;
43+
44+ // Previously, there was a typo in the completedQuery type. There was a field
45+ // `sucessful` and it was renamed to `successful`. We need to handle this case.
46+ if ( 'sucessful' in q . completedQuery ) {
47+ ( q . completedQuery as any ) . successful = ( q . completedQuery as any ) . sucessful ;
48+ delete ( q . completedQuery as any ) . sucessful ;
49+ }
50+
51+ if ( ! ( 'successful' in q . completedQuery ) ) {
52+ ( q . completedQuery as any ) . successful = q . completedQuery . result ?. resultType === QueryResultType . SUCCESS ;
53+ }
4254 }
4355 } else if ( q . t === 'remote' ) {
4456 // A bug was introduced that didn't set the completed flag in query history
@@ -91,7 +103,10 @@ export async function splatQueryHistory(queries: QueryHistoryInfo[], fsPath: str
91103 // remove incomplete local queries since they cannot be recreated on restart
92104 const filteredQueries = queries . filter ( q => q . t === 'local' ? q . completedQuery !== undefined : true ) ;
93105 const data = JSON . stringify ( {
94- version : 2 , // version 2 adds the `variant-analysis` type.
106+ // version 2:
107+ // - adds the `variant-analysis` type
108+ // - ensures a `successful` property exists on completedQuery
109+ version : 2 ,
95110 queries : filteredQueries
96111 } , null , 2 ) ;
97112 await fs . writeFile ( fsPath , data ) ;
0 commit comments