Always use JSON mode if the schema type is object and has no properties

This commit is contained in:
Ola Hungerford
2025-02-28 09:06:51 -07:00
parent e7f55f083f
commit b01e386659
2 changed files with 11 additions and 0 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ server/build
client/dist
client/tsconfig.app.tsbuildinfo
client/tsconfig.node.tsbuildinfo
.vscode

View File

@@ -307,6 +307,16 @@ const DynamicJsonForm = ({
}
};
const shouldUseJsonMode =
schema.type === "object" &&
(!schema.properties || Object.keys(schema.properties).length === 0);
useEffect(() => {
if (shouldUseJsonMode && !isJsonMode) {
setIsJsonMode(true);
}
}, [shouldUseJsonMode, isJsonMode]);
return (
<div className="space-y-4">
<div className="flex justify-end">