Ensure error message is cleared upon refreshing or restarting app
This commit is contained in:
@@ -273,6 +273,7 @@ export const PreviewIframe = ({
|
||||
// Function to handle reload
|
||||
const handleReload = () => {
|
||||
setReloadKey((prevKey) => prevKey + 1);
|
||||
setErrorMessage(undefined);
|
||||
// Optionally, add logic here if you need to explicitly stop/start the app again
|
||||
// For now, just changing the key should remount the iframe
|
||||
console.debug("Reloading iframe preview for app", selectedAppId);
|
||||
|
||||
@@ -99,10 +99,12 @@ 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 handleRestart = useCallback(() => {
|
||||
if (selectedAppId !== null) {
|
||||
restartApp(selectedAppId);
|
||||
setKey((prevKey) => prevKey + 1);
|
||||
}
|
||||
}, [selectedAppId, restartApp]);
|
||||
|
||||
@@ -163,6 +165,7 @@ export function PreviewPanel() {
|
||||
<div className="h-full overflow-y-auto">
|
||||
{previewMode === "preview" ? (
|
||||
<PreviewIframe
|
||||
key={key}
|
||||
loading={loading}
|
||||
loadingErrorMessage={error?.message}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user