I need to avoid repeated pages in the view stack.
If the app is pushing another page of a type which already is on the stack, first it need to pop pages from the stack until remove the first occurrence of this given type.
For example, given the following state of a view stack:
I want to push the page User, when the user clicks into a button in the page Purchases. The stack must to get in the following state:
Note that I can go to the User Page from several ways. For example, they can access the user from the page Users or from the UserEventsNotificationsPage. Also I can access Purchase from a global purchase list. So I don’t know if there’s a User page on the stack.
How could I check the existence of a given page on the view stack?