Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

fix bug with preview not updating immediately

Abi Rajaf676151edf74
diff --git a/frontend/src/components/Preview.tsx b/frontend/src/components/Preview.tsx
index 24f33c00..42cc7b06 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<HTMLIFrameElement | null>(null);
useEffect(() => {
@@ -39,4 +41,4 @@ function Preview({ code, device }: Props) {
);
}
-export default Preview;
\ No newline at end of file
+export default Preview;