Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: vue, router-outlet not waiting for previous transition to finish #24226

Closed
4 of 6 tasks
mattsteve opened this issue Nov 16, 2021 · 7 comments · Fixed by #24533
Closed
4 of 6 tasks

bug: vue, router-outlet not waiting for previous transition to finish #24226

mattsteve opened this issue Nov 16, 2021 · 7 comments · Fixed by #24533
Labels
package: vue @ionic/vue package type: bug a confirmed bug report

Comments

@mattsteve
Copy link

Prerequisites

Ionic Framework Version

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

Current Behavior

This may be related to #23873 but I'm not sure so I've logged it separately.

I can pretty easily do a set of router commands that breaks the router.

router.replace("page1");
// User wait for router animation to finish
router.push("page2");
// User wait for router animation to finish
router.go(-1);
setTimeout(() => {
    router.replace("page3");
}, 50);

Problem 1:

The code above breaks the page, so it appears no further route modification really does anything. I have an example project of this.

Problem 2:

For the last 2 commands, I can't just do this without a setTimeout and expect the router to obey. The router should listen to subsequent commands, but it does not. It stops modifying the route after router.go(-1) if the setTimeout is not in place.

router.go(-1);
router.replace("page3");

Expected Behavior

My app has a tab setup but whenever you click a tab it should pop the history stack to undo any history pushes that were done inside of a single tab.

Example:
"Tab 1" opens "Page 1". "Page 1" has a button you can click that pushes "Page 2" to the router history.
"Tab 2" opens "Page 3", but in order to do so it must go back in the history 1 step to undo the "Page 2" push, then replace the "Page 1" history state with "Page 3".
This way, tapping on "Tab 2" no matter where you have previously navigated in the application results in the same history state as if you had tapped on it from just starting the application.

Steps to Reproduce

git clone https://github.com/mattsteve/ionic-vue-router-go-broken
npm install
npm run serve

Visit localhost:8080.

When the app starts it should be on Page 1. Click the "Go to next page" button.

image

At the bottom of the screen click the "Page 3" button.

image

Now at the bottom of the screen, click the "Page 1" button.

image

The URL changes, but you are not visually routed to Page 1.

Code Reproduction URL

https://github.com/mattsteve/ionic-vue-router-go-broken

Ionic Info

Ionic:

   Ionic CLI : 5.4.16

Utility:

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

System:

   NodeJS : v12.16.1
   npm    : 6.13.4
   OS     : Linux 5.3


  ────────────────────────────────────────────────────────────

           Ionic CLI update available: 5.4.16 → 6.7.0
                                
     The package name has changed from ionic to @ionic/cli!
                                
             To update, run: npm uninstall -g ionic
                 Then run: npm i -g @ionic/cli

  ────────────────────────────────────────────────────────────

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Nov 16, 2021
@liamdebeasi liamdebeasi changed the title bug: ion-router-outlet breaks when a routing command (such as replace) occurs during a transition. bug: vue, router-outlet not waiting for previous transition to finish Nov 17, 2021
@liamdebeasi liamdebeasi added package: vue @ionic/vue package type: bug a confirmed bug report labels Nov 17, 2021
@ionitron-bot ionitron-bot bot removed the triage label Nov 17, 2021
@tigohenryschultz
Copy link
Contributor

I hope this is related to: #23873 (comment)

Happy to test for you once you have a test package ready to install @liamdebeasi

@liamdebeasi
Copy link
Contributor

@mattsteve Can you give the following dev build a try and let me know if it fixes the issue?

npm install @ionic/vue@6.0.1-dev.1641582126.a28787c @ionic/vue-router@6.0.1-dev.1641582126.a28787c

@mattsteve
Copy link
Author

mattsteve commented Jan 7, 2022

It's definitely better in the scenario I mentioned. I'm testing on our original app, if I keep clicking around eventually it can break. It's difficult to pin down exactly why.

In one scenario, I've found a case where I click the back button and it does nothing (except update the URL), then it's in that broken state again where no matter what I click to navigate away all it does is update the URL.

image

However this isn't consistent, I'm not sure what exact state leads up to this.

I'm also finding sometimes it attempts to completely refresh the page, for some reason though I'm serving on localhost:8081 it redirects to localhost:8080 where nothing is being served.

@mattsteve
Copy link
Author

mattsteve commented Jan 7, 2022

For the scenario where it refreshes the page, this seems this consistently trigger it:
.replace
.push
.pop (via ion-back-button)
.replace

...or not. It was doing that for a while. I don't know why it's so erratic.

It seems to mostly work but if I keep clicking and going through a ton of pages eventually something breaks. Like the back button as described above.

@liamdebeasi
Copy link
Contributor

Thanks for testing. This sounds like either #23873 or #24432. We are also looking into those two, so I can keep you in the loop when we have dev builds for those.

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #24533, and a fix will be available in an upcoming release of Ionic Framework. Please keep an eye on the #23873 and #24432 threads for updates regarding those issues. Thank you! Also, thanks again for testing! The feedback you provided is really helpful.

tigohenryschultz added a commit to tigohenryschultz/ionic-framework that referenced this issue Jan 12, 2022
@ionitron-bot
Copy link

ionitron-bot bot commented Feb 9, 2022

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Feb 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
3 participants