Skip to content

Restore live exercise tag filtering - #155

Closed
wienans wants to merge 2 commits into
feature/improve-codebasefrom
wienans-quadcoach-154-tag-filtering-doesnt-work-anymore-while-typing
Closed

wienans wants to merge 2 commits into
feature/improve-codebasefrom
wienans-quadcoach-154-tag-filtering-doesnt-work-anymore-while-typing

Conversation

@wienans

@wienans wienans commented Jul 29, 2026 •

Copy link
Copy Markdown
Owner

#154 | Artifacts | PR Walkthrough (alpha)

What problems was I solving

Exercise tag filtering stopped reacting to text while a coach typed. Results only reflected tags after Enter committed the text as an exact tag chip, removing the fast feedback users previously had when finding exercises by a partial tag.

This PR restores debounced, case-insensitive partial-tag filtering while preserving exact selected tags. It also prevents superseded requests, stale responses, and old pagination results from replacing the active query state when users type or clear filters quickly.

What user-facing changes did I ship

  • Exercise tag input - Exercise results now enter a loading state immediately and refresh after a 500 ms pause while typing a tag fragment.
  • Partial tag matching - Partial text matches tags case-insensitively and treats regex-like punctuation literally.
  • Exact and partial composition - Committed tag chips remain exact requirements while in-progress text further narrows the same result set.
  • Race-safe result updates - Clearing or changing filters no longer allows an obsolete request or pagination response to overwrite current results.

How I implemented it

Backend Changes

  • Collection query types - Adds the exercise-only tagSearch intent field.
  • Transport parser - Trims partial text, omits blank values, enforces singleton/length validation, and rejects the field for other resources.
  • Mongo query builder - Combines exact selection and escaped partial matching with $and when both are present.
  • HTTP and Mongo contracts - Covers mixed exact/partial matching, literal punctuation, blank omission, and structured validation failures.

Frontend Changes

  • Exercise API - Adds tagSearch to the typed request and serializes it into the collection URL.
  • Exercise query hook - Centralizes request mapping, debounce timing, generations, cancellation, loading/error state, and deduplicated pagination.
  • Exercise list integration - Replaces component-level Lodash debounce and response merging with the query hook while preserving the existing filter UI.
  • Hook tests - Uses deferred requests and fake timers to prove debounce restarts, stale-response rejection, aborts, and pagination behavior.
  • Component test - Exercises typed, committed, cleared, loading, and active-error states through the rendered page.

Database Changes

  • No schema, migration, or stored-document changes are required.

Deviations from the plan

No plan file was found. The task artifacts contain research questions, research, a PRD, a TDD, and a structure outline rather than an implementation plan.

How to verify it

Create a worktree for the PR branch if needed:

git fetch origin
git worktree add ../quadcoach-pr-155 origin/wienans-quadcoach-154-tag-filtering-doesnt-work-anymore-while-typing

Manual Testing

  • Open the exercise list, type part of an existing tag, pause for 500 ms, and confirm results update without pressing Enter.
  • Press Enter to commit the tag and confirm it becomes an exact chip while results remain filtered.
  • Type a second partial tag and confirm both the exact chip and partial text must match.
  • Type and clear text quickly and confirm stale results or stale errors never replace the active loading/result state.
  • Use a fragment containing regex punctuation such as [one].* and confirm it is matched literally.
  • Load another page, then change the filter and confirm old-page exercises do not appear in the new result set.

Automated Tests

cd client
npm test
npm run build
npm run lint

cd ../server
npm run verify

Description for the changelog

Restore debounced exercise filtering while typing partial tags, with race-safe loading and pagination.

@wienans wienans closed this Sep 5, 2026
@wienans
wienans deleted the wienans-quadcoach-154-tag-filtering-doesnt-work-anymore-while-typing branch September 5, 2026 12:29
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.

1 participant