-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compass-global-writes): handle loading error COMPASS-8446
- Loading branch information
1 parent
0d21433
commit e61e093
Showing
3 changed files
with
117 additions
and
20 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
26 changes: 26 additions & 0 deletions
26
packages/compass-global-writes/src/components/states/loading-error.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,26 @@ | ||
import React from 'react'; | ||
import { ErrorSummary } from '@mongodb-js/compass-components'; | ||
import { connect } from 'react-redux'; | ||
import { type RootState, ShardingStatuses } from '../../store/reducer'; | ||
import { containerStyles } from '../common-styles'; | ||
|
||
interface LoadingErrorProps { | ||
error: string; | ||
} | ||
|
||
export function LoadingError({ error }: LoadingErrorProps) { | ||
return ( | ||
<div className={containerStyles}> | ||
<ErrorSummary errors={error} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default connect((state: RootState) => { | ||
if (state.status !== ShardingStatuses.LOADING_ERROR) { | ||
throw new Error('Error not found in LoadingError'); | ||
} | ||
return { | ||
error: state.error, | ||
}; | ||
})(LoadingError); |
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