I noticed that when changing route, the component is not being remove unlike previous versions of vue when routing.
But then when going back to that route the data is being persisted which is should not be.
Is there options on how to make this rerendered so that the values or states are back to normal.
The Login component shouldnt be there, because it was already routed to other path.
When going back to the Login Path, the data is not on the default state
This is the expected behavior in Ionic. Please review the Vue Lifecycle documentation here .
1 Like
Hi thank you for your quick reply, but how do I make the component go back to its original state, without using those lifecycle?
Or rather, in ionic we have to make use of those life cycle,
Well to tell, at first I thought its a bad thing to have this IONIC lifecycle, but I guess it is how the app make it faster
Right, you would need to use Ionic’s lifecycle methods or you need to clear the login form before navigating to the next route.
It is by design that Ionic keeps pages in the DOM for these two reasons:
We can maintain the state of the old page (data on the screen, scroll position, etc…).
We can provide a smoother transition back to the page since it is already there and does not need to be created.
1 Like
The problem now is,
the life cycle is not working
After routing to dashboard, I cant go back to the previous page
[image]
Clicking logout should be routed to Login, but when clicking logout, it does not work
The weird thing is, the Ionic Cycle works but does not display the page
Also the onIonViewDidLeave cycle is not being called, does this mean the leave event didnot trigger? but why?
[image]
This is how I routed back to login page
[image]
finally got the issue working, one of my pages does not have ion-page
which is required when using route. now the lifecycle is working properly
1 Like