From 8484e647700220085f8e246eeb2dbc06cc0c62c0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 8 Aug 2024 00:41:32 +0530 Subject: [PATCH] feat: getList & getList ref --- src/components/atoms/canvas.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/atoms/canvas.tsx b/src/components/atoms/canvas.tsx index e9ca1c80..cbef98c2 100644 --- a/src/components/atoms/canvas.tsx +++ b/src/components/atoms/canvas.tsx @@ -27,8 +27,9 @@ const Canvas = ({ width, height, onCreateRef }: CanvasProps) => { const canvasRef = useRef(null); const { socket } = useSocketStore(); const { setLastAction, lastAction } = useGlobalInfoStore(); - const { getText } = useActionContext(); + const { getText, getList } = useActionContext(); const getTextRef = useRef(getText); + const getListRef = useRef(getList); const notifyLastAction = (action: string) => { if (lastAction !== action) { @@ -40,7 +41,8 @@ const Canvas = ({ width, height, onCreateRef }: CanvasProps) => { useEffect(() => { getTextRef.current = getText; - }, [getText]); + getListRef.current = getList; + }, [getText, getList]); const onMouseEvent = useCallback((event: MouseEvent) => { if (socket) {