Skip to content

Add tests for useDebounce's timer cleanup #607

Description

@Abidoyesimze

Summary

Small but genuinely untested timer logic: stale-timer cleanup on rapid value/delay changes is exactly the kind of race that regresses silently without a test.

Affected files

  • src/hooks/useDebounce.ts

Tasks

  • Add a test asserting rapid value changes reset the pending timer instead of firing multiple updates.
  • Add a test asserting a changed delay is respected on the next update.

Acceptance criteria

  • Scope is limited to the files listed (or agreed alternatives in the PR).
  • Change is verifiable: tests, screenshots, or written QA steps in the PR.
  • No behavior regressions in related user flows.
  • No new duplicate abstractions without a one-line rationale in the PR.

Suggested labels

testing, good first issue

Notes

Sourced from the 2026-07-25 round-2 follow-up audit of the frontend codebase at commit 779e531, run after the first 60-issue audit batch (#525-#584) was substantially resolved. Verified against current file content at time of writing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions