lukasbach / react-complex-tree

Unopinionated Accessible Tree Component with Multi-Select and Drag-And-Drop
https://rct.lukasbach.com
MIT License
952 stars 77 forks source link

continue to support older versions of React #196

Closed dlech closed 1 year ago

dlech commented 1 year ago

Is your feature request related to a problem? Please describe. Much of the world is stuck on older versions of React (v16.8+) and can't upgrade because of other dependencies.

Describe the solution you'd like For this library to continue to support older versions of React so we can take advantage of the latest fixes and performance improvements.

lukasbach commented 1 year ago

Hi, thanks for the report. What issues are you facing when trying to use rct with older versions of react, is it just a warning because of the peer dependency or are there build-time or runtime errors? I upgraded the peer dep since rct is technically using react 18, but actually I think there is no usage of 18-only features, so I might be able to reduce the peer dependency.

If there are other issues from incompatibility, I'm actually not sure what options there are to support two versions of react in a library.

dlech commented 1 year ago

Typing to trigger the search crashes at runtime with:

Uncaught TypeError: el.focus is not a function
    at ref (SearchInput.js:72:1)
    at commitAttachRef (react-dom.development.js:20023:1)
    at commitLayoutEffects (react-dom.development.js:22808:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237:1)
    at invokeGuardedCallback (react-dom.development.js:292:1)
    at commitRootImpl (react-dom.development.js:22541:1)
    at unstable_runWithPriority (scheduler.development.js:653:1)
    at runWithPriority$1 (react-dom.development.js:11039:1)
    at commitRoot (react-dom.development.js:22381:1)

So I suppose this could just be a bug and may not be a React version compatibility issue.

Maybe there is a way to run the test suite with each major version of React just to be safe?

dlech commented 1 year ago

So I suppose this could just be a bug and may not be a React version compatibility issue.

Actually, now that I have dug into this more, I see it is not a bug in react-complex-tree but how I am using it (v2.0.0 added a ref property to inputProps for the search input which needs special handling for the component I am using it with).

lukasbach commented 1 year ago

Okay. I reduced the peer dependency of react to 16, I think it should work for that anyway as well.

Maybe there is a way to run the test suite with each major version of React just to be safe?

I played around with that today, but turns out that, while rct is not dependent on changes from react 16 -> react 18, the tests unfortunately are.. Anyway, CI now at least builds the library on react 16 through 18, but tests are only done on 18.

Since there doesn't seem to be any issues with this for now, I'll close this issue.