Skip to content

feat: port missing widgets across InstantSearch flavors#7027

Closed
aymeric-giraudet wants to merge 3 commits into
masterfrom
chore/port-widget-migrations
Closed

feat: port missing widgets across InstantSearch flavors#7027
aymeric-giraudet wants to merge 3 commits into
masterfrom
chore/port-widget-migrations

Conversation

@aymeric-giraudet

Copy link
Copy Markdown
Contributor

Draft — opening early for review. Builds on top of #7020 (port-widget skill improvements), which surfaces the gaps this PR closes via python3 .claude/skills/port-widget/scripts/audit_widget_coverage.py --gaps.

Summary

  • React: adds the three missing widgets — MenuSelect (variant of useMenu), NumericMenu, and RatingMenu. Adds matching src/ui presentational components and a new useRatingMenu hook in react-instantsearch-core.
  • Vue: adds six render-function wrappers around the shared instantsearch-ui-components factories: RelatedProducts, TrendingItems, TrendingFacets, LookingSimilar, FrequentlyBoughtTogether, and FilterSuggestions. Introduces a small createRecommendMixin so each widget tracks instantSearchInstance.status reactively without per-widget boilerplate.
  • Vue 2 compat fixes (in util/vue-compat/index-vue2.js): tolerates null props from shared <Fragment> JSX, exports a Vue 2 Fragment shim, and remaps React-style onClick / onAuxClick props to Vue 2's on: { click, auxclick } event API so shared UI components work without per-widget shims.
  • Common tests: replaces "X is not supported in Vue/React InstantSearch" placeholders with real test setups and removes the corresponding skippedTests entries. Adapts the filter-suggestions common tests to use skippableTest / skippableDescribe for the few cases where Vue cannot match React/JS-only behavior (templates describe block; throws without agentId is swallowed by Vue's created hook).

Chat is intentionally out of scope — its surface area (1338 LOC widget + ~3200 LOC of common tests + tool registry + sub-components) deserves its own PR.

Test plan

  • npx jest packages/react-instantsearch packages/react-instantsearch-core --no-coverage — 107 suites, 884 passing.
  • npx jest packages/vue-instantsearch --no-coverage — 50 suites, 590 passing.
  • npx jest --testNamePattern="FilterSuggestions" packages/instantsearch.js/src/__tests__/common-widgets.test.tsx packages/react-instantsearch/src/__tests__/common-widgets.test.tsx packages/vue-instantsearch/src/__tests__/common-widgets.test.js --no-coverage — JS, React, and Vue suites all green.
  • python3 .claude/skills/port-widget/scripts/audit_widget_coverage.py --gaps — only chat remains in the porting list (down from 11 widgets).

Aymeric Giraudet added 3 commits May 11, 2026 11:02
The audit script previously missed widgets like `dynamic-widgets` (uses `.ts`,
not `.tsx`) and falsely flagged variants like `range-input`/`menu-select` as
missing their connector/hook. It also looked for Vue placeholders by exact
PascalCase match, missing irregular names like `RelatedProduct` (singular).
Adds a `--gaps` mode so contributors can see all open porting work across
flavors at a glance, and refreshes the skill docs around an audit-first
workflow with a Vue render-function template for the recommendation/chat
family of widgets.
Adds a "Pitfalls discovered while porting recommendation widgets" section
to the Vue reference, covering the Fragment shim, status tracking via
`createRecommendMixin`, async state delivery in test setups, Vue's
swallowed connector throws, and flavored test suites that need real Vue
widgetParams.

Captured while implementing the actual ports in a separate PR; surfacing
the lessons here so the next contributor doesn't have to rediscover them.
Implements the gaps surfaced by the new `port-widget` skill audit:

- React: adds `MenuSelect` (variant of `useMenu`), `NumericMenu`, and
  `RatingMenu` widgets along with new `src/ui` components and a new
  `useRatingMenu` hook in `react-instantsearch-core`.
- Vue: adds `RelatedProducts`, `TrendingItems`, `TrendingFacets`,
  `LookingSimilar`, `FrequentlyBoughtTogether`, and `FilterSuggestions`
  render-function wrappers around the shared
  `instantsearch-ui-components` factories. Introduces a small
  `createRecommendMixin` that tracks `instantSearchInstance.status`
  reactively so empty states render correctly.
- Vue 2 compat: makes the augmented JSX `h` tolerate `null` props from
  shared `<Fragment>` JSX, exports a Vue 2 `Fragment` shim, and translates
  React-style `onClick`/`onAuxClick` event props to Vue 2's
  `on: { click, auxclick }` so shared UI components work without per-widget
  shims.
- Tests: replaces "X is not supported in Vue/React InstantSearch"
  placeholders with real test setups, removes the corresponding
  `skippedTests` entries, and adapts the `filter-suggestions` common tests
  to support per-flavor params (now using `skippableTest` /
  `skippableDescribe` where Vue can't match the React/JS-only behavior).

Chat is intentionally out of scope — it deserves its own PR.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 40 complexity · 49 duplication

Metric Results
Complexity 40
Duplication 49

View in Codacy

TIP This summary will be updated as you push new changes.

@pkg-pr-new

pkg-pr-new Bot commented May 12, 2026

Copy link
Copy Markdown
More templates

algoliasearch-helper

npm i https://pkg.pr.new/algolia/instantsearch/algoliasearch-helper@7027

instantsearch-ui-components

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch-ui-components@7027

instantsearch.css

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.css@7027

instantsearch.js

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.js@7027

react-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch@7027

react-instantsearch-core

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-core@7027

react-instantsearch-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-nextjs@7027

react-instantsearch-router-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-router-nextjs@7027

vue-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/vue-instantsearch@7027

commit: 7b60cb1

@Haroenv

Haroenv commented May 12, 2026

Copy link
Copy Markdown
Contributor

intent looks good, maybe split up into different PRs for easier review?

@aymeric-giraudet

Copy link
Copy Markdown
Contributor Author

Superseded by a stack of smaller PRs based off #7020:

  • Vue compat fixes: TBD
  • Common test infra: TBD
  • React widgets: TBD
  • Vue recommend widgets: TBD
  • Vue FilterSuggestions: TBD

Will link from each PR once they're open.

@aymeric-giraudet aymeric-giraudet deleted the chore/port-widget-migrations branch May 13, 2026 10:16
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.

2 participants