({ onSelect }: { onSelect: Function })
| 7 | const colors = ['orange', 'hotpink', 'cyan', 'lime', 'yellow', 'red', 'blue', 'purple', 'green', 'coral'] |
| 8 | |
| 9 | function SceneA({ onSelect }: { onSelect: Function }) { |
| 10 | const ref = useRef<Mesh>(null) |
| 11 | const [scale, setScale] = useState(1) |
| 12 | const [color, setColor] = useState(colors[0]) |
| 13 | |
| 14 | // Stable event handler using the new React 19.2 API |
| 15 | const handleSelect = useEffectEvent(() => onSelect()) |
| 16 | |
| 17 | useFrame((_, dt) => { |
| 18 | if (ref.current) ref.current.rotation.y += dt * 1.2 |
| 19 | }) |
| 20 | |
| 21 | return ( |
| 22 | <mesh |
| 23 | ref={ref} |
| 24 | scale={scale} |
| 25 | position={[-1.5, 0, 0]} |
| 26 | onClick={handleSelect} |
| 27 | onPointerOver={() => { |
| 28 | setScale(1.2) |
| 29 | setColor(colors[Math.floor(Math.random() * colors.length)]) |
| 30 | }} |
| 31 | onPointerOut={() => setScale(1)}> |
| 32 | <boxGeometry /> |
| 33 | <meshStandardMaterial color={color} /> |
| 34 | </mesh> |
| 35 | ) |
| 36 | } |
| 37 | |
| 38 | const dracoLoader = new DRACOLoader() |
| 39 | dracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.5/') |
nothing calls this directly
no test coverage detected
searching dependent graphs…