Skip to content

Commit c30e82f

Browse files
authored
Fix stuck panel options (#39)
When you had a panel still open and wanted to view a different the panel would receive focus but the panel options it would receive would still be the original options.
1 parent b0e8051 commit c30e82f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/chartPanel.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function createChartPanel(
6363
prometheus: Prometheus,
6464
options: PanelOptions,
6565
): ChartPanel {
66+
let currentOptions = options;
6667
const panel = vscode.window.createWebviewPanel(
6768
"autometricsChart",
6869
getTitle(options),
@@ -75,6 +76,7 @@ function createChartPanel(
7576
}
7677

7778
function update(options: PanelOptions) {
79+
currentOptions = options;
7880
panel.title = getTitle(options);
7981
postMessage({ type: "show_panel", options });
8082
}
@@ -83,7 +85,7 @@ function createChartPanel(
8385
(message: MessageFromWebview) => {
8486
switch (message.type) {
8587
case "ready":
86-
update(options);
88+
update(currentOptions);
8789
return;
8890
case "request_data": {
8991
const { query, timeRange, id } = message;

0 commit comments

Comments
 (0)