Commit e85ae44
fix(settings-ui): preserve search filter across tool-toggle rebuilds
Reported: typing a query in the Tools tab search bar filtered the
list correctly, but toggling a setting on a visible tool snapped the
full list back into view — even though the search bar still showed
the query.
Root cause: ``render()`` (called after every toggle change via
``scheduleSave(); render();``) does ``container.innerHTML = ''`` and
rebuilds the entire ``.tool`` DOM. The search filter applied the
``hidden`` class imperatively to the OLD nodes; the freshly-built
nodes had none. The ``<input>`` element itself is outside the
rebuilt container, so its value persists — producing the
visible-query-but-no-filter mismatch the user reported.
Fix: extract the filter into ``applyToolSearch()`` that reads the
search input's current value directly and applies / clears the
``hidden`` class on every ``.tool`` node it finds. Wire it to the
input's ``input`` event (was inline before) and also call it at the
end of ``render()`` so any rebuild — toggle change, group-master
toggle, future render triggers — re-applies the active filter
against the new DOM.
No regression risk on the no-search path: an empty query short-
circuits ``!q`` to true and every tool stays visible, same outcome
as before. Group auto-expansion when search has matches still
works (q && visible branch unchanged).
Not directly testable in the current JS test infra (the project
bar is ``node --check`` syntax-only — no JSDOM, no DOM event
simulation). Closing that gap is tracked in #1422; ``node --check``
on the rebuilt script confirms no syntax regression.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9a108ef commit e85ae44
1 file changed
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1298 | 1298 | | |
1299 | 1299 | | |
1300 | 1300 | | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
1301 | 1310 | | |
1302 | 1311 | | |
1303 | 1312 | | |
| |||
1331 | 1340 | | |
1332 | 1341 | | |
1333 | 1342 | | |
1334 | | - | |
1335 | | - | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
1336 | 1349 | | |
1337 | 1350 | | |
1338 | 1351 | | |
| |||
1346 | 1359 | | |
1347 | 1360 | | |
1348 | 1361 | | |
1349 | | - | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
1350 | 1365 | | |
1351 | 1366 | | |
1352 | 1367 | | |
| |||
0 commit comments