Skip to content

Commit 812bc4b

Browse files
review(instantsearch): address Sarah's review on PR #23
Three duplications tightened, all per Sarah's review: - features.md: collapsed five "read .d.ts" / "wire props from types" mentions down to a single intro reference to the Source-of-truth check. The intro on line 5 is the canonical pointer; the rest are rephrased to drop the rule restatement. - features.md: removed "Do not combine both" from the Pagination-vs-InfiniteHits prose. The dedicated entry already lives in anti-patterns.md; the checklist's "(or InfiniteHits, not both)" is enough of a reminder. - anti-patterns.md: removed the "Forgetting routing={true}" and "Forgetting insights={true}" rows. Both are already covered by PR #22's Always rules and the features checklist; the anti-patterns rows were the redundant copy. Forward-references to ../custom-widgets.md and ../ssr.md (PR #24) left in place per Sarah's "non-blocking, fine if 2 -> 3 ships in order" note. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f38efca commit 812bc4b

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

skills/instantsearch/references/react/search-results-page/anti-patterns.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ These are in addition to the [library-level anti-patterns](../anti-patterns.md).
1616
| Mounting the same refinement widget twice with the same `attribute` and different `limit`s | Two virtual widgets fight; only one set of params wins | Mount once. If desktop/mobile differ, render the same widget instance via CSS, not two instances |
1717
| Calling `setUiState` from `useEffect` to "preselect" refinements | Causes an extra search per mount and fights `routing` | Use the widget's default-selection prop, or `routing.stateMapping` to derive defaults from the URL |
1818
| Showing raw text for `name` / `title` on hits | Loses query highlighting; users can't see why a hit matched | Use `<Highlight attribute="name" hit={hit} />` per technology rules |
19-
| Long descriptions rendered with `<Highlight>` instead of `<Snippet>` | Renders the full text with marks; visually noisy and slow | Use `<Snippet>` and set `attributesToSnippet` in `<Configure>` (e.g., `description:30` for 30 words) |
20-
| Forgetting `routing={true}` on the provider | Search state is lost on reload; URLs are not shareable | Set `routing={true}` (or `routing={{...}}`) on `<InstantSearch>` / `<InstantSearchNext>` |
21-
| Forgetting `insights={true}` on the provider | No click/conversion analytics for results-page interactions | Set `insights={true}` and ensure hit components emit click/conversion events where relevant |
19+
| Long descriptions rendered with `<Highlight>` instead of `<Snippet>` | Renders the full text with marks; visually noisy and slow | Use `<Snippet>` and set `attributesToSnippet` in `<Configure>` (e.g., `description:30` for 30 words) |

skills/instantsearch/references/react/search-results-page/features.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Confirm before scaffolding:
1717

1818
## Canonical widget tree
1919

20-
This is the structural skeleton. Wire props from types and live docs.
20+
This is the structural skeleton. Resolve any non-trivial prop via the [Source-of-truth check](../source-of-truth.md).
2121

2222
```tsx
2323
import {
@@ -90,7 +90,7 @@ function Hit({ hit }: { hit: Record<string, unknown> & { objectID: string } }) {
9090
}
9191
```
9292

93-
The `<NoResultsBoundary>` shape is the version-stable pattern from the official guide. Confirm `useInstantSearch` return fields against installed types before destructuring.
93+
The `<NoResultsBoundary>` shape is the version-stable pattern from the official guide. Confirm `useInstantSearch` return fields before destructuring (per the intro source-of-truth rule).
9494

9595
## Refinement widgets: which one when
9696

@@ -105,16 +105,12 @@ The `<NoResultsBoundary>` shape is the version-stable pattern from the official
105105
| Active-filter chips | `<CurrentRefinements />` | Renders all active refinements as removable chips. Useful at the top of results. |
106106
| Clear-all button | `<ClearRefinements />` | Pairs with `<CurrentRefinements />`. Look up `excludedAttributes` to keep some refinements pinned. |
107107

108-
For every prop beyond `attribute` / `attributes`, **read the widget's `.d.ts`** before writing. Names and accepted shapes change across versions.
109-
110108
## Pagination vs. infinite scroll
111109

112110
Two mutually exclusive options:
113111

114112
- `<Pagination />`: shareable URL state per page. Default for results pages.
115-
- `<InfiniteHits />`: replaces both `<Hits>` and `<Pagination>`. Loads more on scroll or on a "Load more" button. Read `<InfiniteHits>`'s `.d.ts` for `showPrevious`, `translations`, and how it interacts with `routing`.
116-
117-
Do not combine both.
113+
- `<InfiniteHits />`: replaces both `<Hits>` and `<Pagination>`. Loads more on scroll or on a "Load more" button. Look up `showPrevious` and `translations` if you need them, and verify the widget's interaction with `routing`.
118114

119115
## Sort
120116

0 commit comments

Comments
 (0)