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

bug: ion nav component #23681

Closed
4 of 6 tasks
EslamNemr opened this issue Jul 24, 2021 · 3 comments
Closed
4 of 6 tasks

bug: ion nav component #23681

EslamNemr opened this issue Jul 24, 2021 · 3 comments
Labels

Comments

@EslamNemr
Copy link

Prequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

ion nav component with ionic/vue
when trying to pop to another view all forward views component in the stack didn't unmounted or removed from the dom which cause memory leak.
even using remove function just remove the view and didn't unmount or destroy the component and also didn't remove dom element

Expected Behavior

its should just keep the pervious element in the stack and remove or unmount all the forward.

Steps to Reproduce

1- add nav component and pop to any view
2- check dom elements still there
3- check vnode subtree or vue dev tool still unmounted.

Code Reproduction URL

No response

Ionic Info

No response

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jul 24, 2021
@EslamNemr EslamNemr changed the title bug: bug: ion nav component Jul 24, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. I am going to close this as a duplicate of #21831.

@EslamNemr
Copy link
Author

i would like to leave my solution here for any one use ionic/vue nav component
in file
https://github.com/ionic-team/ionic-framework/blob/main/packages/vue/src/components/IonNav.ts

i return views which is the array of created component vnode as props then i managed to delete it from my component
it seems the bug in framework delegate and core component remove view function.

setup() {
const views = shallowRef([]);

/**
 * Allows us to create the component
 * within the Vue application context.
 */
const addView = (component: VNode) => views.value = [...views.value, component];
const removeView = (component: VNode) => views.value = views.value.filter(cmp => cmp !== component);

const delegate = VueDelegate(addView, removeView);
return () => {
  return h(
    'ion-nav',
    { delegate, views },
    views.value
  )
}

}
});

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants