|
1 |
| -import React, { useLayoutEffect, useRef } from 'react'; |
| 1 | +import React, { useCallback, useLayoutEffect, useRef } from 'react'; |
2 | 2 | import ReactDOM from 'react-dom';
|
3 |
| -import { resetGlobalCSS, css, Body } from '@mongodb-js/compass-components'; |
| 3 | +import { |
| 4 | + resetGlobalCSS, |
| 5 | + css, |
| 6 | + Body, |
| 7 | + openToast, |
| 8 | +} from '@mongodb-js/compass-components'; |
4 | 9 | import type { AllPreferences } from 'compass-preferences-model';
|
5 | 10 | import { CompassWeb } from '../src/index';
|
6 | 11 | import { SandboxConnectionStorageProvider } from '../src/connection-storage';
|
@@ -87,6 +92,14 @@ const App = () => {
|
87 | 92 | getMetaEl('csrf-time').setAttribute('content', csrfTime ?? '');
|
88 | 93 | }, [csrfToken, csrfTime]);
|
89 | 94 |
|
| 95 | + const onFailToLoadConnections = useCallback((error: Error) => { |
| 96 | + openToast('failed-to-load-connections', { |
| 97 | + title: 'Failed to load connections', |
| 98 | + description: error.message, |
| 99 | + variant: 'warning', |
| 100 | + }); |
| 101 | + }, []); |
| 102 | + |
90 | 103 | if (status === 'checking') {
|
91 | 104 | return null;
|
92 | 105 | }
|
@@ -133,6 +146,7 @@ const App = () => {
|
133 | 146 | onTrack={sandboxTelemetry.track}
|
134 | 147 | onDebug={sandboxLogger.debug}
|
135 | 148 | onLog={sandboxLogger.log}
|
| 149 | + onFailToLoadConnections={onFailToLoadConnections} |
136 | 150 | ></CompassWeb>
|
137 | 151 | </Body>
|
138 | 152 | </SandboxPreferencesUpdateProvider>
|
|
0 commit comments