Skip to content

Commit

Permalink
fix: modified dependencies of useLayoutEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
Riku-KANO committed Apr 13, 2024
1 parent f9167bf commit 1d84be8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/RoundedBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ export const RoundedBox: ForwardRefComponent<Props, Mesh> = /* @__PURE__ */ Reac

const geomRef = React.useRef<RoundedBoxGeometry>(null!)

const args = React.useMemo(() => [width, height, depth, segments, radius], [width, height, depth, segments, radius])

React.useLayoutEffect(() => {
if (geomRef.current) {
geomRef.current.center()
toCreasedNormals(geomRef.current, creaseAngle)
}
}, [geomRef])

const args = React.useMemo(() => [width, height, depth, segments, radius], [width, height, depth, segments, radius])
}, [args])

return (
<mesh ref={ref} {...rest}>
Expand Down

0 comments on commit 1d84be8

Please sign in to comment.