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

Refactor URL logic #3

Closed
alexeyinkin opened this issue Nov 17, 2023 · 10 comments
Closed

Refactor URL logic #3

alexeyinkin opened this issue Nov 17, 2023 · 10 comments

Comments

@alexeyinkin
Copy link

Steps to reproduce:

  1. Open any package stats: https://pubstats.dev/#/packages/cupertino_icons
  2. Edit the URL in the address bar to change the package name
  3. Press Enter

Expected: Navigated to the new package.
Actual: The URL change is reverted, still viewing the old package.

The problem is from not using Navigator 2.0, and because the URL is parsed only once in DataController.create() in main().

@alexeyinkin
Copy link
Author

This one I can fix if you approve my package for routing: https://pub.dev/packages/app_state

If you care about maintainability, the largest app it was used is Apache Beam Playground: https://play.beam.apache.org
Approved by their engineers, no problems so far.

@Rexios80
Copy link
Owner

I tried looking into this but gave up for now. Is it possible to have the navigation route update without actually pushing a new page? The entire app is actually just on one route.

@Rexios80
Copy link
Owner

Or is it possible to listen for URL changes outside of the router?

@Rexios80 Rexios80 changed the title URL change does not navigate to another package Refactor URL logic Nov 17, 2023
@alexeyinkin
Copy link
Author

In theory, it is possible to listen to the URL change and do something instantly, and that is what Navigator 2.0 is all about. However, in my apps I have seen it reloading the app at the given URL, which is still better than reverting the change. I did not investigate further because reloading was OK for me.

@Rexios80
Copy link
Owner

Rexios80 commented Nov 17, 2023

I'm fine with the page reloading when the URL is manually changed, but what I don't want is the app to try and navigate between states when the route is updated by the UI

@alexeyinkin
Copy link
Author

No, programmatic updates of the address bar do not cause reload with Navigator 2.0, just like it is the case now in the app.

@Rexios80
Copy link
Owner

Rexios80 commented Nov 17, 2023

What I'm saying is if we wanted to use the navigator to go from package1 to package2 and we did Navigator.pushNamed('/packages/package2') would it be possible for that call to update the route and NOT actually navigate

@Rexios80
Copy link
Owner

This should be fixed on https://beta.pubstats.dev. Let me know if it works for you.

@Rexios80
Copy link
Owner

Hey the navigation buttons work too and all I had to do was bypass the Flutter Navigator entirely 🙃

@Rexios80
Copy link
Owner

Closing since this appears to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants