feat(instantsearch): add React custom widgets, middleware, SSR (3/4)#24
Open
vascobettencourt wants to merge 2 commits into
Open
feat(instantsearch): add React custom widgets, middleware, SSR (3/4)#24vascobettencourt wants to merge 2 commits into
vascobettencourt wants to merge 2 commits into
Conversation
6 tasks
Adds the canonical widget tree (SearchBox, Configure, Hits, Pagination, Stats, NoResultsBoundary), the refinements catalog (RefinementList, HierarchicalMenu, RangeInput, ToggleRefinement, CurrentRefinements, ClearRefinements), sort via SortBy with replicas, and multi-index guidance. The pattern reference points reviewers at types and live docs for prop-level details rather than baking them in. Adds evals 6 and 7 covering the full results page and a searchable refinement list with active-filter chips. Stacks on feat/instantsearch-source-of-truth.
…nces Adds three library-level references that close the gaps the Source-of-truth check on its own can't fully bridge: - custom-widgets.md: when widget + classNames suffices vs when to reach for useConnector / useXxx, the renderState contract, common pitfalls (stale state, re-render storms, lost A11y). - middleware.md: contract (subscribe / started / unsubscribe / onStateChange), legitimate uses, and what middleware should NOT be used for (URL sync, default refinements). - ssr.md: App Router via InstantSearchNext (no extra helpers needed) vs Pages Router / non-Next React via getServerState + InstantSearchSSRProvider, with explicit guidance against mixing them. Adds evals 8 (Pages Router SSR) and 9 (custom chip widget via useRefinementList). Stacks on feat/instantsearch-source-of-truth. Co-authored-by: Cursor <cursoragent@cursor.com>
adad646 to
2d46652
Compare
6 tasks
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.
What does this skill do?
Adds three sibling library-level references that cover the React surfaces the Source-of-truth check on its own can't fully bridge — they involve enough nuance and trade-offs that a baked structural skeleton earns its keep.
This is part 3 of 4. Stacks on #22 (PR 1), parallel to #23 (PR 2). Review PR 1 first.
What's in this PR
references/react/custom-widgets.md— when widget +classNames+transformItemsis enough, when to reach foruseConnector/useXxx, the renderState contract, common pitfalls (stale state in handlers, re-render storms, lost A11y, duplicate connector instances). Includes a "do you actually need this?" walkthrough so the agent doesn't reach for hooks reflexively.references/react/middleware.md— middleware contract (subscribe,started,unsubscribe,onStateChange), legitimate uses (custom analytics, non-URL state sync), and what middleware should NOT do (URL sync, default refinements — both belong inrouting/<Configure>).references/react/ssr.md— App Router via<InstantSearchNext>(no extra helpers needed) vs Pages Router / non-Next React viagetServerState+<InstantSearchSSRProvider>. Explicit guidance against doubling up.SKILL.md: adds custom-widgets, middleware, ssr rows to the references table.evals/evals.json: adds eval 8 (Pages Router SSR) and eval 9 (custom chip widget viauseRefinementList).Stacking note
Same as PR 2: includes PR 1's commit in the diff against
main. Review only the second commit.Checklist
python3 scripts/validate_skills.py .passes (31/31)evals/evals.jsonhas 8 prompts after this PRskills/Behavioral test
Evals 8 and 9 were exercised via fresh subagents. Eval 8 (Pages Router SSR) hit 8/8:
getServerStatefromreact-instantsearch/server,<InstantSearchSSRProvider>,renderToStringfromreact-dom/server, module-scopesearchClient,routingupgraded for server-side URL resolution, no<InstantSearchNext>. Eval 9 (custom widget) hit 6/6: walked the "do you actually need this?" gates, useduseRefinementList(correctly preferred over rawuseConnector), calledrefine(item.value), added explicit ARIA, consideredtransformItemsfirst.