File tree Expand file tree Collapse file tree 8 files changed +28
-88
lines changed
compass-crud/src/components
compass-import-export/src/modules Expand file tree Collapse file tree 8 files changed +28
-88
lines changed Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ const EditActionsFooter: React.FunctionComponent<{
339339 size = "xsmall"
340340 onClick = { ( ) =>
341341 showErrorDetails ( {
342- details : error . details ,
342+ details : error . details ! ,
343343 closeAction : 'close' ,
344344 } )
345345 }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ export const ConfirmationModalArea: React.FC = ({ children }) => {
106106 const contextValue = React . useMemo (
107107 ( ) => ( {
108108 showConfirmation : ( props : ConfirmationProperties ) => {
109- return new Promise ( ( resolve , reject ) => {
109+ return new Promise < boolean > ( ( resolve , reject ) => {
110110 const event = new CustomEvent < ShowConfirmationEventDetail > (
111111 'show-confirmation' ,
112112 {
Original file line number Diff line number Diff line change 1- import { useConfirmationModal } from './use-confirmation' ;
1+ import {
2+ type showConfirmation as originalShowConfirmation ,
3+ showConfirmation ,
4+ useConfirmationModal ,
5+ } from './use-confirmation' ;
26import { Code } from '../components/leafygreen' ;
37import React from 'react' ;
48
5- export function useErrorDetailsModal ( ) {
6- const { showConfirmation } = useConfirmationModal ( ) ;
7-
8- const showErrorDetails = ( {
9+ const getShowErrorDetails = (
10+ showConfirmation : typeof originalShowConfirmation
11+ ) => {
12+ return ( {
913 details,
1014 closeAction,
1115 } : {
1216 details : Record < string , unknown > ;
1317 closeAction : 'back' | 'close' ;
1418 } ) =>
15- showConfirmation ( {
19+ void showConfirmation ( {
1620 title : 'Error details' ,
1721 description : (
1822 < Code
@@ -28,6 +32,12 @@ export function useErrorDetailsModal() {
2832 // modalProps
2933 // buttonProps
3034 } ) ;
35+ } ;
3136
32- return { showErrorDetails } ;
37+ export function useErrorDetailsModal ( ) {
38+ const { showConfirmation } = useConfirmationModal ( ) ;
39+
40+ return { showErrorDetails : getShowErrorDetails ( showConfirmation ) } ;
3341}
42+
43+ export const showErrorDetails = getShowErrorDetails ( showConfirmation ) ;
Original file line number Diff line number Diff line change @@ -92,7 +92,6 @@ export { ModalBody } from './components/modals/modal-body';
9292export { ModalHeader } from './components/modals/modal-header' ;
9393export { FormModal } from './components/modals/form-modal' ;
9494export { InfoModal } from './components/modals/info-modal' ;
95- export { ErrorDetailsModal } from './components/modals/error-details-modal' ;
9695
9796export type {
9897 FileInputBackend ,
@@ -185,7 +184,6 @@ export {
185184} from './hooks/use-confirmation' ;
186185export {
187186 useErrorDetailsModal ,
188- ErrorDetailsModalArea ,
189187 showErrorDetails ,
190188} from './hooks/use-error-details' ;
191189export {
Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ const InsertDocumentDialog: React.FC<InsertDocumentDialogProps> = ({
349349 className = { errorDetailsBtnStyles }
350350 onClick = { ( ) =>
351351 showErrorDetails ( {
352- details : error . info ,
352+ details : error . info ! ,
353353 closeAction : 'back' ,
354354 } )
355355 }
Original file line number Diff line number Diff line change @@ -378,11 +378,14 @@ export const startImport = (): ImportThunkAction<Promise<void>> => {
378378 progressCallback . flush ( ) ;
379379 const errInfo =
380380 err ?. writeErrors ?. length && err ?. writeErrors [ 0 ] ?. err ?. errInfo ;
381- showFailedToast ( err as Error , ( ) =>
382- showErrorDetails ( {
383- details : errInfo ,
384- closeAction : 'close' ,
385- } )
381+ showFailedToast (
382+ err as Error ,
383+ errInfo &&
384+ ( ( ) =>
385+ showErrorDetails ( {
386+ details : errInfo ,
387+ closeAction : 'close' ,
388+ } ) )
386389 ) ;
387390
388391 dispatch ( onFailed ( err as Error ) ) ;
You can’t perform that action at this time.
0 commit comments