Skip to content

fix(bindx-dataview): drop a pending search debounce on every change - #163

Merged
matej21 merged 1 commit into
mainfrom
fix/text-filter-input-debounce
Nov 4, 2026
Merged

matej21 merged 1 commit into
mainfrom
fix/text-filter-input-debounce

Conversation

@matej21

@matej21 matej21 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Fixes #142.

useDataViewTextFilterInput debounced only non-empty values and left a pending timer running when the box was emptied. The stale timer then applied the previous letter after the filter was cleared, and the sync effect copied it back into the input. A reset from outside while a timer was pending was skipped as well, and the pending value landed afterwards.

The input now:

  • cancels the pending timer on every change, including the one that empties the box;
  • remembers the last query it applied itself. A different query in the filter state came from outside, so the pending value is dropped and the input shows the new query.

Kept separate from the other DataView fixes: it touches only filterHooks.ts.

Tests

tests/react/dataview/textFilterInputDebounce.test.tsx: emptying the box within the debounce, and a reset from outside within the debounce. Both fail without the fix.

Status

  • Review round 1 (Claude agent, b08d791): approve.
  • CI: green on b08d791 (lint, typecheck, unit & integration, browser).
  • Merged into main as 1818ca8 (merge commit). Released in 0.1.61.

🤖 Generated with Claude Code

useDataViewTextFilterInput debounced only non-empty values and left a
pending timer running when the box was emptied, so the stale timer
applied the previous letter after the filter was cleared, and the sync
effect copied it back into the input. A reset from outside while a
timer was pending was skipped, and the pending value landed afterwards.

The input now cancels the pending timer on every change, including the
one that empties the box, and remembers the last query it applied
itself: a different query in the filter state came from outside, so the
pending value is dropped and the input shows the new query.

Fixes #142

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matej21

matej21 commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

Review round 1: independent Claude agent (Claude Code, general-purpose subagent, Opus 5.5), reviewed 09ef650..b08d791.

Verdict: approve

Nothing material. The fix removes the root cause, and both tests fail without it.

Two notes, not addressed here:

  • Minor: if the filter is already empty, a user types one letter and resets the filter within the debounce, the state does not change ('' → ''). The reset is invisible to the input and the letter is applied afterwards. Detecting it needs a reset signal from the filtering state, not a query comparison. The patch proposed in the issue has the same gap.
  • Info: a timer still pending at unmount is not cleared (unchanged behaviour).

@matej21
matej21 merged commit 1818ca8 into main Nov 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid search box: an emptied search brings back the first letter (stale debounce timer)

1 participant