Skip to content

Commit

Permalink
fix(vue): unmount teleported user component (#26543)
Browse files Browse the repository at this point in the history
Resolves #26542
  • Loading branch information
sean-perkins committed Jan 4, 2023
1 parent 3e671b9 commit c996384
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/vue/src/components/IonApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit c996384

Please sign in to comment.