Skip to content

fix(useElementIds): improve fix for webpack analyzer#1677

Merged
silviuaavram merged 1 commit intomasterfrom
fix/safe-react-use-id
Feb 19, 2026
Merged

fix(useElementIds): improve fix for webpack analyzer#1677
silviuaavram merged 1 commit intomasterfrom
fix/safe-react-use-id

Conversation

@silviuaavram
Copy link
Collaborator

@silviuaavram silviuaavram commented Feb 19, 2026

Pull Request

What

Previous fix did not work. This one should.

Why

Fixes #1674

How

Check #1674 (comment)

Changes

Checklist

  • Documentation
  • Tests
  • TypeScript Types
  • Ready to be merged

Copilot AI review requested due to automatic review settings February 19, 2026 07:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to fix a webpack bundler issue where static analysis fails when building downshift with React 16/17 because it tries to resolve React.useId() which doesn't exist in those versions. The previous fix using bracket notation (React['useId']) apparently didn't work, so this PR proposes spreading the React object and accessing useId from the copy.

Changes:

  • Replace bracket notation access to React.useId with property access on a spread copy of the React object
  • Apply this pattern consistently across both useElementIds implementations (dropdown and tag group utilities)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/hooks/utils.dropdown/useElementIds.ts Replace React['useId'] with SafeReact.useId where SafeReact = {...React}
src/hooks/useTagGroup/utils/useElementIds.ts Replace React['useId'] with SafeReact.useId where SafeReact = {...React}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silviuaavram silviuaavram merged commit f1862ed into master Feb 19, 2026
10 checks passed
@silviuaavram silviuaavram deleted the fix/safe-react-use-id branch February 19, 2026 19:27
@github-actions
Copy link

🎉 This PR is included in version 9.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

React 16/17 compatibility broken in v9.1.0+ due to static analysis of React.useId()

2 participants