Skip to content

Commit 4a32170

Browse files
authored
Merge pull request #3107 from github/koesie10/fix-compare-loading-message
Fix loading message for compare view
2 parents 3f07082 + a42e9eb commit 4a32170

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

extensions/ql-vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Remove support for CodeQL CLI versions older than 2.11.6. [#3087](https://github.com/github/vscode-codeql/pull/3087)
77
- Preserve focus on results viewer when showing a location in a file. [#3088](https://github.com/github/vscode-codeql/pull/3088)
88
- The `dataflowtracking` and `tainttracking` snippets expand to the new module-based interface. [#3091](https://github.com/github/vscode-codeql/pull/3091)
9+
- The compare view will now show a loading message while the results are loading. [#3107](https://github.com/github/vscode-codeql/pull/3107)
910

1011
## 1.10.0 - 16 November 2023
1112

extensions/ql-vscode/src/view/compare/Compare.tsx

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,14 @@ import CompareTable from "./CompareTable";
1111

1212
import "../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-
2414
export 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
}

0 commit comments

Comments
 (0)