Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - DragDropSort - crash if root div doesn't exists #11566

Open
jpinsonneau opened this issue Feb 25, 2025 · 0 comments
Open

Bug - DragDropSort - crash if root div doesn't exists #11566

jpinsonneau opened this issue Feb 25, 2025 · 0 comments

Comments

@jpinsonneau
Copy link

Describe the problem
DragDropSort is crashing if your react app doesn't rely on a root div.

Error
Target container is not a DOM element.
▼ 16 stack frames were expanded.
Object.createPortal$1 [as createPortal]
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:29829:11
    at DragDropContainer (https://ncttqv.csb.app/node_modules/
patternfly/react-drag-drop/dist/esm/components/DragDrop/DragDropContainer.js:180:71
renderWithHooks
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:15486:18
mountIndeterminateComponent
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:20103:13
beginWork
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:21626:16
HTMLUnknownElement.callCallback
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:4164:14
Object.invokeGuardedCallbackDev
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:4213:16
invokeGuardedCallback
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:4277:31
beginWork$1
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:27490:7
performUnitOfWork
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:26596:12
workLoopSync
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:26505:5
renderRootSync
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:26473:7
performConcurrentWorkOnRoot
https://ncttqv.csb.app/node_modules/react-dom/cjs/react-dom.development.js:25777:74
workLoop
https://ncttqv.csb.app/node_modules/scheduler/cjs/scheduler.development.js:266:34
flushWork
https://ncttqv.csb.app/node_modules/scheduler/cjs/scheduler.development.js:239:14
MessagePort.performWorkUntilDeadline
https://ncttqv.csb.app/node_modules/scheduler/cjs/scheduler.development.js:533:21

How do you reproduce the problem?
Open https://codesandbox.io/p/sandbox/boring-fire-ncttqv to reproduce
Compare with https://codesandbox.io/p/sandbox/vntvty as working example

Expected behavior
App should not crash.
Component should display a proper error message.
Id could be passed as prop to let users overriding it.

Is this issue blocking you?
Not yet as I'm not planning to migrate to PF6 now.

However, note than a lot of react app were created using app div as root.
OCP Console is still using app for example: https://github.com/openshift/console/blob/release-4.19/frontend/public/index.html#L73-L77

Screenshots

Image

Image

What is your environment?
All environments affected

What is your product and what release date are you targeting?
Netobserv, alongside OCP 4.19+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant