Remove obsolete Maybe.

This commit is contained in:
Dillon Kearns 2021-04-21 07:11:19 -07:00
parent 8f3eb14195
commit 8744024031
3 changed files with 33 additions and 45 deletions

View File

@ -370,7 +370,7 @@ main =
[ Shared.template.subscriptions path model.global |> Sub.map MsgGlobal
, templateSubscriptions route path model
]
, onPageChange = Just OnPageChange
, onPageChange = OnPageChange
, toJsPort = toJsPort
, fromJsPort = fromJsPort identity
, staticData = staticDataForRoute

View File

@ -363,22 +363,17 @@ update config appMsg model =
Ok ( ( _, contentJson, updatedCache ), pageData ) ->
let
( userModel, userCmd ) =
case config.onPageChange of
Just onPageChangeMsg ->
config.update
pageData.pageStaticData
(Just model.key)
(onPageChangeMsg
{ path = urlToPagePath url model.baseUrl
, query = url.query
, fragment = url.fragment
, metadata = config.urlToRoute url
}
)
pageData.userModel
_ ->
( pageData.userModel, Cmd.none )
config.update
pageData.pageStaticData
(Just model.key)
(config.onPageChange
{ path = urlToPagePath url model.baseUrl
, query = url.query
, fragment = url.fragment
, metadata = config.urlToRoute url
}
)
pageData.userModel
in
( { model
| url = url
@ -440,27 +435,22 @@ update config appMsg model =
let
updateResult =
if from404ToNon404 then
case config.onPageChange of
Just onPageChangeMsg ->
case model.pageData of
Ok pageData ->
config.update
pageStaticData
(Just model.key)
(onPageChangeMsg
{ path = urlToPagePath model.url model.baseUrl
, query = model.url.query
, fragment = model.url.fragment
, metadata = config.urlToRoute model.url
}
)
pageData.userModel
|> Just
case model.pageData of
Ok pageData ->
config.update
pageStaticData
(Just model.key)
(config.onPageChange
{ path = urlToPagePath model.url model.baseUrl
, query = model.url.query
, fragment = model.url.fragment
, metadata = config.urlToRoute model.url
}
)
pageData.userModel
|> Just
Err error ->
Nothing
_ ->
Err error ->
Nothing
else

View File

@ -57,12 +57,10 @@ type alias ProgramConfig userMsg userModel route siteStaticData pageStaticData s
)
)
, onPageChange :
Maybe
({ path : PagePath
, query : Maybe String
, fragment : Maybe String
, metadata : route
}
-> userMsg
)
{ path : PagePath
, query : Maybe String
, fragment : Maybe String
, metadata : route
}
-> userMsg
}