1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 07:41:22 +02:00

Ensure that modal hide animates (#2332)

We want to return a promise in``onbeforeremove` with arbitrary loading time to ensure that the animateHide animation has time to complete.
This commit is contained in:
Alexander Skvortsov
2020-10-02 11:12:49 -04:00
committed by GitHub
parent 07b1ed4d76
commit 28056d0c0e

View File

@@ -33,6 +33,9 @@ export default class Modal extends Component {
// we don't need to show a hide animation. // we don't need to show a hide animation.
if (!this.attrs.state.modal) { if (!this.attrs.state.modal) {
this.attrs.animateHide(); this.attrs.animateHide();
// Here, we ensure that the animation has time to complete.
// See https://mithril.js.org/lifecycle-methods.html#onbeforeremove
return new Promise((resolve) => setTimeout(resolve, 1000));
} }
} }