Repository navigation
Conversation
Transform the selection items exposed in the render state. compare() sends the transformed items to the agent, so what the bar shows is what the agent receives. The selection, counts and limits keep working on the raw items. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 17 |
TIP This summary will be updated as you push new changes.
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: |
|
Size Change: +147 B (+0.01%) Total Size: 1.04 MB 📦 View Changed
ℹ️ View Unchanged
|
This branch has not been deployed
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.
Summary
Adds a
transformItemsoption to thecompareconnector (and so to thecompareBarwidget,useCompareand<CompareBar>) to trim or reshape the selection, for example to drop long descriptions.Result
transformItems?: TransformItems<CompareItem>, i.e.(items: CompareItem[], metadata: { results: SearchResults | undefined | null }) => CompareItem[], defaulting to identity.itemsexposed in the render state, andcompare()sends the transformed items asselected_products, so what the bar shows is what the agent receives. The_-prefixed keys are still stripped from the payload after the transform.isSelected,addItem,removeItem,canAddItems,canCompareand theminItems/maxItemslimits work on the raw selection, so a transform must map items one to one (no adding or removing) and keep eachobjectID.compare()applies the transform of the widget it is called from, normally thecompareBar.compareBarand<CompareBar>/useComparealready forward the connector params, so no wrapper changes were needed. There is no Vue flavor for compare, and there is no common connector suite for compare onmaster, so tests are connector-level plus a<CompareBar>test.🤖 Generated with Claude Code