Ionic-framework: bug: @ionic/react-router not go back expected

Created on 25 Oct 2019  Â·  10Comments  Â·  Source: ionic-team/ionic-framework

Bug Report

Ionic version:
4.11.2

Current behavior:
At root page A, I redirect to page B, then C, then B again, when I go back, it go to root page A

Expected behavior:
It should not skip page C, it should go B>C>B>A

Other information:
I think the reason is @ionic/react-router maintain only a DOM node for each route pattern, when I visit the same route already in DOM, it will change the DOM‘s visibility

I fix the problem by this https://github.com/zawaliang/ionic-react-router-fix/blob/master/index.js
I maintain each DOM node for each page, not for route pattern, it works; but it may has some unexpected problems, so I wish it should be fixed in next version.

react bug

Most helpful comment

Thanks, we will look into this one further.

All 10 comments

Thanks for the issue. I am able to reproduce this. We will look into a fix!

Hello, this issue should be fixed in 4.11.3. Please give it a try and if you find more issues, comment here and we can reopen this issue.

Still experiencing this issue with 4.11.3

Thanks, we will look into this one further.

ok, think this is resolved now in 4.11.4, give it a try and let me know @aykamko, @zawaliang

The bug appears to be resolved! Thank you!

Thank you, the location stack is fixed.

But what I want is to keep every page state when I go back; but now when I go back, the page which be visited twice or more will render again。

eg:
from: A->B1->C->B2
B1 and B2 are the same route page, maybe has different url params, when go back from B2 to C, the B2 page wil remove from DOM, so when go back from C to B1, the B1 page will rebuild, the state will lost

Hi @zawaliang, I think this is due to the fact that B1 and B2 share the same ViewItem in the Ionic ViewStack. see #19891

@marcoromag Yes, it needs to be optimized

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.

Was this page helpful?
0 / 5 - 0 ratings