'use client' import dynamic from 'next/dynamic' import React, { useEffect, useRef } from 'react' import { useDispatch } from 'react-redux' import ToolingOverlay from './ToolingOverlay' import { setSize } from '../../redux/features/stage/stageSlice' const CanvasStage = dynamic(() => import('./CanvasStage'), { ssr: false }) const DocumentCanvas = () => { const dispatch = useDispatch() const thisRef = useRef(null) const handleWindowResize = () => { const width = thisRef?.current?.clientWidth || 0 const height = thisRef?.current?.clientHeight || 0 dispatch(setSize({ width, height })) } useEffect(() => { handleWindowResize() window.addEventListener('resize', handleWindowResize) return () => window.removeEventListener('resize', handleWindowResize) }, [thisRef?.current?.clientWidth, thisRef?.current?.clientHeight]) return
} export default DocumentCanvas