jaspr icon indicating copy to clipboard operation
jaspr copied to clipboard

Router: some missing features - feedback

Open daniel-v opened this issue 3 years ago • 2 comments

Hello there!

I'm looking into jaspr for a couple of hobby projects. I ran into an issue with Router. It is mentioned on wiki that it is WIP so I thought I might still be in time to provide some feedback.

  1. First thing I noticed is that you there is no option to specify custom location strategies. Currently only path is considered. Which means I cannot easily "point to" tabs on a specific page. Something like /my-awesome-page?tabbed-view=5-star.
  2. _ResolvedRoute is library private and therefore I cannot easily implement custom Route implementations either, nor can I extend ResolvedRoute since it is effectively sealed with default forwarding factory constructor.

Ultimately, I think my pain point is that I cannot customize routing which is quite restrictive. Even onGenerateRoute receives only the path. I think passing an URI to it would open up quite a few possibilities with minor code change. I could implement my custom routing logic.

Cheers!

daniel-v avatar Jun 28 '22 14:06 daniel-v

Hi, thanks for the feedback.

I will defenitely consider it in the new router implementation. This will probably be a complete rewrite anyways and not work in the same way, so the ResolvedRoute won't be an issue then.

Also when I start working on it, I plan to open a design/discussion issue so others can comment on it.

Unfortunately however, I won't be able to work on jaspr over the next 4 weeks.

In the meantime, you can use the ComponentsBinding.instance!.currentUri getter to get the current route both on the server and client if you want to implement some custom routing logic. I hope this helps for now.

schultek avatar Jun 29 '22 10:06 schultek

@daniel-v Hi have you tried https://pub.dev/packages/jaspr_router

nimr77 avatar Jul 13 '22 10:07 nimr77