leva icon indicating copy to clipboard operation
leva copied to clipboard

"Maximum update depth exceeded" when changing values

Open d3ttl4ff opened this issue 5 months ago • 0 comments

Hi! I'm trying to use leva on my react-three projects but it throws this error when i try to change a value. Screenshot 2024-09-20 134242

Here's a simple code I did

import { useControls } from 'leva';

const Base = () => {
 const { position, scale, color } = useControls({
   position: { value: { x: -2, y: 0 }, step: 0.01, joystick: 'invertY' },
   scale: { value: 1, min: 0, max: 5, step: 0.001 },
   color: '#ff0000',
 });

 return (
   <>
     <mesh position={[position.x, position.y, 0]} scale={scale}>
       <sphereGeometry />
       <meshStandardMaterial color={color} />
     </mesh>

     <mesh position-x={2} scale={1.5}>
       <boxGeometry />
       <meshStandardMaterial color="mediumpurple" />
     </mesh>

     <mesh position-y={-1} rotation-x={-Math.PI * 0.5} scale={10}>
       <planeGeometry />
       <meshStandardMaterial color="greenyellow" />
     </mesh>
   </>
 );
};

export default Base;

In my case it only happens on the position value changes. Scale, Color are working fine without an error. But whenever I try to move the object using the tweaks it throws the error and starts to lag with a significant framerate drop. Does anyone know why this is happening and any possible fixes?

d3ttl4ff avatar Sep 20 '24 08:09 d3ttl4ff