mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
revert pure components used with observer
This commit is contained in:
parent
5f618c2979
commit
63d2732f60
|
@ -29,7 +29,7 @@ export interface FieldProps extends SchemaOptions {
|
|||
}
|
||||
|
||||
@observer
|
||||
export class Field extends React.PureComponent<FieldProps> {
|
||||
export class Field extends React.Component<FieldProps> {
|
||||
toggle = () => {
|
||||
if (this.props.field.expanded === undefined && this.props.expandByDefault) {
|
||||
this.props.field.expanded = false;
|
||||
|
|
|
@ -18,7 +18,7 @@ export interface ObjectSchemaProps extends SchemaProps {
|
|||
};
|
||||
}
|
||||
|
||||
export const ObjectSchemaComponent = observer(
|
||||
export const ObjectSchema = observer(
|
||||
({
|
||||
schema: { fields = [], title },
|
||||
showTitle,
|
||||
|
@ -78,5 +78,3 @@ export const ObjectSchemaComponent = observer(
|
|||
);
|
||||
},
|
||||
);
|
||||
|
||||
export const ObjectSchema = React.memo<ObjectSchemaProps>(ObjectSchemaComponent);
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as React from 'react';
|
|||
|
||||
import { filterPropsDeep } from '../../utils/test-utils';
|
||||
|
||||
import { ObjectSchemaComponent, ObjectSchema, Schema } from '../';
|
||||
import { ObjectSchema, Schema } from '../';
|
||||
import { OpenAPIParser, SchemaModel } from '../../services';
|
||||
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||
import * as simpleDiscriminatorFixture from './fixtures/simple-discriminator.json';
|
||||
|
@ -26,7 +26,7 @@ describe('Components', () => {
|
|||
options,
|
||||
);
|
||||
const schemaViewElement = shallow(<Schema schema={schema} />).getElement();
|
||||
expect(schemaViewElement.type).toEqual(ObjectSchemaComponent);
|
||||
expect(schemaViewElement.type).toEqual(ObjectSchema);
|
||||
expect(schemaViewElement.props.discriminator).toBeDefined();
|
||||
expect(schemaViewElement.props.discriminator.parentSchema).toBeDefined();
|
||||
expect(schemaViewElement.props.discriminator.fieldName).toEqual('type');
|
||||
|
|
Loading…
Reference in New Issue
Block a user