DioxusLabs / DioxusLabs/dioxus
Link's active_class not enabled when redirecting to another route on load
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
**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:
```rs
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:

After clicking on the Link:

**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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.