Skip to content

Commit 9a15753

Browse files
authored
fix(modal): life cycle events for controller modals (#24508)
Resolves #24460
1 parent a753d34 commit 9a15753

File tree

1 file changed

+17
-29
lines changed

1 file changed

+17
-29
lines changed

core/src/components/modal/modal.tsx

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -216,28 +216,28 @@ export class Modal implements ComponentInterface, OverlayInterface {
216216
*/
217217
@Event({ eventName: 'ionModalDidDismiss' }) didDismiss!: EventEmitter<OverlayEventDetail>;
218218

219-
/**
220-
* Emitted after the modal has presented.
221-
* Shorthand for ionModalWillDismiss.
222-
*/
219+
/**
220+
* Emitted after the modal has presented.
221+
* Shorthand for ionModalWillDismiss.
222+
*/
223223
@Event({ eventName: 'didPresent' }) didPresentShorthand!: EventEmitter<void>;
224224

225-
/**
226-
* Emitted before the modal has presented.
227-
* Shorthand for ionModalWillPresent.
228-
*/
225+
/**
226+
* Emitted before the modal has presented.
227+
* Shorthand for ionModalWillPresent.
228+
*/
229229
@Event({ eventName: 'willPresent' }) willPresentShorthand!: EventEmitter<void>;
230230

231-
/**
232-
* Emitted before the modal has dismissed.
233-
* Shorthand for ionModalWillDismiss.
234-
*/
231+
/**
232+
* Emitted before the modal has dismissed.
233+
* Shorthand for ionModalWillDismiss.
234+
*/
235235
@Event({ eventName: 'willDismiss' }) willDismissShorthand!: EventEmitter<OverlayEventDetail>;
236236

237-
/**
238-
* Emitted after the modal has dismissed.
239-
* Shorthand for ionModalDidDismiss.
240-
*/
237+
/**
238+
* Emitted after the modal has dismissed.
239+
* Shorthand for ionModalDidDismiss.
240+
*/
241241
@Event({ eventName: 'didDismiss' }) didDismissShorthand!: EventEmitter<OverlayEventDetail>;
242242

243243
@Watch('swipeToClose')
@@ -494,19 +494,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
494494

495495
if (dismissed) {
496496
const { delegate } = this.getDelegate();
497-
498-
/**
499-
* If the modal is presented through a controller, we don't need to detach
500-
* since the el was already removed during the `dismiss` call above. Skipping
501-
* this step also prevents an issue where rapdily dismissing right after
502-
* presenting could cause `detachComponent` to be called after the present
503-
* finished, blanking out the newly opened modal.
504-
*
505-
* TODO(FW-423) try and find a way to resolve the race condition directly
506-
*/
507-
if (this.inline) {
508-
await detachComponent(delegate, this.usersElement);
509-
}
497+
await detachComponent(delegate, this.usersElement);
510498

511499
if (this.animation) {
512500
this.animation.destroy();

0 commit comments

Comments
 (0)