-
Notifications
You must be signed in to change notification settings - Fork 155
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
Routing + link building + Url API #537
Comments
Hi, I just released the enum_paths crate, which might make defining routes easier. Maybe we can use it? Basically it derives methods for nested enums to convert them from and to / separated strings. |
This is a router that I implemented using subscriptions to the current I am not sure if there is anything missing, but all of these work:
Also there is no generated mapping between There also is the boilerplate in the |
Another point might be refactoring the |
For anyone interested, my components crate just gained a generic |
Hello guys, Well Here are 2 issues I have just created : https://github.com/arn-the-long-beard/seed-routing/issues. There are several steps we need to complete before publishing it as a crate or integrating into Seed
Let me know if you have some inputs and/or have questions 😉 |
Hello guys, We are still working on the Hey @mankinskin , would you like to take a look at it ? 😄 |
Hi @arn-the-long-beard ! Wow, looks like you've come a long way since I last looked into that. Personally, I would keep polishing this and provide it as a decent utility crate, and maybe look to integrate it into seed natively in the future. The seed_routing crate adds a lot of features to remove boilerplate, and usually this comes at the cost of taking away some flexibility as you are fixing some rails for fast progress. I think there are basic tools in seed already for handling routing and building your own routing component, so this is not something with high priority for me right now. But this can certainly make building apps with seed faster, when it is well integrated. One thing I am still confused about is why you built a feature for managing the browser history, when the browser has a built in system for that? Does it do anything differently? Do you want to bypass that and do processing on the browser history on your page? Would be glad if you could explain this to me :) |
Thank you for your message 👍
It was written as requirement in one of the issue #383 maybe I misunderstand it . But yeah put it this way, it looks very useless that I built it. I forgot we could have access to it this way https://developer.mozilla.org/en-US/docs/Web/API/Window/history actually. On the other hand, I have never used the one directly from the browser in Angular and I have just discovered from your post that it is available in I do not know what to think about it right now. Maybe the whole thing is not needed. |
Ah okay, that clears it up, I kept wondering if I was missing something. I have never used Angular, only React a very little bit, so this seemed strange to me. But an abstraction of the browser history is actually really useful I guess, so you don't have to use low-level web_sys all the time. But I think it should really just be a shell to the browser history and not have any state itself, if it isn't for caching or things like that. |
Yes it makes sens. Probably what I was using in angular was calling the browser Api actually. I am almost sure now. |
Routing + link building + Url API are ones of the hardest things to design well and they are blockers on the way to the stable Seed core api.
Many related PRs and issues have been already created so I want to unite our effort in this "tracking" issue.
PRs:
Issues:
target
attribute - Seed shouldn't intercept links withtarget
attribute #497Motivation for the current routing
The previous API supported the app architecture, where you have one central router with
Route
s.The
Route
was created from theUrl
and then the associatedPage
/ pageModel
was created from thisRoute
.Problems:
Url
,Page
andRoute
often introduces a lot of boilerplate (especiallyFrom
implementations).Url
->Route
->Page
transformations and it breaks encapsulation and introduces a lot of boilerplate.Routes
. It means all pages have to have access to the central router - it breaks encapsulation even more and introduces another boilerplate when you want to have typed links (and you want to have typed links).Also the previous routing / Url didn't take into account a custom base url path. So it was a Seed user's problem to implement it properly, unfortunately.
Feedback for the current routing / urls:
Url
doesn't represent the entire url (it doesn't contain a domain, protocol, port, etc.).Url
is "stateful". (It's stateful because it works a bit like iterators.)The text was updated successfully, but these errors were encountered: