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:
@@ -307,8 +307,6 @@ function make_entry_row(entry, children_map) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function render_tree_node(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 children = children_map.get(entry.id) ?? [];
|
||||||
const node = document.createElement('div');
|
const node = document.createElement('div');
|
||||||
node.className = 'task-node';
|
node.className = 'task-node';
|
||||||
@@ -318,8 +316,7 @@ function render_tree_node(entry, children_map) {
|
|||||||
const children_el = document.createElement('div');
|
const children_el = document.createElement('div');
|
||||||
children_el.className = 'task-children';
|
children_el.className = 'task-children';
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
const child_node = render_tree_node(child, children_map);
|
children_el.appendChild(render_tree_node(child, children_map));
|
||||||
if (child_node) { children_el.appendChild(child_node); }
|
|
||||||
}
|
}
|
||||||
node.appendChild(children_el);
|
node.appendChild(children_el);
|
||||||
}
|
}
|
||||||
@@ -649,11 +646,10 @@ function navigate_new(type, parent_id) {
|
|||||||
|
|
||||||
function build_url(hash) {
|
function build_url(hash) {
|
||||||
const params = new URLSearchParams();
|
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.filter_priority) { params.set('priority', state.filter_priority); }
|
||||||
if (state.search) { params.set('search', state.search); }
|
if (state.search) { params.set('search', state.search); }
|
||||||
const qs = params.toString();
|
return '?' + params.toString() + '#' + hash;
|
||||||
return (qs ? '?' + qs : '') + '#' + hash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply_search() {
|
function apply_search() {
|
||||||
|
|||||||
Reference in New Issue
Block a user