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: vue, lifecycle hooks not fired with vue 3.2 setup #23824

Closed
4 of 6 tasks
riderx opened this issue Aug 26, 2021 · 7 comments
Closed
4 of 6 tasks

bug: vue, lifecycle hooks not fired with vue 3.2 setup #23824

riderx opened this issue Aug 26, 2021 · 7 comments
Labels
package: vue @ionic/vue package type: bug a confirmed bug report
Milestone

Comments

@riderx
Copy link

riderx commented Aug 26, 2021

Prequisites

Ionic Framework Version

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

Current Behavior

This code in component is never trigger :

  onIonViewDidEnter(() => {
      console.log('About page did enter');
    });

  onIonViewDidLeave(() => {
    console.log('About page did leave');
  });

  onIonViewWillEnter(() => {
    console.log('About page will enter');
  });

  onIonViewWillLeave(() => {
    console.log('About page will leave');
  });

Expected Behavior

this should be triggered during routing

Steps to Reproduce

you can clone : https://github.com/riderx/ionicv6-beta-vue-vite
yarn
and
yarn dev

Code Reproduction URL

https://github.com/riderx/ionicv6-beta-vue-vite

Ionic Info

Ionic:

Ionic CLI : 6.17.0

Utility:

cordova-res (update available: 0.15.3) : 0.15.2
native-run : 1.4.0

System:

NodeJS : v16.7.0
npm : 7.20.3
OS : macOS Monterey

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Aug 26, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. This looks like an incompatibility with the new <script setup> feature in Vue 3.2.

@liamdebeasi liamdebeasi changed the title bug: lifecycle hook never trigger ionic 6 beta 4 vue 3 bug: vue, lifecycle hooks not fired with vue 3.2 setup Aug 26, 2021
@liamdebeasi liamdebeasi added package: vue @ionic/vue package type: bug a confirmed bug report labels Aug 26, 2021
@ionitron-bot ionitron-bot bot removed the triage label Aug 26, 2021
@riderx
Copy link
Author

riderx commented Aug 27, 2021

@liamdebeasi I tried in setup function in normal component and same issue, but I didn't try in component custom propriety

@snowwolfjay
Copy link
Contributor

any progress? because the router cache, it looks like disaster, because when you just need open one page, it open five visited for you... go(-1)/replace / back not clear the cache.

@raymer
Copy link

raymer commented Nov 20, 2021

Any update on this? My app is having really wonky behavior similar to the comment above me. Vue recommends <script setup> as the way to do single file components. https://v3.vuejs.org/api/sfc-script-setup.html

@snowwolfjay
Copy link
Contributor

snowwolfjay commented Nov 22, 2021

Hi, I will make a small change try fix this.
Hooks function not work due to: lifecycle property is defined at a instance which make it be a private property so cant access and fire, please check whether there is some better way #24253

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #24253, and a fix will be available in an upcoming release of Ionic Framework.

Big thanks to @snowwolfjay for creating the fix!

@ionitron-bot
Copy link

ionitron-bot bot commented Dec 24, 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 Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

4 participants