Automatically reload page when changing plots
Due to limitations of the current plotter, we don't handle swapping
between plots cleanly, so just forcibly reload the page.
Change-Id: Ib6ca5deb6c4fe57dc9a2d9ae354af9f7e356f722
diff --git a/frc971/analysis/plot_index.ts b/frc971/analysis/plot_index.ts
index 780f944..bfc8d53 100644
--- a/frc971/analysis/plot_index.ts
+++ b/frc971/analysis/plot_index.ts
@@ -103,6 +103,8 @@
const conn = new Connection();
+let reloadOnChange = false;
+
conn.connect();
conn.addConfigHandler((config: Configuration) => {
@@ -122,6 +124,10 @@
// Set the URL so that if you reload you get back to this plot.
window.history.replaceState(
null, null, '?plot=' + encodeURIComponent(plotSelect.value));
+ if (reloadOnChange) {
+ window.location.reload();
+ }
+ reloadOnChange = true;
});
plotSelect.value = getDefaultPlot();
// Force the event to occur once at the start.