Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix(hooks-web): fix duplicated key in <CurrentRefinements> #3513

Merged

Conversation

francoischalifour
Copy link
Member

When you use multiple <Index> widgets with widgets with the same attribute, and then refine both these widgets, the <CurrentRefinements> displays a React key warning because the keys are identical.

This adds the index name to the label key to have unique keys.

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6ba7e38:

Sandbox Source
algolia/create-instantsearch-app Configuration
hooks-example Configuration

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with a transformItems I think there could be other reasons to end up with a double label, but that's less likely to be on purpose. LGTM!

Looks like InstantSearch.js is also susceptible to the same warning: https://github.com/algolia/instantsearch.js/blob/master/src/components/CurrentRefinements/CurrentRefinements.tsx#L20-L29

@netlify
Copy link

netlify bot commented Jun 13, 2022

Deploy Preview for react-instantsearch ready!

Name Link
🔨 Latest commit 6ba7e38
🔍 Latest deploy log https://app.netlify.com/sites/react-instantsearch/deploys/62a6f3538b0b0b0009237ca6
😎 Deploy Preview https://deploy-preview-3513--react-instantsearch.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@francoischalifour francoischalifour enabled auto-merge (squash) June 13, 2022 08:26
@francoischalifour francoischalifour merged commit fc94d80 into master Jun 13, 2022
@francoischalifour francoischalifour deleted the fix/hooks-web-CurrentRefinements-duplicated-keys branch June 13, 2022 08:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants