Fix tree filter and URL canonicality for filter state

- Root entries in tree view filtered strictly by entry_matches_filter;
  a parent no longer appears just because a descendant matches
- Expanded children always shown unfiltered (tree navigation intent)
- build_url always writes ?status=<val> so URL is fully canonical;
  apply_search falls back to open for absent/empty param (old URLs)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 16:21:46 +00:00
parent 8596f539c7
commit 7d8dcf85ce

View File

@@ -307,8 +307,6 @@ function make_entry_row(entry, children_map) {
}
function render_tree_node(entry, children_map) {
if (!entry_matches_filter(entry)) { return null; }
const children = children_map.get(entry.id) ?? [];
const node = document.createElement('div');
node.className = 'task-node';
@@ -318,8 +316,7 @@ function render_tree_node(entry, children_map) {
const children_el = document.createElement('div');
children_el.className = 'task-children';
for (const child of children) {
const child_node = render_tree_node(child, children_map);
if (child_node) { children_el.appendChild(child_node); }
children_el.appendChild(render_tree_node(child, children_map));
}
node.appendChild(children_el);
}
@@ -649,11 +646,10 @@ function navigate_new(type, parent_id) {
function build_url(hash) {
const params = new URLSearchParams();
if (state.filter_status !== 'open') { params.set('status', state.filter_status || 'all'); }
params.set('status', state.filter_status || 'all');
if (state.filter_priority) { params.set('priority', state.filter_priority); }
if (state.search) { params.set('search', state.search); }
const qs = params.toString();
return (qs ? '?' + qs : '') + '#' + hash;
return '?' + params.toString() + '#' + hash;
}
function apply_search() {