mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-07 13:44:54 +03:00
chore: improve code for avoid double destruction
This commit is contained in:
parent
c9941cdc3e
commit
6125ee7236
|
@ -53,7 +53,9 @@ export class Schema extends React.Component<Partial<SchemaProps>> {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<ObjectSchema
|
<ObjectSchema
|
||||||
{...{ ...this.props, schema: oneOf![schema.activeOneOf], level }}
|
{...rest}
|
||||||
|
level={level}
|
||||||
|
schema={oneOf![schema.activeOneOf]}
|
||||||
discriminator={{
|
discriminator={{
|
||||||
fieldName: discriminatorProp,
|
fieldName: discriminatorProp,
|
||||||
parentSchema: schema,
|
parentSchema: schema,
|
||||||
|
@ -63,16 +65,16 @@ export class Schema extends React.Component<Partial<SchemaProps>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oneOf !== undefined) {
|
if (oneOf !== undefined) {
|
||||||
return <OneOfSchema schema={schema} {...this.props} />;
|
return <OneOfSchema schema={schema} {...rest} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const types = Array.isArray(type) ? type : [type];
|
const types = Array.isArray(type) ? type : [type];
|
||||||
if (types.includes('object')) {
|
if (types.includes('object')) {
|
||||||
if (schema.fields?.length) {
|
if (schema.fields?.length) {
|
||||||
return <ObjectSchema {...{ ...(this.props as any), level }} />;
|
return <ObjectSchema {...(this.props as any)} level={level} />;
|
||||||
}
|
}
|
||||||
} else if (types.includes('array')) {
|
} else if (types.includes('array')) {
|
||||||
return <ArraySchema {...{ ...(this.props as any), level }} />;
|
return <ArraySchema {...(this.props as any)} level={level} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: maybe adjust FieldDetails to accept schema
|
// TODO: maybe adjust FieldDetails to accept schema
|
||||||
|
|
Loading…
Reference in New Issue
Block a user