Closed youroff closed 6 years ago
Do you mind asking about this on https://discourse.elm-lang.org/ or http://elmlang.herokuapp.com/ and refining the question? There should be a way to do what you want, but it is pretty different than what happens in Ember as far as I can tell from what you said. (Explicitly tracking what data you have loaded.) Others on the various community forums can help you work through what that might look like and the various tradeoffs from what you did with Ember.
Disclaimer: I'm new to Elm, so everything written below might make no sense, but I think a support for nested routes (pretty much how it's done in Ember) would be pretty nice.
Let's say, we have a product page, and routable tabs with relevant info, such as specs and reviews. The correspondent urls would look like
/products/1/specs
and/products/1/reviews
. Upper half of the page would be basic product info, that comes with product data from API, while only second half changes by making a request, something like: give me reviews for this product. Meanwhile with current approach both cases would have to be described as separate paths and resolved upon visit from scratch.Yes, it's probably possible to figure out the way to check if part of the data was already loaded and skip that part of resolution. But wouldn't it be nicer to represent the parsed path as a list of meaningful segments, like:
Segment (Product 1) (Segment Reviews End)
with typetype Path a = End | Segment a (Path a)
That would allow to tell right away that if Segment haven't changed then resolution and call to an API is unnecessary. As well as pick the correct function for inner view. And nesting can be arbitrary.
Does it make sense?