From f0876156404da87782c4b0cf2b8086e0859e63c1 Mon Sep 17 00:00:00 2001
From: Paul Oliver <contact@pauloliver.dev>
Date: Sun, 19 Apr 2026 21:22:06 +0200
Subject: Fixes data reload bug

---
 data/vue/App.vue | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

(limited to 'data/vue/App.vue')

diff --git a/data/vue/App.vue b/data/vue/App.vue
index 6c91964..8bf2959 100644
--- a/data/vue/App.vue
+++ b/data/vue/App.vue
@@ -73,6 +73,7 @@ let query_timeout = null
 let plot_low = 0
 let plot_redraw = false
 let mvec_size = 0
+let reload_triggered = false
 
 const int_max = Number.MAX_SAFE_INTEGER
 const uint32_max = (2 ** 32) - 1
@@ -149,14 +150,7 @@ const on_form_change = () => {
 }
 
 const trigger_reload = () => {
-  update_visible_tables()
-
-  params.value = { ...inputs.value }
-  plot_low = Number(params.value.low)
-  plot_redraw = true
-
-  check_form_touched()
-  check_form_non_default()
+  reload_triggered = true
   query()
 }
 
@@ -199,6 +193,19 @@ const query = async () => {
   clearTimeout(query_timeout)
   query_in_progress.value = true
 
+  if (reload_triggered) {
+    update_visible_tables()
+
+    params.value = { ...inputs.value }
+    plot_low = Number(params.value.low)
+    plot_redraw = true
+
+    check_form_touched()
+    check_form_non_default()
+
+    reload_triggered = false
+  }
+
   const high_params = new URLSearchParams({ axis: params.value.axis })
   const resp_high = await fetch(root + `high?${high_params}`, { method: 'GET' })
   const text_high = await resp_high.text()
@@ -220,7 +227,12 @@ const query = async () => {
   plot_redraw = false
 
   query_in_progress.value = false
-  query_timeout = setTimeout(query, 10000)
+
+  if (reload_triggered) {
+    query()
+  } else {
+    query_timeout = setTimeout(query, 10000)
+  }
 }
 
 const with_big_ints = (_, val, { source }) => {
-- 
cgit v1.3

