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

Link's active_class not enabled when redirecting to another route on load #3544

Open
sehnryr opened this issue Jan 11, 2025 · 0 comments
Open

Comments

@sehnryr
Copy link
Contributor

sehnryr commented Jan 11, 2025

Problem

Link is not active when redirecting from "/" on application load.

But using class: if (path == Route::Home {}) { "active" } instead of active_class: "active" works

Steps To Reproduce

Steps to reproduce the behavior:

  • use the router feature and have a Route defined like below:
enum Route {
	#[redirect("/", || Route::Home {})]
	
	#[route("/home")]
	Home {},
}
  • inside the Home component, have a Link which route to Home and an active_class attribute

Expected behavior

The active_class should be added to the Link component.

Screenshots

In the screenshots bellow I am showing the current route in the component using use_route above the Link.

Right after the application being opened:
image

After clicking on the Link:
image

Environment:

  • Dioxus version: master
  • Rust version: 1.83.0
  • OS info: Linux
  • App platform: desktop

Questionnaire

I don't have time to fix this right now, but maybe later

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

1 participant