Skip to content

Commit

Permalink
Making reloading schema on FormBuilderLoader mount optional rather th…
Browse files Browse the repository at this point in the history
…an always off
  • Loading branch information
ScopeyNZ committed Sep 19, 2018
1 parent 7065c58 commit e30ace6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion client/src/containers/FormBuilderLoader/FormBuilderLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class FormBuilderLoader extends Component {
}

componentDidMount() {
if (!this.props.schema) {
const { schema, refetchSchemaOnMount } = this.props;

if (refetchSchemaOnMount || !schema) {
this.fetch();
}
}
Expand Down Expand Up @@ -431,12 +433,17 @@ FormBuilderLoader.propTypes = Object.assign({}, basePropTypes, {
identifier: PropTypes.string.isRequired,
schemaUrl: PropTypes.string.isRequired,
schema: schemaPropType,
refetchSchemaOnMount: PropTypes.bool.isRequired,
form: PropTypes.string,
submitting: PropTypes.bool,
onFetchingSchema: PropTypes.func,
loadingComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
});

FormBuilderLoader.defaultProps = {
refetchSchemaOnMount: true,
};

function mapStateToProps(state, ownProps) {
const schema = state.form.formSchemas[ownProps.schemaUrl];
const identifier = createFormIdentifierFromProps({ ...ownProps, schema });
Expand Down

0 comments on commit e30ace6

Please sign in to comment.