Skip to content

fix(admin): debounce byline search to stop full-page reload per keystroke#1222

Draft
scottbuscemi wants to merge 1 commit into
mainfrom
fix/1220-byline-search-debounce
Draft

fix(admin): debounce byline search to stop full-page reload per keystroke#1222
scottbuscemi wants to merge 1 commit into
mainfrom
fix/1220-byline-search-debounce

Conversation

@scottbuscemi
Copy link
Copy Markdown
Contributor

Closes #1220.

Problem

Typing in the Bylines search box reloaded the whole page on every keystroke (even with ~5 bylines). The search value fed the React Query key directly with no debounce, and the full-page loader gate (if (isLoading)) unmounted the entire page — including the search input — on each new query key, so the field lost focus and flashed.

Fix

  • Debounce the search value (300ms) via the shared useDebouncedValue hook before it drives the query key / fetch / load-more, keeping the input bound to raw state so typing stays responsive.
  • Gate the full-page loader on isLoading && !data so the list refetches in place instead of replacing the page.
  • This matches the existing pattern on the Users page.

Testing

  • pnpm lint:quick clean, pnpm --filter @emdash-cms/admin typecheck passes.
  • Added packages/admin/tests/routes/bylines.test.tsx (browser/vitest) covering debounce + no full-page loader takeover. Runs in CI.

Manual verification

  1. Admin → Manage → Bylines.
  2. Type in the search box. Expect: no full-page flash, input keeps focus, results filter after a brief pause (one request per pause, not per keystroke).

…roke

The byline search input fed the query key directly with no debounce, and
the full-page loader gate (`if (isLoading)`) replaced the whole page —
including the search input — on every keystroke, so the field lost focus
and flashed. Debounce the search (300ms) before it drives the query and
only show the full-page loader when there is no data yet, matching the
users page. Closes #1220.
@github-actions
Copy link
Copy Markdown
Contributor

PR template validation failed

Please fix the following issues by editing your PR description:

  • This PR does not use the required PR template. Please edit the description to use the PR template. Copy it into your PR description and fill out all sections.

See CONTRIBUTING.md for the full contribution policy.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs d37327e May 29 2026, 10:18 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground d37327e May 29 2026, 10:19 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache d37327e May 29 2026, 10:19 PM

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

🦋 Changeset detected

Latest commit: d37327e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - Bylines - Byline search reloads the byline page on each keystroke

1 participant