fix missing key

This commit is contained in:
Brian Beck 2025-11-14 19:09:07 -08:00
parent d925585a34
commit 507ddf8d49
3 changed files with 17 additions and 4 deletions

View file

@ -33,7 +33,7 @@ function ShapeModel({ shapeName }: { shapeName: string }) {
!node.material || !node.material.name.match(/\.\d+$/)
)
.map(([name, node]: [string, any]) => (
<mesh geometry={node.geometry} castShadow receiveShadow>
<mesh key={node.id} geometry={node.geometry} castShadow receiveShadow>
<meshStandardMaterial color="cyan" wireframe />
</mesh>
))}

View file

@ -34,7 +34,7 @@ function ShapeModel({ shapeName }: { shapeName: string }) {
!node.material || !node.material.name.match(/\.\d+$/)
)
.map(([name, node]: [string, any]) => (
<mesh geometry={node.geometry} castShadow receiveShadow>
<mesh key={node.id} geometry={node.geometry} castShadow receiveShadow>
<meshStandardMaterial color="cyan" wireframe />
</mesh>
))}

View file

@ -19,9 +19,22 @@ function useStaticShape(shapeName: string) {
}
function ShapeModel({ shapeName }: { shapeName: string }) {
const { scene } = useStaticShape(shapeName);
const { nodes } = useStaticShape(shapeName);
return <primitive object={scene} />;
return (
<>
{Object.entries(nodes)
.filter(
([name, node]: [string, any]) =>
!node.material || !node.material.name.match(/\.\d+$/)
)
.map(([name, node]: [string, any]) => (
<mesh key={node.id} geometry={node.geometry} castShadow receiveShadow>
<meshStandardMaterial color="cyan" wireframe />
</mesh>
))}
</>
);
}
function ShapePlaceholder({ color }: { color: string }) {