Skip to content

Commit

Permalink
fix: make extraFields property optional with default value
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadreza pakzadian committed Jul 23, 2024
1 parent 85c8aab commit c273081
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/providers/SchemaProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ const schemaReducer = (state: JsonSchema, action: SchemaAction): JsonSchema => {
};

type Props = {
extraFields: FieldConfig[];
children: ReactNode;
value?: RJSFSchema;
templates?: TemplateType[];
extraFields?: FieldConfig[];
};

export const SchemaProvider = ({ children, extraFields, value, templates = [] }: Props) => {
export const SchemaProvider = ({ children, extraFields = [], value, templates = [] }: Props) => {
const [schema, dispatch] = useReducer(schemaReducer, value || new JsonSchemaBuilder().setType('object').build());

return (
Expand Down
2 changes: 1 addition & 1 deletion src/stories/SchemaBuilder.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const customTemplate = {
};

const FaqTemplate: Story = (args) => (
<SchemaProvider extraFields={[]} templates={[customTemplate]}>
<SchemaProvider templates={[customTemplate]}>
<SchemaBuilder {...args} />
</SchemaProvider>
);
Expand Down

0 comments on commit c273081

Please sign in to comment.