Skip to content

Commit

Permalink
ENH Do not show loading spinner when there was a loading error
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 5, 2023
1 parent 714c773 commit 4dd1269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion client/src/containers/FormBuilderLoader/FormBuilderLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ class FormBuilderLoader extends Component {
return formSchema;
})
.catch((error) => {
this.setState({ didError: true });
this.props.actions.schema.setSchemaLoading(this.props.schemaUrl, false);
if (typeof this.props.onLoadingError === 'function') {
return this.props.onLoadingError(this.normaliseError(error));
Expand Down Expand Up @@ -413,10 +414,13 @@ class FormBuilderLoader extends Component {
}

render() {
const Loading = this.props.loadingComponent;
if (this.state && this.state.didError) {
return null;
}
// If the response from fetching the initial data
// hasn't come back yet, don't render anything.
if (!this.props.schema || !this.props.schema.schema || this.props.loading) {
const Loading = this.props.loadingComponent;
return <Loading containerClass="loading--form flexbox-area-grow" />;
}

Expand Down

0 comments on commit 4dd1269

Please sign in to comment.