-
Notifications
You must be signed in to change notification settings - Fork 13.5k
bug: Tabs + React Router + Ionic lifecycle hooks combo causes inconsistent data #23388
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
Comments
Thanks for the issue. I am going to close this as a duplicate of #21594. (Same underlying issue). |
Thank you, but I do not agree that you should close it. |
The problem here is not exclusive to Tabs as it seems to happen when certain pages are kept in the DOM. There is another developer in that thread who is having the same issue and their code example is also using tabs: #21594 (comment) As noted in #21594 (comment) you might be able to replace the lifecycle hook with |
Ok, will continue in that older thread then. |
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. |
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Ionic version:
[x] 5.6.8
Current behavior:
There is a problem with
useIonViewWillEnter
anduseParams
ofreact-router
.If I try to access the
params
object ofuseParams
inside theuseIonViewWillEnter
callback WHILE I previously navigated usingIonTabs
- theparams
object will contain obsolete\erroneous data.See the Steps to reproduce: section for a more understandable explanation.
Expected behavior:
Steps to reproduce:
In the linked repo app do the following:
id1
.IonTabButton
below.id
, the data displayed is still for the 1st customer. Whereas, theid
that is used in the Header is correct - because it is set directly fromuseParams
, avoidinguseIonViewWillEnter
.Related code:
https://github.com/avalanche1/ionic-router-problem-app
The module in question is
src\pages\CustomerForm.tsx
.It has
console.log
's in it, that show thatuseIonViewWillEnter
uses incorrect customer id.Ionic info:
The text was updated successfully, but these errors were encountered: