fix bug with preview not updating immediately

This commit is contained in:
Abi Raja 2023-12-14 09:20:06 -05:00
parent f1a9859384
commit f676151edf

View File

@ -1,4 +1,4 @@
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from "react";
import classNames from "classnames"; import classNames from "classnames";
import useThrottle from "../hooks/useThrottle"; import useThrottle from "../hooks/useThrottle";
@ -8,7 +8,9 @@ interface Props {
} }
function Preview({ code, device }: 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); const iframeRef = useRef<HTMLIFrameElement | null>(null);
useEffect(() => { useEffect(() => {
@ -39,4 +41,4 @@ function Preview({ code, device }: Props) {
); );
} }
export default Preview; export default Preview;