-
Notifications
You must be signed in to change notification settings - Fork 1
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
Make all routes "refreshable" #82
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would have preferred to see each of these commits as its own PR. The introduction of the Token
type in particular stands on its own but adds a lot of noise when trying to see what the routing changes were.
termsEncoder terms = | ||
list <| List.map (\t -> string t) terms | ||
termsEncoder = | ||
list << List.map string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup of the lambda
src/elm/Resolver/Decoder.elm
Outdated
map2 (,) statsDecoder errors | ||
|
||
|
||
notStartedDecoder : Decoder ( Stats, Errors ) | ||
notStartedDecoder = | ||
map2 (,) (null NotStarted) (succeed Nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the Errors
type an alias for Maybe
? 😖
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This decoder confuses me. It's two constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, type alias Errors = Maybe (List Error)
. I decided not to tackle the modeling of that here.
This decoder is used when the response returns null
, and yes, it's a tuple of stats (NotStarted
, which is a nullary data constructor) and Nothing
(since there are no errors).
@@ -107,7 +109,7 @@ updateResolver : RM.Msg -> Model -> ( Model, Cmd Msg ) | |||
updateResolver msg model = | |||
let | |||
token = | |||
Maybe.withDefault "" <| currentToken model | |||
Maybe.withDefault (Token.fromString "") <| currentToken model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is an empty token even a thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not, but I wanted to avoid the larger refactor here (basically, we'd align the messages and routes in a way where we're guaranteed a token).
src/elm/Resolver/Update.elm
Outdated
startResolution token | ||
|
||
_ -> | ||
Cmd.none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A case
inside a let
inside a case
😬 . Thoughts on extracting some functions?
3b2870c
to
a5a174d
Compare
a5a174d
to
39307a9
Compare
What? ===== This looks at the current resolver status and, if the resolution hasn't started, starts it.
15636e1
to
a9917c6
Compare
What?
This updates routing to fire off any side-effects when the initial model is
loaded and we've parsed the URL, so any data necessary for the page is loaded
appropriately.
This doesn't allow for navigating forwards and backwards yet, however; there's
an issue currently with "refreshing" resolution after a new target is selected
that will need to be handled for that to work correctly. However, this improves
existing functionality and lays the foundation for additional extension.
This is a step towards resolution of #56.