Aurelia Dialog opening twice or more

Good day

I’m using the dialog plugin (version 1.1.0). Sometimes the dialog opens up multiple times. Here is the code which opens it up:

		if (!this.dialogService.hasOpenDialog) {
			return{viewModel: AssignTeam}).whenClosed((response) => {
				if (!response.wasCancelled) {
					return this.protectionService.assignTeam(devices, response.output);
				} else {

The dialog box is opened up twice or more on top of each other, so when you click on submit the topmost dialog closes, and the second topmost dialog is shown. You have to manually close the dialog to get rid of it.

The above-mentioned code is only executing once, so it is not a double dispatch problem.

Any help appreciated