-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core/modal): avoid throwing errors on modal $dismiss (#4233)
- Loading branch information
1 parent
9b55134
commit ed9c20f
Showing
26 changed files
with
197 additions
and
169 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
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
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
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
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
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
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
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
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
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
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,24 @@ | ||
import { module } from 'angular'; | ||
import IProvideService = angular.auto.IProvideService; | ||
|
||
import { IModalStackService } from 'angular-ui-bootstrap'; | ||
|
||
export const DISMISS_DECORATOR = 'spinnaker.core.modal.dismiss.decorator'; | ||
module(DISMISS_DECORATOR, []) | ||
.config(($provide: IProvideService) => { | ||
// Prevents an error from escaping when the user dismisses a modal created via the ReactInjector | ||
// (error looks like: "Possibly unhandled rejection: undefined undefined") | ||
$provide.decorator('$uibModalStack', ($delegate: IModalStackService) => { | ||
const originalDismiss: Function = $delegate.dismiss; | ||
$delegate.dismiss = (...args: any[]) => { | ||
originalDismiss.apply(this, args); | ||
const [ modalInstance ] = args; | ||
if (modalInstance && modalInstance.result) { | ||
modalInstance.result | ||
.catch(() => {}); | ||
} | ||
}; | ||
|
||
return $delegate; | ||
}); | ||
}); |
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
Oops, something went wrong.