From c996384786257524842cc1dca8d0fb940699719b Mon Sep 17 00:00:00 2001 From: Sean Perkins Date: Wed, 4 Jan 2023 17:33:45 -0500 Subject: [PATCH] fix(vue): unmount teleported user component (#26543) Resolves #26542 --- packages/vue/src/components/IonApp.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/vue/src/components/IonApp.ts b/packages/vue/src/components/IonApp.ts index 3355a662c3..c989946751 100644 --- a/packages/vue/src/components/IonApp.ts +++ b/packages/vue/src/components/IonApp.ts @@ -33,5 +33,14 @@ export const addTeleportedUserComponent = (component: VNode) => { } export const removeTeleportedUserComponent = (component: VNode) => { - userComponents.value = userComponents.value.filter(cmp => cmp !== component); + /** + * Finds the index of the component in the array and removes it. + * Previously we were using a filter to remove the component from the array, + * but this was causing a bug where dismissing an overlay and then presenting + * a new overlay, would cause the new overlay to be removed. + */ + const index = userComponents.value.findIndex(cmp => cmp === component); + if (index !== -1) { + userComponents.value.splice(index, 1); + } }