Router component is not updated or rerender when going back

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 :slight_smile:

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:

  1. We can maintain the state of the old page (data on the screen, scroll position, etc…).
  2. 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

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 :slight_smile:

  • Thanks for all the hints
1 Like