summaryrefslogtreecommitdiff
path: root/web/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'web/static/js')
-rw-r--r--web/static/js/app.js29
1 files changed, 8 insertions, 21 deletions
diff --git a/web/static/js/app.js b/web/static/js/app.js
index 5dffacc..954dc8c 100644
--- a/web/static/js/app.js
+++ b/web/static/js/app.js
@@ -218,16 +218,9 @@ async function refreshData() {
if (!refreshResponse.ok) throw new Error('Refresh failed');
- // Reload current tab from cache
- const tabResponse = await fetch(`/tabs/${currentTab}`);
-
- if (!tabResponse.ok) throw new Error('Tab reload failed');
-
- // Get HTML response and update tab content
- const html = await tabResponse.text();
- const tabContent = document.getElementById('tab-content');
- tabContent.innerHTML = html;
- htmx.process(tabContent);
+ // Trigger HTMX refresh on the current tab — each tab template
+ // has hx-trigger="refresh-tasks from:body" to handle its own reload
+ htmx.trigger(document.body, 'refresh-tasks');
// Update timestamp
updateLastUpdatedTime();
@@ -275,17 +268,11 @@ async function autoRefresh() {
if (!refreshResponse.ok) throw new Error('Refresh failed');
- // Reload current tab from cache
- const tabResponse = await fetch(`/tabs/${currentTab}`);
-
- if (tabResponse.ok) {
- const html = await tabResponse.text();
- const tabContent = document.getElementById('tab-content');
- tabContent.innerHTML = html;
- htmx.process(tabContent);
- updateLastUpdatedTime();
- console.log('Auto-refresh successful');
- }
+ // Trigger HTMX refresh on the current tab — each tab template
+ // has hx-trigger="refresh-tasks from:body" to handle its own reload
+ htmx.trigger(document.body, 'refresh-tasks');
+ updateLastUpdatedTime();
+ console.log('Auto-refresh successful');
} catch (error) {
console.error('Auto-refresh failed:', error);
}