Skip to content

fix(useColumnsAutoSize): support React 17 by lazy-loading react-dom/client#154

Merged
beliarh merged 1 commit into
mainfrom
fix/react-17-compat
Jun 3, 2026
Merged

fix(useColumnsAutoSize): support React 17 by lazy-loading react-dom/client#154
beliarh merged 1 commit into
mainfrom
fix/react-17-compat

Conversation

@beliarh
Copy link
Copy Markdown
Collaborator

@beliarh beliarh commented Jun 3, 2026

The createRoot value import from react-dom/client was pulled in transitively from the package entry (index.ts -> hooks -> useColumnsAutoSize -> useMeasureCellWidth). The react-dom/client subpath does not exist in React 17, so in the CJS build this broke any import from the package on React 17 at module load time - not just usage of the experimental auto-size hook - contradicting the declared ^17.0.0 || ^18.0.0 peer range.

Resolve createRoot lazily via dynamic import and fall back to the legacy ReactDOM.render / unmountComponentAtNode API on React 17. The legacy path only runs on 17 (where it is the correct, warning-free API), while React 18+ keeps using react-dom/client with no deprecation warnings and stays forward-compatible with React 19.

…lient

The `createRoot` value import from `react-dom/client` was pulled in
transitively from the package entry (index.ts -> hooks -> useColumnsAutoSize
-> useMeasureCellWidth). The `react-dom/client` subpath does not exist in
React 17, so in the CJS build this broke any import from the package on
React 17 at module load time - not just usage of the experimental
auto-size hook - contradicting the declared `^17.0.0 || ^18.0.0` peer range.

Resolve `createRoot` lazily via dynamic import and fall back to the legacy
`ReactDOM.render` / `unmountComponentAtNode` API on React 17. The legacy
path only runs on 17 (where it is the correct, warning-free API), while
React 18+ keeps using `react-dom/client` with no deprecation warnings and
stays forward-compatible with React 19.

Co-authored-by: Cursor <cursoragent@cursor.com>
@beliarh beliarh requested a review from kseniya57 as a code owner June 3, 2026 09:30
@gravity-ui-bot
Copy link
Copy Markdown
Contributor

Preview is ready.

@beliarh beliarh merged commit 70f9996 into main Jun 3, 2026
3 checks passed
@beliarh beliarh deleted the fix/react-17-compat branch June 3, 2026 21:20
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.

3 participants