Skip to content

Commit

Permalink
Add dependency list to useAfterRender
Browse files Browse the repository at this point in the history
Allow update of useAfterRender Observable
  • Loading branch information
dennemark authored Nov 17, 2022
1 parent 34105d0 commit c9e523c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/react-babylonjs/src/hooks/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export const useAfterRender = (
callback: OnFrameRenderFn,
mask?: number,
insertFirst?: boolean,
callOnce?: boolean
callOnce?: boolean,
deps: React.DependencyList = []
): void => {
const { scene } = useContext(SceneContext)

Expand All @@ -79,5 +80,5 @@ export const useAfterRender = (
scene.onAfterRenderObservable.remove(sceneObserver)
}
}
})
}, [scene, ...deps])
}

0 comments on commit c9e523c

Please sign in to comment.