algolia / react-instantsearch

⚡️ Lightning-fast search for React and React Native applications, by Algolia.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/react/
MIT License
1.97k stars 386 forks source link

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

Closed francoischalifour closed 2 years ago

francoischalifour commented 2 years ago

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[bot] commented 2 years ago

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 6ba7e3828470a37adedb5198b5f55454e9b4dbbc:

Sandbox Source
algolia/create-instantsearch-app Configuration
hooks-example Configuration
francoischalifour commented 2 years ago

@Haroenv In InstantSearch.js, we do prefix it with the index name: https://github.com/algolia/instantsearch.js/blob/80ca07e29064357343ee997be94ef10beadba637/src/components/CurrentRefinements/CurrentRefinements.tsx?rgh-link-date=2022-06-13T08%3A24%3A33Z#L45

netlify[bot] commented 2 years ago

Deploy Preview for react-instantsearch ready!

Name Link
Latest commit 6ba7e3828470a37adedb5198b5f55454e9b4dbbc
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.