Skip to content

perf(frontend): make transfer search and filtering deterministic at scale - #298

Open
woahwhattheheck wants to merge 2 commits into
RemitFlow:mainfrom
woahwhattheheck:latch/remitflow-281-search-filters
Open

woahwhattheheck wants to merge 2 commits into
RemitFlow:mainfrom
woahwhattheheck:latch/remitflow-281-search-filters

Conversation

@woahwhattheheck

Copy link
Copy Markdown

Closes #281

Summary

Transfer search and filtering now use actor-scoped, debounced, cancellable queries with stable sort semantics and a hard result cap so large histories stay correct and responsive.

What changed

  • transferSearch helpers define canonical filter matching, newest-first sort with id tie-breaker, actor visibility (including legacy unscoped rows), query scope keys, and result capping (DEFAULT_RESULT_CAP / MAX_RESULT_CAP).
  • listTransfers requires actor scope on every request, accepts search/status/range/limit, honours AbortSignal, and returns a stably sorted capped page.
  • useTransfers aborts the previous in-flight list call when filters change and drops stale replies so a slow response cannot overwrite the active filter set.
  • Transfers debounces free-text search before updating the URL and driving the query; status/range still apply immediately. Optional actorId on the Transfer contract is stamped on create and seeds.

Tradeoffs

  • Search URL updates after the debounce window (300ms) so keystrokes do not fan out requests; shareable links still settle on the committed term.
  • Result lists are capped (default 100) so unbounded histories cannot stall the UI; callers can request up to MAX_RESULT_CAP.
  • Legacy rows without actorId remain readable only under the demo actor during migration.

Compatibility

  • Additive optional actorId on Transfer; existing fixtures without it still load for the demo actor.
  • Filter URL params (search, status, range) and pagination UI are unchanged.

Test evidence

npx vitest run \
  test/unit/transfer-search.test.js \
  test/unit/list-transfers-search.test.js \
  test/unit/useTransfers-search-race.test.jsx \
  test/unit/useTransfers.errors.test.jsx \
  test/integration/transfers-filter.test.jsx \
  test/integration/transfers-search-scale.test.jsx \
  test/integration/select-all-across-pages.test.jsx
# Test Files  7 passed | Tests  31 passed

npm run build  # ok

Coverage includes stale-response races, AbortSignal cancellation, actor scope isolation, result capping, pagination on a large fixture, and a 5k-row performance budget.

Out of scope

  • Broad rewrites, unrelated services, or cosmetic-only changes.

Ready for review

Make transfer search and filtering deterministic at scale: every list
request carries actor scope, obsolete in-flight queries are aborted,
stable sort + result caps bound work, and stale responses cannot
overwrite the active filter set.
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.

perf(frontend): make transfer search and filtering deterministic at scale

1 participant