From f676151edf74bbca6712d9246df3cbe14e77738d Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Thu, 14 Dec 2023 09:20:06 -0500 Subject: [PATCH] fix bug with preview not updating immediately --- frontend/src/components/Preview.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Preview.tsx b/frontend/src/components/Preview.tsx index 24f33c0..42cc7b0 100644 --- a/frontend/src/components/Preview.tsx +++ b/frontend/src/components/Preview.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef } from 'react'; +import { useEffect, useRef } from "react"; import classNames from "classnames"; import useThrottle from "../hooks/useThrottle"; @@ -8,7 +8,9 @@ interface Props { } function Preview({ code, device }: Props) { - const throttledCode = useThrottle(code, 200); + const throttledCode = code; + // Temporary disable throttling for the preview not updating when the code changes + // useThrottle(code, 200); const iframeRef = useRef(null); useEffect(() => { @@ -39,4 +41,4 @@ function Preview({ code, device }: Props) { ); } -export default Preview; \ No newline at end of file +export default Preview;