fix: clear-search restores board and enable partial-match search

- useTasks debounced effect bailed when searchQuery transitioned back to
  undefined (App passes `searchQuery || undefined`), so clearing the
  input never refetched the unfiltered list. Track previous value via
  ref and only skip the initial mount.
- FTS5 search used bare tokens (exact term match), so "frob" did not
  match "frobnicator". Append `*` to each token (and to quoted tokens)
  for prefix matching. LIKE fallback already did substring matching.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-30 21:01:13 -07:00
parent 6670837b7e
commit 0f4031824e
2 changed files with 10 additions and 3 deletions

View File

@@ -2489,12 +2489,14 @@ export class TaskStore extends EventEmitter<TaskStoreEvents> {
if (this.db.fts5Available) {
// For FTS5 MATCH, quote tokens that contain special characters like hyphens
// to prevent them from being interpreted as operators
// Append `*` to each token for FTS5 prefix matching so partial input
// (e.g., "frob") matches indexed terms like "frobnicator".
const ftsQuery = sanitizedTokens
.map((token) => {
if (/[":(){}*^+-]/.test(token)) {
return `"${token.replace(/"/g, '\\"')}"`;
return `"${token.replace(/"/g, '\\"')}"*`;
}
return token;
return `${token}*`;
})
.join(" OR ");
const whereClause = includeArchived ? "" : ` AND t."column" != 'archived'`;