React-sortable-tree: bad for react17+

Created on 14 Jan 2021  Â·  7Comments  Â·  Source: frontend-collective/react-sortable-tree

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+

All 7 comments

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

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?

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

821 you can check this thread, there is a workaround

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.

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xmhscratch picture xmhscratch  Â·  5Comments

29er picture 29er  Â·  5Comments

mcolburn picture mcolburn  Â·  4Comments

anushkadoyan picture anushkadoyan  Â·  4Comments

LogicMonsters picture LogicMonsters  Â·  5Comments