From 39fd25eafc3e3e0ba6912b968d75fe5720453e7d Mon Sep 17 00:00:00 2001 From: Ulas Kalayci Date: Sun, 19 Apr 2026 07:23:46 +0200 Subject: [PATCH] fix: tasks filters not applied on tab re-entry (closes #49) render() always fetched /tasks without query params, so active filter chips appeared selected but all tasks were shown after navigating away and back. Fixed by building the same filter query in render() that loadTasks() uses, keeping both parallel fetches and correct filtering. Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 5 +++++ package.json | 2 +- public/pages/tasks.js | 10 ++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 03c194f..3b5f8d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.20.12] - 2026-04-19 + +### Fixed +- Tasks: active filters are now correctly re-applied when navigating away from and back to the Tasks tab. Previously the filter chip appeared active but all tasks were shown, because the initial data fetch in `render()` always called `/tasks` without query parameters, ignoring the persisted `state.filters`. Fixed by building the filter query in `render()` the same way `loadTasks()` does, so the first fetch already respects the current filter state (closes #49) + ## [0.20.11] - 2026-04-19 ### Fixed diff --git a/package.json b/package.json index a23e25c..33fc617 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oikos", - "version": "0.20.11", + "version": "0.20.12", "description": "Self-hosted family planner - calendar, tasks, shopping, meal planning, budget and more. Private, open-source, no subscription.", "main": "server/index.js", "type": "module", diff --git a/public/pages/tasks.js b/public/pages/tasks.js index e76c08b..ad7f73c 100644 --- a/public/pages/tasks.js +++ b/public/pages/tasks.js @@ -1163,10 +1163,16 @@ export async function render(container, { user }) { if (window.lucide) window.lucide.createIcons(); - // Daten laden + // Daten laden (Filter-State aus vorheriger Session berücksichtigen) try { + const params = new URLSearchParams(); + if (state.filters.status) params.set('status', state.filters.status); + if (state.filters.priority) params.set('priority', state.filters.priority); + if (state.filters.assigned_to) params.set('assigned_to', state.filters.assigned_to); + const query = params.toString() ? `?${params}` : ''; + const [tasksData, metaData] = await Promise.all([ - api.get('/tasks'), + api.get(`/tasks${query}`), api.get('/tasks/meta/options'), ]); state.tasks = tasksData.data ?? [];