Always use JSON mode if the schema type is object and has no properties
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ server/build
|
||||
client/dist
|
||||
client/tsconfig.app.tsbuildinfo
|
||||
client/tsconfig.node.tsbuildinfo
|
||||
.vscode
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user