diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-02-06 14:53:47 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-02-06 14:53:47 -1000 |
| commit | 27ee1a271248e9f1de8ecb981a6cabfa8e498b1b (patch) | |
| tree | 7a5b8555ea4199094104f3e2b1227c08a33037ed /web/static/js/app.js | |
| parent | 0a1001eb0bd2d1f7c0624ae1ef8ae7ccdb3447d4 (diff) | |
Fix missing settings button, disappeared events, and tab refresh bug
- Add settings gear icon link to dashboard header
- Fix GetTasksByDateRange/GetCardsByDateRange to include overdue items
(changed from BETWEEN to <= end, filter completed tasks)
- Fix refresh replacing active tab with tasks tab by using
htmx.trigger(body, 'refresh-tasks') instead of innerHTML+htmx.process
- Add refresh-tasks hx-trigger to meals, shopping, conditions tabs
- Add tests for overdue inclusion/exclusion, settings link, template data
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'web/static/js/app.js')
| -rw-r--r-- | web/static/js/app.js | 29 |
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); } |
