pmndrs / gltfjsx

🎮 Turns GLTFs into JSX components
https://gltf.pmnd.rs
MIT License
4.46k stars 290 forks source link

Warning: Encountered two children with the same key, ` in App`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version. #59

Open ghost opened 3 years ago

ghost commented 3 years ago

when i run > npx gltfjsx models/gltf/xbot.glb --root public/ --verbose`

i get this error

arning: Encountered two children with the same key, `    in App`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
    in ink-box (created by Box)
    in Box (created by ErrorOverview)
    in ink-box (created by Box)
    in Box (created by ErrorOverview)
    in ErrorOverview (created by InternalApp)
    in InternalApp

  ERROR  Objects are not valid as a React child (found: Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
        1. You might have mismatching versions of React and the renderer (such as React DOM)
        2. You might be breaking the Rules of Hooks
        3. You might have more than one copy of React in the same app
        See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.). If you meant to render a collection of children, use an array instead.
            in ink-text (created by Text)
            in Text
            in ink-box (created by Box)
            in Box
            in App
            in App
            in InternalApp

 - 1. You might have mismatching versions of React and the renderer (such as React DOM)
 - 2. You might be breaking the Rules of Hooks
 - 3. You might have more than one copy of React in the same app
 - See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.). If you meant to render a collection of children, use an array instead.
 -     in ink-text (created by Text)
 -     in Text
 -     in ink-box (created by Box)
 -     in Box
 -     in App
 -     in App
 -     in InternalApp
 - throwOnInvalidObjectType (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:4524:15)
 - createChild (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:4757:7)
 - reconcileChildrenArray (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:5008:25)
 - reconcileChildFibers (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:5374:14)
 - reconcileChildren (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:7865:28)
 - updateHostComponent (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:8387:3)
 - beginWork$1 (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:9969:14)
 - Object.invokeGuardedCallbackImpl (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:11563:10)
 - invokeGuardedCallback (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:11740:31)
 - beginWork$$1 (node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:15778:7)
drcmda commented 3 years ago

could you append the glb?

ghost commented 3 years ago

https://github.com/mrdoob/three.js/blob/dev/examples/models/gltf/Xbot.glb its this one, just one of the standard threejs gltf models

drcmda commented 3 years ago

cant reproduce unfortunately, runs through here :-(

SiegeSailor commented 3 years ago

I am also encountering the same problem when executing the same command with the model in this codesandbox public/stacy.glb.

ghost commented 3 years ago

@drcmda i will do some work and put together a PR to try and make the error message less cryptic. let me know if you can provide any context / pointers otherwise ill get started on it later tonight. thank you :)

drcmda commented 3 years ago

awesome! good luck also, i still can't reproduce :-(

SiegeSailor commented 3 years ago

After a few tests, I found out that the error I was encountering was because I installed the package locally. Everything is working well when I install it globally.

Pringels commented 3 years ago

I can confirm. Got the same error when running locally, where installing globally fixed it.