Skip to content

Commit ac998f6

Browse files
committed
lint
1 parent 36a3507 commit ac998f6

File tree

2 files changed

+28
-32
lines changed

2 files changed

+28
-32
lines changed

src/effects/GodRays.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { GodRaysEffect } from 'postprocessing'
2-
import React, { Ref, forwardRef, useMemo, useContext } from 'react'
2+
import React, { Ref, forwardRef, useMemo, useContext, useLayoutEffect } from 'react'
33
import { Mesh, Points } from 'three'
44
import { EffectComposerContext } from '../EffectComposer'
5-
import { useLayoutEffect } from 'react'
65
import { resolveRef } from '../util'
76

87
type GodRaysProps = ConstructorParameters<typeof GodRaysEffect>[2] & {

src/util.tsx

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,35 @@ 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>(
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

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

0 commit comments

Comments
 (0)