Skip to content

bug: router.replace eventually breaks routing #24432

Closed

Description

@tigohenryschultz

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

After navigating around using router.push and router.replace, eventually a view will linger.

Expected Behavior

Correct rendering of leaving/entering view items.

Steps to Reproduce

Navigating from View A1 -(replace)-> B/1 -(push)-> B/2 -(back button)-> B/1 -(replace)-> A1 -(replace)-> B1

B1 never gets render and is glitched onto A1.

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.16.3

Utility:

cordova-res : not installed globally
native-run : not installed globally

System:

NodeJS : v14.17.3
npm : 6.14.13
OS : Windows 10

Additional Information

No response

Activity

  1. added
    holiday triage
    on Dec 17, 2021
  2. ionitron-bot commented on Dec 17, 2021

    @ionitron-bot

    Thanks for the issue! This issue has been labeled as holiday triage. With the winter holidays quickly approaching, much of the Ionic Team will soon be taking time off. During this time, issue triaging and PR review will be delayed until the team begins to return. After this period, we will work to ensure that all new issues are properly triaged and that new PRs are reviewed.

    In the meantime, please read our Winter Holiday Triage Guide for information on how to ensure that your issue is triaged correctly.

    Thank you!

  3. removed
    holiday triage
    on Dec 17, 2021
  4. sean-perkins commented on Dec 17, 2021

    @sean-perkins
    Contributor

    Partially related to: #24226

    We may decide to group the Vue routing issues together to reduce individual & overlapping tasks for us internally.

  5. added
    type: bug
    on Dec 17, 2021
  6. tigohenryschultz commented on Dec 17, 2021

    @tigohenryschultz
    ContributorAuthor

    Partially related to: #24226

    We may decide to group the Vue routing issues together to reduce individual & overlapping tasks for us internally.

    Since I have a good understand of routing now I don't mind tackling the issues/tickets regarding it, they're pretty high priority issues for the company I work for and we don't want any negative app reviews from routes breaking so I've been given the go ahead to work on this.

  7. tigohenryschultz commented on Dec 20, 2021

    @tigohenryschultz
    ContributorAuthor

    Working on this issue in this pull request: #24433

  8. liamdebeasi commented on Jan 7, 2022

    @liamdebeasi
    Contributor

    @tigohenryschultz Do you have a reproduction case for this router.replace issue? I have a fix for #24226 and would like to test to see if my patch also fixes this issue.

    Note that this patch does not fix #23873 since that example does not use replace.

  9. tigohenryschultz commented on Jan 7, 2022

    @tigohenryschultz
    ContributorAuthor

    @tigohenryschultz Do you have a reproduction case for this router.replace issue? I have a fix for #24226 and would like to test to see if my patch also fixes this issue.

    Note that this patch does not fix #23873 since that example does not use replace.

    I've been side tracked getting the original test cases to pass but I do plan on adding tests for this specific scenario I ran into and the other ones I found while refactoring the code. Like:

    Sometimes a ViewItem would be added to multiple outlets
    The last tab you were on would not have ion-page-hidden when navigating away until re-entering the tab so the life cycles would not fire for it.

    On Monday I can add a test case for the specific scenario I ran into

  10. Lokilein commented on Jan 20, 2022

    @Lokilein

    I think I got a similar/ the same issue (details here => Ionic Forum: Ionic 5/6 with Vue: Pages do not change sometimes (URL does) )
    I tried some things, but using push instead of replace or back seems to help. I updated to ionic/vue 6.0.2 and still got the issue.

  11. tigohenryschultz commented on Jan 20, 2022

    @tigohenryschultz
    ContributorAuthor

    I've fixed this issue in a pull request but they have not merged it in yet.

  12. liamdebeasi commented on Feb 1, 2022

    @liamdebeasi
    Contributor

    Hi @Lokilein and @tigohenryschultz,

    I am investigating a fix for this issue. However, in order to verify the fix I need to test against a sample reproduction of the issue reported in this thread.

    Can you provide a GitHub repo that I can use to reproduce the issue described in #24432 (comment)?

  13. tigohenryschultz commented on Feb 1, 2022

    @tigohenryschultz
    ContributorAuthor

    prevRouteLastPathname becomes incorrect after some navigation steps causing the IonRouterOutlet to not find the correct 'leaving' viewItem. I'll try to create a sample if I have time but it is fixed in the pull request.

  14. liamdebeasi commented on Feb 1, 2022

    @liamdebeasi
    Contributor

    Thanks, a GitHub repo would be great. Even if the resolution here is to move forward with your PR, we would still need the sample app.

  15. tigohenryschultz commented on Feb 1, 2022

    @tigohenryschultz
    ContributorAuthor

    Not sure if thats possible, there's a lot of changes to the code and behavior to tabs to just simplify everything and reduce bugs/behave like a native browser going forward

  16. liamdebeasi commented on Feb 1, 2022

    @liamdebeasi
    Contributor

    Let's start with the GitHub repo for this particular bug and then we can assess from there. Thanks!

  17. Lokilein commented on Feb 4, 2022

    @Lokilein

    Hi there. I cannot share my repository, but I've recreated the bug here with instructions to reproduce it:
    https://github.com/Lokilein/ionicRoutingBug

  18. liamdebeasi commented on Feb 4, 2022

    @liamdebeasi
    Contributor

    Thanks! This particular reproduction does not use router.replace which is what is causing the issue reported in this thread. Does your repo reproduce a different issue?

  19. Lokilein commented on Feb 4, 2022

    @Lokilein

    Hmm, actually I am not completly sure. The original description also used the back action and the result is the same. I have to check if replace makes any difference, but I think it causes the same issue, that's why I replaced everything with push in my project for now.

  20. liamdebeasi commented on Feb 4, 2022

    @liamdebeasi
    Contributor

    Ok thanks. I have a potential solution that I am working on now for your scenario. I will post a dev build here when it is ready for testing.

  21. Lokilein commented on Feb 4, 2022

    @Lokilein

    Okay I've updated my example and now it fails faster by using the back button the first time. URL is changing but the page remains. I'm using replace now.

  22. liamdebeasi commented on Feb 4, 2022

    @liamdebeasi
    Contributor

    Thanks! Can you try the following dev build and let me know if it resolves the issue?

    npm install @ionic/[email protected] @ionic/[email protected]
    

    This dev build fixes the main replace issue in this thread as well as the other issue you reported in #24432. (Turns out they were related bugs 😄 )

  23. Lokilein commented on Feb 7, 2022

    @Lokilein

    This looks much better! I cannot reproduce any issue with this anymore, neither with back nor with replace 👍 Thank you very much!

    Can you tell when this will be in main?

  24. liamdebeasi commented on Feb 7, 2022

    @liamdebeasi
    Contributor

    I do not have an estimate of when this fix will be merged as it still needs to be reviewed by the team.

  25. added a commit that references this issue on Feb 7, 2022
    721a461
  26. liamdebeasi commented on Feb 7, 2022

    @liamdebeasi
    Contributor

    Thanks for the issue. This has been resolved via #24721 and a fix will be available in an upcoming release of Ionic Framework.

    Please feel free to continue testing the dev build.

  27. ionitron-bot commented on Mar 9, 2022

    @ionitron-bot

    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.

  28. locked and limited conversation to collaborators on Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: vuetype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions