Skip to content

🎥 Make videos programmatically with React

Update ThreeCanvas.tsx

Jonny Burgerb46ed94ae51c
diff --git a/packages/three/src/ThreeCanvas.tsx b/packages/three/src/ThreeCanvas.tsx
index 9c6e4ba280..3af4089c68 100644
--- a/packages/three/src/ThreeCanvas.tsx
+++ b/packages/three/src/ThreeCanvas.tsx
@@ -142,66 +142,3 @@ function useCreateRemotionThreeContext() {
);
return [threeDomNodesWrapper, remotionThreeContext] as const;
}
-
-// Alternative implementation which does not directly call ReactDOM.render.
-// It causes huge lags right now, however it would allow using all contexts present in the canvas scope
-// Should be evaluated again
-
-// function useCreateRemotionThreeContext() {
-// const isMountedRef = React.useRef(true);
-// React.useEffect(() => () => {
-// isMountedRef.current = false;
-// }, []);
-
-// const [threeDomNodes, setThreeDomNodes] = React.useState<React.ReactElement[]>([]);
-
-// const remotionThreeContext = React.useState<RemotionThreeContextType>(() => ({
-// useDomNode: node => {
-// const _remotionContexts = Internals.useRemotionContexts();
-
-// // Generate static, unique key
-// const key = React.useState(() => String(Math.random()))[0];
-
-// React.useEffect(() => {
-// // Updating threeDomNodes has to happen outside the react-three render loop, so use a timeout
-// setTimeout(() => {
-// // Only perform update, if the ThreeCanvas is still mounted
-// if (isMountedRef.current) {
-// const finalNode = (
-// <Internals.RemotionContextProvider key={key} contexts={_remotionContexts}>
-// {node}
-// </Internals.RemotionContextProvider>
-// );
-// // Append to nodes array
-// setThreeDomNodes(sn => sn.filter(x => x.key !== key).concat(finalNode));
-// }
-// });
-// });
-
-// React.useEffect(() => () => {
-// setTimeout(() => {
-// // Only perform unmount, if the ThreeCanvas is still mounted
-// if (isMountedRef.current) {
-// // Remove from nodes array
-// setThreeDomNodes(sn => sn.filter(x => x.key !== key));
-// }
-// });
-// }, []); // eslint-disable-line react-hooks/exhaustive-deps
-// }
-// }))[0];
-
-// const threeDomNodesWrapper = (
-// <div
-// style={{
-// position: 'absolute',
-// top: 0,
-// left: 0,
-// overflow: 'hidden',
-// visibility: 'hidden'
-// }}
-// >
-// {threeDomNodes}
-// </div>
-// );
-// return [threeDomNodesWrapper, remotionThreeContext] as const;
-// }