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

[labs/router] Make the current route field public #2512

Open
zandaqo opened this issue Feb 8, 2022 · 7 comments
Open

[labs/router] Make the current route field public #2512

zandaqo opened this issue Feb 8, 2022 · 7 comments

Comments

@zandaqo
Copy link

zandaqo commented Feb 8, 2022

At the moment, the current route field is protected. Making it public would allow other components to check which route is currently active. A simple accessor akin to Routes#params would do.

A use case example: navigation panel highlighting the currently active tab depending on the active route.

@christophe-g
Copy link
Contributor

Similar remark re current params

There might be scenario where you would like to access it. For instance, checking parameters from _parentRoutes in nested route scenario.

@zandaqo
Copy link
Author

zandaqo commented Feb 21, 2022

Similar remark re current params

There might be scenario where you would like to access it. For instance, checking parameters from _parentRoutes in nested route scenario.

There is a getter for params, Routes#params.

@christophe-g
Copy link
Contributor

There is a getter for params, [Routes#params]

Ouups ; )

@abdonrd
Copy link
Contributor

abdonrd commented May 17, 2022

Any news here? We also need the current route.

@cedx
Copy link

cedx commented Aug 25, 2022

Definitely needed 😅

@zandaqo
Copy link
Author

zandaqo commented Sep 5, 2022

With Routes#_currentRoute becoming private, checking the active route is nigh impossible. Can we have a getter for the current route? It's just a couple lines of code, if there are no objections, I'm willing to submit a PR.

@kevinpschaaf kevinpschaaf changed the title [router] Make the current route field public [labs/router] Make the current route field public Sep 8, 2022
@steve2507
Copy link

Similar issue here where I am currently resorting to tracking the state myself and updating this state during the enter() call. It would be great if the currentRoute would simply be exposed on the router.
Another option would be to fire an event whenever goto is called, containing the currentRoute as one of the event detail.
Having both would be perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Triaged
Development

No branches or pull requests

6 participants