FIX: wrap modal onShow inside next (#10651)

Before this commit, onShow code could be impacted by code happening after the onShow call. This should ensure this code works for example:

```
onShow() {
  afterRender(() => {
    someInput.focus();
  })
}
```
This commit is contained in:
Joffrey JAFFEUX 2020-09-11 16:00:31 +02:00 committed by GitHub
parent 636a3be827
commit d9aa105c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import { next } from "@ember/runloop";
import I18n from "I18n";
import { dasherize } from "@ember/string";
import { getOwner } from "discourse-common/lib/get-owner";
@ -72,7 +73,7 @@ export default function (name, opts) {
controller.set("model", model);
}
if (controller.onShow) {
controller.onShow();
next(() => controller.onShow());
}
controller.set("flashMessage", null);