-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): Add Error Boundary around Extensions and comply with new Ext…
…ensions API (#7215) * fix: Add error boundary around Extensions and change path where UI looks for extensions Signed-off-by: Remington Breeze <remington@breeze.software> * Add error message to error boundary Signed-off-by: Remington Breeze <remington@breeze.software>
- Loading branch information
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
ui/src/app/shared/components/error-boundary/error-boundary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from 'react'; | ||
|
||
export class ErrorBoundary extends React.Component<{message?: string}, {hasError: boolean}> { | ||
constructor(props: any) { | ||
super(props); | ||
this.state = {hasError: false}; | ||
} | ||
|
||
static getDerivedStateFromError(error: React.ErrorInfo) { | ||
return {hasError: true}; | ||
} | ||
|
||
render() { | ||
if (this.state.hasError) { | ||
return <h1>{this.props.message ? this.props.message : 'Something went wrong.'}</h1>; | ||
} | ||
|
||
return this.props.children; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters