Skip to content

Commit 36a3507

Browse files
committed
fix missing effect constructor properties
1 parent 2a78d95 commit 36a3507

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/util.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,38 @@ export type EffectProps<T extends EffectConstructor> = ReactThreeFiber.Node<
2121
let i = 0
2222
const components = new WeakMap<EffectConstructor, React.ExoticComponent<any> | string>()
2323

24-
export const wrapEffect = <T extends EffectConstructor, P extends EffectProps<T> = EffectProps<T>>(
24+
export const wrapEffect = <T extends EffectConstructor>(
2525
effect: T,
26-
defaults?: P
27-
) =>
28-
/* @__PURE__ */ React.forwardRef<T, P>(function Effect(
29-
{ blendFunction = defaults?.blendFunction, opacity = defaults?.opacity, ...props },
30-
ref
26+
defaults?: EffectProps<T>
27+
) =>
28+
/* @__PURE__ */ React.forwardRef<T, EffectProps<T>>(function Effect(
29+
{ blendFunction = defaults?.blendFunction, opacity = defaults?.opacity, ...props },
30+
ref
3131
) {
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-
)
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+
)
5656
})
5757

5858
export const useVector2 = (props: Record<string, unknown>, key: string): THREE.Vector2 => {

0 commit comments

Comments
 (0)