Closed MoonKraken closed 2 years ago
Right, so yew 0.19 dropped the old router implementation and added a new one. However, the new one lacks a few feature, mainly the fact that you can nest routers. Which is an important feature the the stuff I am using it.
So, I did a port of the old (yew 0.18) router and made it work with yew 0.19.
yew-oauth2
doesn't need a router, however it offers additional components, which make sense in the context of using a router. those are marked with #[cfg(feature = "yew-router-nested")]
, like:
If you don't need this component, then you don't need to enable the router. Also should the package
feature just be a convenience feature. If you have yew-router-nested
active, then this should trigger automatically (however, with feature flags and optional dependencies, I am never really sure).
I hope this explains it a bit.
got it thanks ctron!
Initially I enabled the router feature, and specified 'yew-router-nested' as package for yew-router.
yew-router = { version = "0.16", package = "yew-router-nested" }
I noticed the router in the example code uses conventions from the Yew v0.18 documentation.
Just for fun I tried removing the "package" attribute and removing the yew-oauth2 router feature, and using the router macros and structs from the Yew v0.19 documentation. Everything seemed to continue working as expected (my component, which is below the
BrowserRouter
, is able to get the OAuth2Context context as expected).What's the backstory on why the router feature is needed and any idea why things seem to work without it?