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

preserve query params when navigating #2704

Closed
wants to merge 1 commit into from
Closed

Conversation

devoncarew
Copy link
Member

  • preserve query params when navigating

When doing something like toggling the theme or channel, preserve any sample or id query param.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@devoncarew devoncarew requested a review from johnpryan November 2, 2023 23:13
required Map<String, String> params,
List<String> removeAny = const [],
}) {
final existingParams = Uri.parse(html.window.location.href).queryParameters;
Copy link
Member

@parlough parlough Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you instead be able to use GoRouterState.of(this) and use the URI exposed from that state?

I haven't used go_router really, so not sure :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to not have to reach directly to the window's url here. Happy to make changes here (and, John knows go_router well).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the version I came up with. It gets the current URI from the GoRouter's routeInformationProvider instead.

@johnpryan
Copy link
Contributor

Oops, I already implemented this in #2659. Would you mind taking a look at that version instead @devoncarew?

@devoncarew
Copy link
Member Author

Oops, I already implemented this in #2659. Would you mind taking a look at that version instead @devoncarew?

No worries; lets land your PR and I can double check that its a superset of this one in terms of functionality.

@devoncarew devoncarew marked this pull request as draft November 6, 2023 18:12
@devoncarew
Copy link
Member Author

closing in favor of #2707

@devoncarew devoncarew closed this Nov 9, 2023
@devoncarew devoncarew deleted the preserve_query_params branch November 17, 2023 22:31
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

Successfully merging this pull request may close these issues.

3 participants