Skip to content

Commit

Permalink
fix: feature creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitFicus committed Jun 14, 2024
1 parent 36ea22a commit a475f3b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions izanami-frontend/src/components/FeatureForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
);
Expand All @@ -763,9 +764,7 @@ export function FeatureForm(props: {
ClassicalFeature | undefined
>(undefined);

if (completeFeatureQuery.isError) {
return <div>Failed to load feature details</div>;
} else if (completeFeatureQuery.data || completeFeatureQuery.isIdle) {
if (completeFeatureQuery.data || completeFeatureQuery.isIdle) {
const defaultValue = completeFeatureQuery.data;
let form = undefined;
if (legacy) {
Expand Down Expand Up @@ -839,6 +838,8 @@ export function FeatureForm(props: {
{form}
</>
);
} else if (completeFeatureQuery.isError) {
return <div>Failed to load feature details</div>;
} else {
return <div>Loading...</div>;
}
Expand Down

0 comments on commit a475f3b

Please sign in to comment.