feat(my-wordpress): add server-side search to entity list views#254
Merged
Conversation
Adds a search input above the Posts / Pages / Users / Media (and any plugin-registered) entity list views in the My WordPress window. Search runs server-side via the WP REST `?search=…` param so it scales across collections of any size without pulling the whole set client-side. Highlights: - Shared `renderListToolbar` helper (300ms debounce, native-X clear, Enter-to-commit) so all three built-in renderers wire the same chrome. - `AbortController` per page fetch + a stale-query race guard so fast typing can't paint a previous query's tiles into the current grid. - Atomic swap on search refetch: the previous result set stays visible (dimmed via `--searching`) while the new page resolves, then replaces in a single frame. No skeleton flash between keystrokes. - Per-entity remembered query — survives a click-into-detail-and-back round-trip, resets when switching entities. - Empty-state copy "No <entity> match \"<query>\"." when the search produces zero results. Implementation surface: - New `src/my-wordpress/list-toolbar.ts`. - `fetchEntityList` / `fetchUserList` / `fetchMediaPage` gain optional `search` + `signal` params. - New `clear()` method on the internal `TileLayout` so the canvas can be reused for a fresh result set without disposing and rebuilding the layout instance. - New CSS rules in `my-wordpress.css` for the toolbar + dim-while- searching state.
Contributor
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a search input above the Posts / Pages / Users / Media (and any plugin-registered) entity list views in the My WordPress window. Mirrors the visual treatment of the Content Graph search input so the two surfaces read as the same control — but the implementation diverges:
?search=…natively against indexed columns (post_title+post_content, user_login/email/nicename/display_name, attachment title/filename). Client-side filtering would only match the ~24–48 tiles in memory at any moment, which would be useless for paginated infinite-scroll lists.What's in here
renderListToolbar— shared helper (300ms debounce, native-X clear, Enter-to-commit) consumed by all three built-in list renderers.fetchEntityList,fetchUserList,fetchMediaPagegain optionalsearch+signalparams. No new endpoints, no PHP changes.AbortControllerper page fetch + a stale-query check so fast typing can't paint a previous query's tiles into the current grid.TileLayout.clear()— small new method so the canvas can be reused for a fresh result set without disposing and rebuilding the layout instance.UX notes
opacity: 0.45+ 120ms ease-out on--searching. The title-bar activity pulse (free fromtrackedFetch) carries the rest of the "work in progress" feedback.Performance
/wp/v2/posts?search=foosearches title + content.post_titleis indexed,post_contentis not (no FULLTEXT). Fine at typical site sizes; can get slow on very large content. Out of scope for v1.Test plan