react-sortable-tree icon indicating copy to clipboard operation
react-sortable-tree copied to clipboard

bad for react17+

Open liwei8 opened this issue 4 years ago • 7 comments

Reporting a Bug?

Please include either a failing unit test or a simple reproduction. You can start by forking the CodeSandbox example

There was an error , when react 17+ react-dom17+

liwei8 avatar Jan 14 '21 08:01 liwei8

Yep, just started getting the following error after upgrading to React 17:

Unable to find node on an unmounted component.

Seems like it can't find .root?

https://codesandbox.io/s/upbeat-lovelace-bstd2?file=/src/App.js

mmvcode avatar Jan 15 '21 14:01 mmvcode

Same for me:

├── UNMET PEER DEPENDENCY [email protected] └─┬ [email protected] └─┬ [email protected] └── [email protected]

npm ERR! peer dep missing: react@^16.3.0, required by [email protected]

Any workaround?

crazyhtm avatar Jan 22 '21 18:01 crazyhtm

+1! Can this be updated to be compatible with React 17?

umberto-sonnino avatar Jan 24 '21 13:01 umberto-sonnino

#821 you can check this thread, there is a workaround

nhat-tr avatar Jan 29 '21 11:01 nhat-tr

For what it's worth, older versions of this package seem to cooperate better with React 17. I'm using "react-sortable-tree": "^1.8.1" and it appears to be working.

fleebeee avatar Feb 04 '21 18:02 fleebeee

The workarounds in #821 didn't work for me.

Not sure if this package is abandoned, but there's a fork on NPM that's updated for React 17: https://www.npmjs.com/package/react-sortable-tree-patch-react-17

arcataroger avatar Jun 18 '21 17:06 arcataroger

Hi guys,

I fixed the issues with React 17 and created a separate package.

You can install it using

yarn add @nosferatu500/react-sortable-tree

But it does not include types for typescript. you can workaround with it:

  • create decs.d.ts file and place it with tsconfig.json
  • add declare module @nosferatu500/react-sortable-tree to decs.d.ts file
  • in tsconfig.json change
"include": [
  "src"
  ]

to

"include": [
  "src",
  "decs.d.ts"
  ]

I am not planning any new features or any other updates (only bug fixes and only if it block my own work), but if you want to improve something, you can send me the PR to me https://github.com/nosferatu500/react-sortable-tree and I will merge it.

nosferatu500 avatar Jun 23 '21 02:06 nosferatu500