Fix panel refresh bug
diff --git a/packages/webui/src/app/components/Form/index.tsx b/packages/webui/src/app/components/Form/index.tsx
index 0b54300..23c0f02 100644
--- a/packages/webui/src/app/components/Form/index.tsx
+++ b/packages/webui/src/app/components/Form/index.tsx
@@ -45,8 +45,6 @@
})();
}, [panelNavigation, ref, formData]);
- console.log(ref, initialData, formData);
-
const formJsx = (
<div className="space-y-8">
{formResult ? (
diff --git a/packages/webui/src/app/components/PanelNavigator.tsx b/packages/webui/src/app/components/PanelNavigator.tsx
index d42f820..134bff4 100644
--- a/packages/webui/src/app/components/PanelNavigator.tsx
+++ b/packages/webui/src/app/components/PanelNavigator.tsx
@@ -27,17 +27,19 @@
}, [pluginId, activeRef, routerNavigate, root]);
const fetchLayout = useCallback(() => {
+ if (!activeRef || !pluginId || !activeState) return;
+
setLayout(null);
setError(null);
(async () => {
try {
- if (!(pluginId! in plugins)) {
+ if (!(pluginId in plugins)) {
setError("Unknown plugin " + pluginId);
return;
}
- const data = await plugins[pluginId!].client().panels[activeRef!.id]((activeRef!.args ?? {}) as { [key: string]: string; }, activeState!);
+ const data = await plugins[pluginId].client().panels[activeRef.id]((activeRef.args ?? {}) as { [key: string]: string; }, activeState);
setLayout(data);
} catch (e) {
if (!(e instanceof YggdrasilStatus)) throw e;
@@ -47,10 +49,8 @@
}, [plugins, pluginId, activeRef, activeState]);
useEffect(() => {
- if (!activeRef) return;
-
fetchLayout();
- }, [activeRef, fetchLayout]);
+ }, [fetchLayout]);
const navigate = useCallback((ref: IrisWebuiPanelRef, e?: React.MouseEvent) => {
e?.preventDefault();