Browse Source

fix(dashboard): Fallback to default input when custom form component not found (#4168)

Alexander Berger 1 day ago
parent
commit
5ab2a5d0cd

+ 13 - 3
packages/dashboard/src/lib/framework/form-engine/custom-form-component.tsx

@@ -1,15 +1,25 @@
 import { getInputComponent } from '@/vdb/framework/extension-api/input-component-extensions.js';
-
+import { DefaultInputForType } from '@/vdb/framework/form-engine/default-input-for-type.js';
 import { DashboardFormComponentProps } from '@/vdb/framework/form-engine/form-engine-types.js';
 
+const warnedComponents = new Set<string>();
+
 export function CustomFormComponent(props: DashboardFormComponentProps) {
     if (!props.fieldDef) {
         return null;
     }
-    const Component = getInputComponent(props.fieldDef.ui?.component);
+    const componentId = props.fieldDef.ui?.component;
+    const Component = getInputComponent(componentId);
 
     if (!Component) {
-        return null;
+        if (componentId && !warnedComponents.has(componentId)) {
+            warnedComponents.add(componentId);
+            console.warn(
+                `Custom form component "${componentId}" not found for field "${props.fieldDef.name}". ` +
+                    `Falling back to default input for type "${props.fieldDef.type}".`,
+            );
+        }
+        return <DefaultInputForType {...props} />;
     }
 
     return <Component {...props} />;