parent
7ac72dc89c
commit
29f5f02a16
15
src/Main.elm
15
src/Main.elm
|
@ -160,7 +160,14 @@ changeRouteTo :
|
||||||
-> ( Model, Cmd Msg )
|
-> ( Model, Cmd Msg )
|
||||||
changeRouteTo currentModel url =
|
changeRouteTo currentModel url =
|
||||||
let
|
let
|
||||||
attempteQuery (( newModel, cmd ) as pair) =
|
attempteQuery ( newModel, cmd ) =
|
||||||
|
let
|
||||||
|
-- We intentially throw away Cmd
|
||||||
|
-- because we don't want to perform any effects
|
||||||
|
-- in this cases where route itself doesn't change
|
||||||
|
noEffects =
|
||||||
|
( newModel, Cmd.none )
|
||||||
|
in
|
||||||
case ( currentModel.route, newModel.route ) of
|
case ( currentModel.route, newModel.route ) of
|
||||||
( Route.Packages arg1, Route.Packages arg2 ) ->
|
( Route.Packages arg1, Route.Packages arg2 ) ->
|
||||||
if
|
if
|
||||||
|
@ -173,7 +180,7 @@ changeRouteTo currentModel url =
|
||||||
submitQuery newModel ( newModel, cmd )
|
submitQuery newModel ( newModel, cmd )
|
||||||
|
|
||||||
else
|
else
|
||||||
pair
|
noEffects
|
||||||
|
|
||||||
( Route.Options arg1, Route.Options arg2 ) ->
|
( Route.Options arg1, Route.Options arg2 ) ->
|
||||||
if
|
if
|
||||||
|
@ -186,14 +193,14 @@ changeRouteTo currentModel url =
|
||||||
submitQuery newModel ( newModel, cmd )
|
submitQuery newModel ( newModel, cmd )
|
||||||
|
|
||||||
else
|
else
|
||||||
pair
|
noEffects
|
||||||
|
|
||||||
( a, b ) ->
|
( a, b ) ->
|
||||||
if a /= b then
|
if a /= b then
|
||||||
submitQuery newModel ( newModel, cmd )
|
submitQuery newModel ( newModel, cmd )
|
||||||
|
|
||||||
else
|
else
|
||||||
pair
|
noEffects
|
||||||
in
|
in
|
||||||
case Route.fromUrl url of
|
case Route.fromUrl url of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
|
|
Loading…
Reference in a new issue