question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: vue, inner tab lifecycle not firing on subsequent visits

See original GitHub issue

Prerequisites

Ionic Framework Version

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

Current Behavior

Last week I upgraded my vue app from ionic v5 to ionic v6, and I noticed a strange behavior.

1 - The main page contains a list of forms. 2- If I go to another page to create a new form, when I go back to home page, the lifecycle hook onIonViewWillEnter or onIonViewDidEnter is not triggered. Consequently, the created form is not listed. 3- I have to go to another page and return to home page again to get this form listed.

I had a look on this issue #23824, which seems to be already solved. After that I created a small example to analyze a little deeper this behavior, and I noticed that in my case, the lifecycle hooks is not being triggered when the “tabs” component is being used.

On Ionic v5 everything worked fine.

Expected Behavior

1 - The main page contains a list of forms. 2- If I go to another page to create a new form, when I go back to home page, it is expected the created form to be listed.

Steps to Reproduce

  1. Click the CREATE FORM button create_form

  2. Choose any option, and click it. (Option 1, for example) form_options

  3. Type a form name. (test 1, for example) form_name

  4. Click the Create button

  5. After this, you’ll be redirected to the home page, where it should contain a list of the created forms.

forms_list

  1. The first created form is listed correctly, but the following ones, are not listed. It’s necessary to change the tab (Tab 1 -> Tab 2 -> Tab 1) to get the correct list of forms.

Code Reproduction URL

Ionic v6 - bug

Working example:

Ionic v5 - working

Ionic Info

Ionic:

Ionic CLI : 6.20.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/vue 6.2.3

Capacitor:

Capacitor CLI : 3.7.0 @capacitor/android : 3.7.0 @capacitor/core : 3.7.0 @capacitor/ios : 3.7.0

Utility:

cordova-res : 0.15.4 native-run : 1.6.0

System:

NodeJS : v16.16.0 (/usr/local/bin/node) npm : 6.14.17 OS : Linux 5.15

Additional Information

Related issue (#23824)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Aug 23, 2022

Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic-framework/pull/25786, and a fix will be available in an upcoming release of Ionic Framework.

1reaction
kalemingcommented, Aug 18, 2022

Well done @liamdebeasi, it is working on both example-v6 and on my real app.

Thanks a lot for this quick fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

vuejs2 - Why is the activated lifecycle hook not called on first visit
In my real code, only the created and mounted , lifecycle hooks are called on the first visit, the activated hook is called...
Read more >
Focus management with Vue refs - Learn web development
We want to set focus on the "Edit" button when a user saves or cancels their edit. To do that, we need to...
Read more >
How to use Vue Lifecycle Hooks. Part 2: activated, deactivated…
The deactivated hook is called when load another dynamic component and the dynamic component e.g. Home component is not active. However, their state...
Read more >
Components Basics - Vue.js
Components allow us to split the UI into independent and reusable pieces, and think about each piece in isolation. It's common for an...
Read more >
How To Navigate Between Views with Vue Router
For the purpose of this tutorial, do not select Vue Router when ... Next, create a Home.vue component inside of a directory called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found