File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
extensions/ql-vscode/src/view/compare Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -11,23 +11,14 @@ import CompareTable from "./CompareTable";
1111
1212import "../results/resultsView.css" ;
1313
14- const emptyComparison : SetComparisonsMessage = {
15- t : "setComparisons" ,
16- stats : { } ,
17- result : undefined ,
18- commonResultSetNames : [ ] ,
19- currentResultSetName : "" ,
20- databaseUri : "" ,
21- message : "Empty comparison" ,
22- } ;
23-
2414export function Compare ( _ : Record < string , never > ) : JSX . Element {
25- const [ comparison , setComparison ] =
26- useState < SetComparisonsMessage > ( emptyComparison ) ;
15+ const [ comparison , setComparison ] = useState < SetComparisonsMessage | null > (
16+ null ,
17+ ) ;
2718
28- const message = comparison . message || "Empty comparison" ;
19+ const message = comparison ? .message || "Empty comparison" ;
2920 const hasRows =
30- comparison . result &&
21+ comparison ? .result &&
3122 ( comparison . result . to . length || comparison . result . from . length ) ;
3223
3324 useEffect ( ( ) => {
@@ -50,6 +41,7 @@ export function Compare(_: Record<string, never>): JSX.Element {
5041 window . removeEventListener ( "message" , listener ) ;
5142 } ;
5243 } , [ ] ) ;
44+
5345 if ( ! comparison ) {
5446 return < div > Waiting for results to load.</ div > ;
5547 }
You can’t perform that action at this time.
0 commit comments