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

Router on Liveview Doesn’t Respect or Alter URL #1733

Closed
1 of 3 tasks
DogeDark opened this issue Dec 20, 2023 · 3 comments
Closed
1 of 3 tasks

Router on Liveview Doesn’t Respect or Alter URL #1733

DogeDark opened this issue Dec 20, 2023 · 3 comments
Labels
liveview Related to the liveview renderer router Related to the router implementation

Comments

@DogeDark
Copy link
Member

Problem

On Liveview, the router does not respect the URL when directly accessing a route. E.g. trying the /tools route. Additionally, the links do not update the URL with the new route.

Steps To Reproduce

Reproducible Code Sample

  • Run the code sample provided.
  • Try out the links and go to the /tools route directly.

Expected behavior

The browser URL to update accordingly with the router and on fresh load the router respects the targetted URL.

Screenshots

2023-12-19_20-25-58.mp4

Environment:

  • Dioxus version: 0.4.3
  • Rust version: 1.73.0
  • OS info: Windows 10
  • App platform: Liveview

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

That code sample is missing the code to start the liveview history:

let history = LiveviewHistory::new(cx);
render! { Router::<Route> {
    config: || RouterConfig::default().history(history),
} }

#1736 changes the router to automatically enable the liveview history when the liveview feature is enabled

@ealmloff ealmloff added router Related to the router implementation liveview Related to the liveview renderer labels Dec 20, 2023
@bluebear94
Copy link

I am also experiencing this issue, but on fullstack instead of liveview. Is there a solution for fullstack?

@nxy7
Copy link

nxy7 commented Jun 24, 2024

I am also experiencing this issue, but on fullstack instead of liveview. Is there a solution for fullstack?

You probably figured it out by now, but I'll leave answer in case someone like me will be looking for it. To fix it you need to add features to dioxus. I've change Cargo.toml to include dioxus = { features = ["fullstack", "router", "web"], workspace = true } dioxus-router = { workspace = true }. Idk which one (probably 'web'), but one of those provides History implementation that then becomes router default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
liveview Related to the liveview renderer router Related to the router implementation
Projects
None yet
Development

No branches or pull requests

4 participants