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

Routes with query segments don't work #1511

Closed
1 of 3 tasks
rvolz opened this issue Oct 3, 2023 · 2 comments
Closed
1 of 3 tasks

Routes with query segments don't work #1511

rvolz opened this issue Oct 3, 2023 · 2 comments
Labels
router Related to the router implementation

Comments

@rvolz
Copy link

rvolz commented Oct 3, 2023

Problem

Creating a route with query segments according to the recipe in the router docs produces errors. The query segment information is not passed on to the receiving component.

impl FromQuery for SearchQuerySegments {
    fn from_query(query: &str) -> Self {
        debug!("from query {:?}", query);
        ...

According to the browser log FromQuery::from_query always gets an empty query string, although the query string was written using Display::fmt.

Steps To Reproduce

Steps to reproduce the behavior:

  • Use the query segment router demo
  • Run dx serve and navigate to http://localhost:8080/blog?name=John&surname=Doe
  • The app will panic at line 53: panicked at 'called Option::unwrap() on a None value'. Because from_query received an empty query string, the query segments were never overwritten.

Environment:

  • Dioxus version: 0.4 (dioxus-router 0.4.1)
  • Rust version: 1.72.1, stable
  • OS info: Linux, Ubuntu
  • App platform: web

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@ealmloff
Copy link
Member

ealmloff commented Oct 3, 2023

Query segments were fixed in #1406. If you run the example inside of the main repo it should be fixed. You can switch Dioxus to the git version in your Cargo.toml to fix the issue in your own project:

dioxus = { git = "https://github.com/DioxusLabs/dioxus" }

@ealmloff ealmloff added the router Related to the router implementation label Oct 3, 2023
@rvolz
Copy link
Author

rvolz commented Oct 4, 2023

Oops, didn't find this PR, sorry. Thanks for the hint, it needs all dioxus packages as git versions now, but it works.

@rvolz rvolz closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
router Related to the router implementation
Projects
None yet
Development

No branches or pull requests

2 participants