From 397693a2cb948eb4afc9cbc8ae62ab8fd609ca13 Mon Sep 17 00:00:00 2001 From: Koen Vlaswinkel Date: Mon, 8 Jan 2024 13:44:50 +0100 Subject: [PATCH] Remove import cycle for results view --- extensions/ql-vscode/src/view/results/AlertTable.tsx | 2 +- extensions/ql-vscode/src/view/results/RawTable.tsx | 2 +- extensions/ql-vscode/src/view/results/ResultsApp.tsx | 8 +------- extensions/ql-vscode/src/view/results/navigation.ts | 7 +++++++ 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 extensions/ql-vscode/src/view/results/navigation.ts diff --git a/extensions/ql-vscode/src/view/results/AlertTable.tsx b/extensions/ql-vscode/src/view/results/AlertTable.tsx index b8099c739..cdef738cc 100644 --- a/extensions/ql-vscode/src/view/results/AlertTable.tsx +++ b/extensions/ql-vscode/src/view/results/AlertTable.tsx @@ -6,7 +6,7 @@ import type { } from "./result-keys"; import { getPath, getPathNode, getResult, keyToString } from "./result-keys"; import { className, jumpToLocation } from "./result-table-utils"; -import { onNavigation } from "./ResultsApp"; +import { onNavigation } from "./navigation"; import type { NavigateMsg } from "../../common/interface-types"; import { NavigationDirection } from "../../common/interface-types"; import { isNoLocation, parseSarifLocation } from "../../common/sarif-utils"; diff --git a/extensions/ql-vscode/src/view/results/RawTable.tsx b/extensions/ql-vscode/src/view/results/RawTable.tsx index 07bc6ebbd..3a31bb8f5 100644 --- a/extensions/ql-vscode/src/view/results/RawTable.tsx +++ b/extensions/ql-vscode/src/view/results/RawTable.tsx @@ -10,7 +10,7 @@ import { } from "../../common/interface-types"; import RawTableHeader from "./RawTableHeader"; import RawTableRow from "./RawTableRow"; -import { onNavigation } from "./ResultsApp"; +import { onNavigation } from "./navigation"; import { sendTelemetry } from "../common/telemetry"; import { assertNever } from "../../common/helpers-pure"; import { EmptyQueryResultsMessage } from "./EmptyQueryResultsMessage"; diff --git a/extensions/ql-vscode/src/view/results/ResultsApp.tsx b/extensions/ql-vscode/src/view/results/ResultsApp.tsx index b9debf8b3..7b1861274 100644 --- a/extensions/ql-vscode/src/view/results/ResultsApp.tsx +++ b/extensions/ql-vscode/src/view/results/ResultsApp.tsx @@ -8,15 +8,14 @@ import type { QueryMetadata, ResultsPaths, ParsedResultSets, - NavigateMsg, ResultSet, } from "../../common/interface-types"; import { ALERTS_TABLE_NAME, GRAPH_TABLE_NAME, } from "../../common/interface-types"; -import { EventHandlers as EventHandlerList } from "./event-handler-list"; import { ResultTables } from "./ResultTables"; +import { onNavigation } from "./navigation"; import "./resultsView.css"; import { useCallback, useEffect, useState } from "react"; @@ -64,11 +63,6 @@ interface ResultsViewState { isExpectingResultsUpdate: boolean; } -/** - * Event handlers to be notified of navigation events coming from outside the webview. - */ -export const onNavigation = new EventHandlerList(); - /** * A minimal state container for displaying results. */ diff --git a/extensions/ql-vscode/src/view/results/navigation.ts b/extensions/ql-vscode/src/view/results/navigation.ts new file mode 100644 index 000000000..0fa1e8a3d --- /dev/null +++ b/extensions/ql-vscode/src/view/results/navigation.ts @@ -0,0 +1,7 @@ +import type { NavigateMsg } from "../../common/interface-types"; +import { EventHandlers as EventHandlerList } from "./event-handler-list"; + +/** + * Event handlers to be notified of navigation events coming from outside the webview. + */ +export const onNavigation = new EventHandlerList();