basic suggested action scaffolding

This commit is contained in:
Will Chen
2025-04-18 13:03:19 -07:00
parent b2e3631a29
commit 639b3a320c
10 changed files with 149 additions and 86 deletions

View File

@@ -1,5 +1,9 @@
import { useAtom, useAtomValue } from "jotai";
import { previewModeAtom, selectedAppIdAtom } from "../../atoms/appAtoms";
import {
previewModeAtom,
previewPanelKeyAtom,
selectedAppIdAtom,
} from "../../atoms/appAtoms";
import { useLoadApp } from "@/hooks/useLoadApp";
import { CodeView } from "./CodeView";
import { PreviewIframe } from "./PreviewIframe";
@@ -99,14 +103,11 @@ export function PreviewPanel() {
const [isConsoleOpen, setIsConsoleOpen] = useState(false);
const { runApp, stopApp, restartApp, error, loading, app } = useRunApp();
const runningAppIdRef = useRef<number | null>(null);
const [key, setKey] = useState(0);
const key = useAtomValue(previewPanelKeyAtom);
const handleRestart = useCallback(() => {
if (selectedAppId !== null) {
restartApp(selectedAppId);
setKey((prevKey) => prevKey + 1);
}
}, [selectedAppId, restartApp]);
restartApp();
}, [restartApp]);
useEffect(() => {
const previousAppId = runningAppIdRef.current;