diff --git a/sandpack-react/src/Issues.stories.tsx b/sandpack-react/src/Issues.stories.tsx index 336aedd83..50c65ae57 100644 --- a/sandpack-react/src/Issues.stories.tsx +++ b/sandpack-react/src/Issues.stories.tsx @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import React, { useState } from "react"; +import { REACT_TEMPLATE } from "./templates"; + import { Sandpack, SandpackCodeEditor, @@ -12,6 +14,38 @@ import { export default { title: "Bug reports/Issues", }; + +export const Issue944 = (): JSX.Element => { + const [files, setFiles] = useState(REACT_TEMPLATE["files"]); + + return ( + <> + + `, + }); + }} + > + 2 + + + + ); +}; + export const FlushServerVsClient = (): JSX.Element => { return ( diff --git a/sandpack-react/src/contexts/utils/useClient.ts b/sandpack-react/src/contexts/utils/useClient.ts index 3d0198a87..3ba93da4c 100644 --- a/sandpack-react/src/contexts/utils/useClient.ts +++ b/sandpack-react/src/contexts/utils/useClient.ts @@ -469,6 +469,8 @@ export const useClient: UseClient = ( return; } + console.log(recompileMode, filesState); + /** * When the environment changes, Sandpack needs to make sure * to create a new client and the proper bundler diff --git a/sandpack-react/src/contexts/utils/useFiles.ts b/sandpack-react/src/contexts/utils/useFiles.ts index fa59c2dcf..58db862a9 100644 --- a/sandpack-react/src/contexts/utils/useFiles.ts +++ b/sandpack-react/src/contexts/utils/useFiles.ts @@ -59,6 +59,7 @@ export const useFiles: UseFiles = (props) => { const isMountedRef = useRef(false); useEffect(() => { if (isMountedRef.current) { + console.log("changed"); setState(getSandpackStateFromProps(props)); } else { isMountedRef.current = true;