feat(instantsearch): add connectFeeds connector for multifeed compositions#6964
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 186 |
| Duplication | 0 |
TIP This summary will be updated as you push new changes. Give us feedback
More templates
algoliasearch-helper
instantsearch-ui-components
instantsearch.css
instantsearch.js
react-instantsearch
react-instantsearch-core
react-instantsearch-nextjs
react-instantsearch-router-nextjs
vue-instantsearch
commit: |
d420bf0 to
61738c6
Compare
| }); | ||
| if (containersToRemove.length > 0) { | ||
| // Deferred removal — same pattern as connectDynamicWidgets | ||
| setTimeout(() => parent.removeWidgets(containersToRemove), 0); |
There was a problem hiding this comment.
in dynamic widgets we have the connector being responsible for adding/removing the widgets, but in the end in react and vue we're not really using it and the logic is in the widget instead of the connector. Is that similar here, do you see a better approach?
There was a problem hiding this comment.
I'm not sure yet to be honest, I can keep that in mind once working on the react & vue widgets in the next PR.
but even if we end up with a similar approach (where in react and vue the logic is in the widget), this connector logic is still useful for the vanilla.js version, right?
There was a problem hiding this comment.
can be useful, but in retrospect I think I would have preferred the logic for the js widget to be all in the widget too. Depends what it looks like, the logic still may be easy to move.
There was a problem hiding this comment.
OK, the js widget is next step so I'll see if that approach works 🙂
Move storeRenderState from module-private in index.ts to render-args.ts so FeedContainer can reuse it in the feeds connector (Layer 2). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…dContainer Introduce indexWidgetTypes const and IndexWidgetType as single source of truth for index-like widget types. Update isIndexWidget, IndexWidgetDescription, BuiltinTypes, and BuiltinWidgetTypes to use them. Add 'ais.feeds' and 'ais.feedContainer' to builtin type unions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The metadata middleware hardcoded 'ais.index' instead of using isIndexWidget, so widgets inside feed containers were invisible to the Algolia Crawler metadata. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Made-with: Cursor
…tions Made-with: Cursor
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
61738c6 to
89f8509
Compare
Summary
Layer 2 of the Multifeed Composition Support (RFC). Stacked on
feat/composition-multifeed-layer1-helper(PR #6954).connectFeedsconnector: followsconnectDynamicWidgetspattern — validatescompositionID, creates/reuses/removesFeedContainerwidgets per feed, supportstransformFeedsfor reordering/filtering, single-feed backward compatFeedContainer: implementsIndexWidgetwith$$type: 'ais.feedContainer',_isolated: true. Reads per-feed results fromparentIndex.getResults().feedsbyfeedID. Shares parent helper, delegates URL/search to parent, propagates child widget lifecycleindexWidgetTypes: single source of truth (const + type) for index-like widget types, used byisIndexWidget,IndexWidgetDescription,BuiltinTypes,BuiltinWidgetTypesstoreRenderStateextraction: moved from module-private inindex.tsto shared util inrender-args.tsisIndexWidget()instead of hardcoded'ais.index'check — crawler now sees widgets inside feed containers (separate commit for cherry-pick)Key design decisions
searchScope: 'global'required — future-proofing for per-feed search parameters (see RFC)walkIndexfinds them (needed for SSR),addWidgetstriggersscheduleSearch(includes facet declarations from child widgets)setTimeout(() => parent.removeWidgets(...), 0), same asconnectDynamicWidgetsTest plan
yarn workspace instantsearch.js tsc --noEmit— no new errorsyarn workspace algoliasearch-helper test— 456 pass🤖 Generated with Claude Code