You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: dispose <primitive>-based effects, r3f never does it for them
r3f explicitly never auto-disposes objects rendered via <primitive
object={...}> ("their state may be kept outside of React"), regardless
of dispose={null}. Several effects that render this way had no cleanup
at all (ASCII, ColorAverage, SelectiveBloom, SSAO), so they leaked
their underlying postprocessing effect/texture on every unmount and
every prop change that recreates the instance. Added a small useDispose
hook (util.tsx) and wired it into every <primitive>-based effect, with
a WeakSet guard against double-dispose across StrictMode's dev-only
mount/cleanup/mount cycle.
Also fixes GodRays, which was declared as (props, ref) without
forwardRef - under React 19 that ref parameter is never populated, so
consumers passing a ref to GodRays silently got nothing.
ChromaticAberration moves off wrapEffect onto the same manual
construct-and-dispose pattern so its tuple `offset` prop coerces
through useVector2 like the other vector-typed effects; test locks in
that coercion.
Adds the ColorAverage dispose coverage to EffectComposer.test.tsx that
the previous commit's suite deferred here, since ColorAverage didn't
dispose itself until this fix landed.
0 commit comments