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

🐛 EffectComposer throws "Cannot read properties of undefined (reading 'length')" error #311

Closed
Mojtaba-amirii opened this issue Jan 10, 2025 · 1 comment

Comments

@Mojtaba-amirii
Copy link

Mojtaba-amirii commented Jan 10, 2025

Environment

  • React version: 19.0.0
  • Next version: 15.1.4
  • three version: 0.172.0
  • @react-three/fiber version: 9.0.0-rc.2
  • @react-three/drei version: 9.120.6
  • node version: v23.4.0
  • npm version: 10.9.2

Problem description:

When using the EffectComposer component from drei, I'm encountering a "Cannot read properties of undefined (reading 'length')" error. This error occurs in the useLayoutEffect hook of the EffectComposer component. The current behavior is problematic because it prevents the EffectComposer from initializing properly and applying post-processing effects to the scene.

Actuall Behavior

The application throws the following error:

EffectComposer.tsx:141 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at EffectComposer.useLayoutEffect (EffectComposer.tsx:141:40)

Steps to Reproduce

  1. Create a React Three Fiber scene
  2. Add an EffectComposer component to the scene
  3. Render the scene

Code Example

import React from 'react'
import { Canvas } from '@react-three/fiber'
import { EffectComposer } from '@react-three/postprocessing'

function Scene() {
  return (
    <Canvas>
      <mesh>
        <boxGeometry />
        <meshStandardMaterial />
      </mesh>
      <EffectComposer>
        {/* Your effects here */}
      </EffectComposer>
    </Canvas>
  )
}
@Mojtaba-amirii Mojtaba-amirii changed the title Title: 🐛 EffectComposer throws "Cannot read properties of undefined (reading 'length')" error 🐛 EffectComposer throws "Cannot read properties of undefined (reading 'length')" error Jan 10, 2025
@chrisweb
Copy link

@Mojtaba-amirii duplicate: #301

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

No branches or pull requests

2 participants