Skip to content

fix(react): shim useId#6872

Merged
Haroenv merged 2 commits intomasterfrom
fix/shim-use-id
Feb 26, 2026
Merged

fix(react): shim useId#6872
Haroenv merged 2 commits intomasterfrom
fix/shim-use-id

Conversation

@Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jan 22, 2026

Summary

For now just a wip, as it needs to be tested out.

useId was introduced in react 18, but we have react 16 support. Therefore we should shim React.useId

Result

fixes #6871

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 22, 2026

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 4368e8a:

Sandbox Source
example-instantsearch-getting-started Configuration
example-react-instantsearch-getting-started Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-react-instantsearch-next-routing-example Configuration
example-vue-instantsearch-getting-started Configuration

@Haroenv Haroenv requested review from a team, aymeric-giraudet and shaejaz and removed request for a team February 19, 2026 18:11
@Haroenv Haroenv marked this pull request as ready for review February 19, 2026 18:12
Copy link
Member

@aymeric-giraudet aymeric-giraudet left a comment

Choose a reason for hiding this comment

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

iirc useId was for server side rendering to avoid hydration issues. (it generates the ID on server and hydrates on client)
Since Autocomplete does not need SSR, we could also generate IDs with something else like crypto ?

@Haroenv
Copy link
Contributor Author

Haroenv commented Feb 20, 2026

Won't the input still be rendered in server side rendering @aymeric-giraudet?

@Haroenv Haroenv merged commit 90d1324 into master Feb 26, 2026
14 checks passed
@Haroenv Haroenv deleted the fix/shim-use-id branch February 26, 2026 09:17
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.

Autocomplete widget requires React 18 but peerDependencies allow 16.8+

2 participants