From a475f3ba9b8436029b878a888af601edf59a76d7 Mon Sep 17 00:00:00 2001 From: Benjamin Cavy Date: Sat, 15 Jun 2024 00:41:59 +0200 Subject: [PATCH] fix: feature creation --- izanami-frontend/src/components/FeatureForm.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/izanami-frontend/src/components/FeatureForm.tsx b/izanami-frontend/src/components/FeatureForm.tsx index 092b0f536..9ab3e7457 100644 --- a/izanami-frontend/src/components/FeatureForm.tsx +++ b/izanami-frontend/src/components/FeatureForm.tsx @@ -748,9 +748,10 @@ export function FeatureForm(props: { }) { const { tenant } = useParams(); const { defaultValue, submit, ...rest } = props; + console.log("defaultValue", defaultValue); const completeFeatureQuery = useQuery( - JSON.stringify(defaultValue), + defaultValue ? JSON.stringify(defaultValue) : "", () => toCompleteFeature(tenant!, defaultValue!), { enabled: !!defaultValue } ); @@ -763,9 +764,7 @@ export function FeatureForm(props: { ClassicalFeature | undefined >(undefined); - if (completeFeatureQuery.isError) { - return
Failed to load feature details
; - } else if (completeFeatureQuery.data || completeFeatureQuery.isIdle) { + if (completeFeatureQuery.data || completeFeatureQuery.isIdle) { const defaultValue = completeFeatureQuery.data; let form = undefined; if (legacy) { @@ -839,6 +838,8 @@ export function FeatureForm(props: { {form} ); + } else if (completeFeatureQuery.isError) { + return
Failed to load feature details
; } else { return
Loading...
; }