Skip to content

Commit

Permalink
6603 - [HOTFIX] - API error handling (#6787)
Browse files Browse the repository at this point in the history
* error handling over api requests
* moving error handling files into V2 folder
* update references to exception handler components
* update of tests
* update of tailwind
* increases version
* fixes review code issues
  • Loading branch information
mfacar authored May 23, 2024
1 parent b0ba28a commit 0c70346
Show file tree
Hide file tree
Showing 37 changed files with 544 additions and 443 deletions.
5 changes: 4 additions & 1 deletion app/react/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
atomStore,
} from './V2/atoms';
import { relationshipTypesAtom } from './V2/atoms/relationshipTypes';
import { ErrorBoundary } from './V2/Components/ErrorHandling';
import { store } from './store';

const reduxState = store?.getState();
Expand Down Expand Up @@ -45,7 +46,9 @@ const App = () => (
<ReduxProvider store={store as any}>
<CustomProvider>
<Provider store={atomStore}>
<RouterProvider router={router} fallbackElement={null} />
<ErrorBoundary>
<RouterProvider router={router} fallbackElement={null} />
</ErrorBoundary>
</Provider>
</CustomProvider>
</ReduxProvider>
Expand Down
38 changes: 0 additions & 38 deletions app/react/App/ErrorHandling/ErrorBoundary.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions app/react/App/ErrorHandling/ErrorFallback.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions app/react/App/ErrorHandling/ErrorUtils.ts

This file was deleted.

25 changes: 0 additions & 25 deletions app/react/App/ErrorHandling/RouteErrorBoundary.tsx

This file was deleted.

46 changes: 0 additions & 46 deletions app/react/App/ErrorHandling/specs/ErrorBoundary.spec.tsx

This file was deleted.

52 changes: 0 additions & 52 deletions app/react/App/ErrorHandling/specs/ErrorFallback.spec.tsx

This file was deleted.

90 changes: 0 additions & 90 deletions app/react/App/ErrorHandling/specs/GeneralError.spec.tsx

This file was deleted.

4 changes: 4 additions & 0 deletions app/react/App/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class Root extends Component {
innerHtml += `window.__user__ = ${serialize(this.props.user, { isJSON: true })};`;
}

if (this.props.loadingError) {
innerHtml += `window.__loadingError__ = ${serialize(this.props.loadingError, { isJSON: true })};`;
}
if (this.props.atomStoreData) {
innerHtml += `window.__atomStoreData__ = ${serialize(this.props.atomStoreData, { isJSON: true })};`;
}
Expand Down Expand Up @@ -129,6 +132,7 @@ Root.propTypes = {
content: PropTypes.string,
language: PropTypes.string,
assets: PropTypes.object,
loadingError: PropTypes.object,
atomStoreData: PropTypes.object,
};

Expand Down
7 changes: 6 additions & 1 deletion app/react/App/RouteHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ class RouteHandler extends Component {
constructor(props, context) {
super(props, context);
setLocale(getLocale(context));
this.state = {};
if ((!this.isRenderedFromServer() || props.location?.state?.isClient) && isClient) {
this.getClientState(this.props);
this.getClientState(this.props).catch(ex => {
// used in inherited types
// eslint-disable-next-line react/no-unused-state
this.setState({ loadingError: ex });
});
}
}

Expand Down
Loading

0 comments on commit 0c70346

Please sign in to comment.