@@ -21,38 +21,35 @@ export type EffectProps<T extends EffectConstructor> = ReactThreeFiber.Node<
2121let i = 0
2222const components = new WeakMap < EffectConstructor , React . ExoticComponent < any > | string > ( )
2323
24- export const wrapEffect = < T extends EffectConstructor > (
25- effect : T ,
26- defaults ?: EffectProps < T >
27- ) =>
24+ export const wrapEffect = < T extends EffectConstructor > ( effect : T , defaults ?: EffectProps < T > ) =>
2825 /* @__PURE__ */ React . forwardRef < T , EffectProps < T > > ( function Effect (
29- { blendFunction = defaults ?. blendFunction , opacity = defaults ?. opacity , ...props } ,
30- ref
26+ { blendFunction = defaults ?. blendFunction , opacity = defaults ?. opacity , ...props } ,
27+ ref
3128 ) {
32- let Component = components . get ( effect )
33- if ( ! Component ) {
34- const key = `@react-three/postprocessing/${ effect . name } -${ i ++ } `
35- extend ( { [ key ] : effect } )
36- components . set ( effect , ( Component = key ) )
37- }
38-
39- const camera = useThree ( ( state ) => state . camera )
40- const args = React . useMemo (
41- ( ) => [ ...( ( defaults ?. args ?? [ ] ) as any [ ] ) , ...( ( props . args ?? [ { ...defaults , ...props } ] ) as any [ ] ) ] ,
42- // eslint-disable-next-line react-hooks/exhaustive-deps
43- [ JSON . stringify ( props ) ]
44- )
45-
46- return (
47- < Component
48- camera = { camera }
49- blendMode-blendFunction = { blendFunction }
50- blendMode-opacity = { opacity }
51- { ...props }
52- ref = { ref }
53- args = { args }
54- />
55- )
29+ let Component = components . get ( effect )
30+ if ( ! Component ) {
31+ const key = `@react-three/postprocessing/${ effect . name } -${ i ++ } `
32+ extend ( { [ key ] : effect } )
33+ components . set ( effect , ( Component = key ) )
34+ }
35+
36+ const camera = useThree ( ( state ) => state . camera )
37+ const args = React . useMemo (
38+ ( ) => [ ...( ( defaults ?. args ?? [ ] ) as any [ ] ) , ...( ( props . args ?? [ { ...defaults , ...props } ] ) as any [ ] ) ] ,
39+ // eslint-disable-next-line react-hooks/exhaustive-deps
40+ [ JSON . stringify ( props ) ]
41+ )
42+
43+ return (
44+ < Component
45+ camera = { camera }
46+ blendMode-blendFunction = { blendFunction }
47+ blendMode-opacity = { opacity }
48+ { ...props }
49+ ref = { ref }
50+ args = { args }
51+ />
52+ )
5653 } )
5754
5855export const useVector2 = ( props : Record < string , unknown > , key : string ) : THREE . Vector2 => {
0 commit comments