Skip to content

feat(instantsearch): add React custom widgets, middleware, SSR (3/4)#24

Open
vascobettencourt wants to merge 2 commits into
feat/instantsearch-source-of-truthfrom
feat/instantsearch-react-advanced
Open

feat(instantsearch): add React custom widgets, middleware, SSR (3/4)#24
vascobettencourt wants to merge 2 commits into
feat/instantsearch-source-of-truthfrom
feat/instantsearch-react-advanced

Conversation

@vascobettencourt
Copy link
Copy Markdown
Member

@vascobettencourt vascobettencourt commented May 18, 2026

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

  • New references/react/custom-widgets.md — when widget + classNames + transformItems is enough, when to reach for useConnector / 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.
  • New 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 in routing / <Configure>).
  • New references/react/ssr.md — App Router via <InstantSearchNext> (no extra helpers needed) vs Pages Router / non-Next React via getServerState + <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 via useRefinementList).

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)
  • Skill description unchanged
  • evals/evals.json has 8 prompts after this PR
  • Skill is self-contained
  • Registered in marketplace.json — N/A
  • Goes in skills/

Behavioral test

Evals 8 and 9 were exercised via fresh subagents. Eval 8 (Pages Router SSR) hit 8/8: getServerState from react-instantsearch/server, <InstantSearchSSRProvider>, renderToString from react-dom/server, module-scope searchClient, routing upgraded for server-side URL resolution, no <InstantSearchNext>. Eval 9 (custom widget) hit 6/6: walked the "do you actually need this?" gates, used useRefinementList (correctly preferred over raw useConnector), called refine(item.value), added explicit ARIA, considered transformItems first.

vascobettencourt and others added 2 commits May 18, 2026 14:04
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>
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.

1 participant