Skip to content

Commit

Permalink
feat(ui): Add error boundary to prevent UI crashing due to rendering …
Browse files Browse the repository at this point in the history
…errors
  • Loading branch information
mattrunyon committed Jan 31, 2024
1 parent b12e0b8 commit f191939
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugins/ui/src/js/src/DashboardPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import styles from './styles.scss?inline';
import { WidgetWrapper } from './WidgetTypes';
import PortalPanel from './PortalPanel';
import WidgetHandler from './WidgetHandler';
import { ErrorBoundary } from '@deephaven/components';

const NAME_ELEMENT = 'deephaven.ui.Element';
const DASHBOARD_ELEMENT = 'deephaven.ui.Dashboard';
Expand Down Expand Up @@ -204,9 +205,11 @@ export function DashboardPlugin({
const widgetHandlers = useMemo(
() =>
[...widgetMap.entries()].map(([widgetId, widget]) => (
<DeferredApiBootstrap key={widgetId} options={widget.metadata}>
<WidgetHandler widget={widget} onClose={handleWidgetClose} />
</DeferredApiBootstrap>
<ErrorBoundary key={widgetId}>
<DeferredApiBootstrap options={widget.metadata}>
<WidgetHandler widget={widget} onClose={handleWidgetClose} />
</DeferredApiBootstrap>
</ErrorBoundary>
)),
[handleWidgetClose, widgetMap]
);
Expand Down

0 comments on commit f191939

Please sign in to comment.