Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vue): cache attached view reference #26694

Merged
merged 4 commits into from
Jan 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/vue/src/framework-delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const VueDelegate = (
// TODO(FW-2969): types
const attachViewToDom = (
parentElement: HTMLElement,
component: any,
componentOrTagName: any | string,
componentProps: any = {},
classes?: string[]
) => {
Expand All @@ -37,10 +37,17 @@ export const VueDelegate = (
const hostComponent = h(
Teleport,
{ to: div },
h(component, { ...componentProps })
h(componentOrTagName, { ...componentProps })
);

refMap.set(component, hostComponent);
/**
* Ionic Framework will use what is returned from `attachViewToDom`
* as the `component` argument in `removeViewFromDom`.
*
* We will store a reference to the div element and the host component,
* so we can later look-up and unmount the correct instance.
*/
refMap.set(div, hostComponent);

addFn(hostComponent);

Expand Down