Skip to content

fix(vue): lifecycles now fire on tabs pages - #25786

Merged
liamdebeasi merged 6 commits into
mainfrom
FW-2073
Aug 23, 2022
Merged

fix(vue): lifecycles now fire on tabs pages#25786
liamdebeasi merged 6 commits into
mainfrom
FW-2073

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Aug 18, 2022

Copy link
Copy Markdown
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue URL: resolves #25784

When navigating to an inner tabs page (Tab1), the currentMatchedRouteRef is the route definition for the Tab1 page and previousMatchedRouteRef is undefined. We then set previousMatchedRouteRef to currentMatchedRouteRef so that we can have a reference to the last route that this outlet matched next time the currentMatchedRouteRef changes.

When navigating away from the tabs context, currentMatchedRouteRef becomes undefined but previousMatchedRouteRef stays at Tab1. Since currentMatchedRouteRef is undefined, we return early and do not update previousMatchedRouteRef. This means that when we navigate back to Tabs1, both currentMatchedRouteRef and previousMatchedRouteRef match Tab1. As a result, we do not call setupViewItem and the inner Tab1 page does not fire lifecycle hooks.

What is the new behavior?

  • We now clear out previousMatchedRouteRef when navigating away from a page.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions Bot added the package: vue @ionic/vue package label Aug 18, 2022
@liamdebeasi
liamdebeasi marked this pull request as ready for review August 18, 2022 22:26
@liamdebeasi
liamdebeasi requested a review from a team August 18, 2022 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants