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