Open jamesknelson opened 5 years ago
I'm very interested in this!
Okay :-)
Any ideas on the approach you'd take to putting this together?
Not at all! 🤡But I have really been enjoying Navi
at work and want to help out. This sounds like a fun project to tackle. Maybe we could start by chatting somewhere that's not GitHub?
Glad to hear that you're enjoying Navi at work :D Where do you think would be a good place to chat? Perhaps I should start a Spectrum?
Yeah, Spectrum, Slack, Gitter, what every you're digging!
Ok! Just created a spectrum: https://spectrum.chat/navi
Navi needs some dev tools. As a result of Navi's architecture, they should be able to support time travel and give you a window into what's going on under the hood.
I'd really appreciate any help putting them together. I'd be happy to contribute to and link to a quality project that's maintained by someone else.
How Navi Works (the 2 minute version)
When you pass Navi a new URL or Context, it will map them to an array of simple objects called Chunks, which are then reduced into your
Route
object with a Redux-like configurable reducer.The array of chunks corresponding to a single URL/context grows over time. Each Matcher (i.e.
mount()
,route()
,withView()
, etc.) maps a URL/context pair to an arbitrary number of chunks to the route during each iteration.There's one special type of chunk: "busy". When Navi encounters a busy chunk (which will contain a promise), it'll wait until that promise resolves or is rejected, and then it'll recompute the list of chunks from scratch (thus allowing it to grow over time). Once there are no busy chunks, the route is considered "steady".
Dev Tools
Due to Navi's architecture, it should be possible to visualize how each Route is computed in response to a Request or Context change, possibly as a list of actions.
Being able to see at a glance the information that is mapped to the current URL, and the process used to fetch it, should be useful for debugging routing issues. It would also allow for developers to pick a previous state and use that instead, i.e. time travel.