fix(useColumnsAutoSize): support React 17 by lazy-loading react-dom/client#154
Merged
Conversation
…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>
Contributor
|
Preview is ready. |
kseniya57
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
createRootvalue import fromreact-dom/clientwas pulled in transitively from the package entry (index.ts -> hooks -> useColumnsAutoSize -> useMeasureCellWidth). Thereact-dom/clientsubpath 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.0peer range.Resolve
createRootlazily via dynamic import and fall back to the legacyReactDOM.render/unmountComponentAtNodeAPI on React 17. The legacy path only runs on 17 (where it is the correct, warning-free API), while React 18+ keeps usingreact-dom/clientwith no deprecation warnings and stays forward-compatible with React 19.