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 [ Shared.template.subscriptions path model.global |> Sub.map MsgGlobal
, templateSubscriptions route path model , templateSubscriptions route path model
] ]
, onPageChange = Just OnPageChange , onPageChange = OnPageChange
, toJsPort = toJsPort , toJsPort = toJsPort
, fromJsPort = fromJsPort identity , fromJsPort = fromJsPort identity
, staticData = staticDataForRoute , staticData = staticDataForRoute

View File

@ -363,12 +363,10 @@ update config appMsg model =
Ok ( ( _, contentJson, updatedCache ), pageData ) -> Ok ( ( _, contentJson, updatedCache ), pageData ) ->
let let
( userModel, userCmd ) = ( userModel, userCmd ) =
case config.onPageChange of
Just onPageChangeMsg ->
config.update config.update
pageData.pageStaticData pageData.pageStaticData
(Just model.key) (Just model.key)
(onPageChangeMsg (config.onPageChange
{ path = urlToPagePath url model.baseUrl { path = urlToPagePath url model.baseUrl
, query = url.query , query = url.query
, fragment = url.fragment , fragment = url.fragment
@ -376,9 +374,6 @@ update config appMsg model =
} }
) )
pageData.userModel pageData.userModel
_ ->
( pageData.userModel, Cmd.none )
in in
( { model ( { model
| url = url | url = url
@ -440,14 +435,12 @@ update config appMsg model =
let let
updateResult = updateResult =
if from404ToNon404 then if from404ToNon404 then
case config.onPageChange of
Just onPageChangeMsg ->
case model.pageData of case model.pageData of
Ok pageData -> Ok pageData ->
config.update config.update
pageStaticData pageStaticData
(Just model.key) (Just model.key)
(onPageChangeMsg (config.onPageChange
{ path = urlToPagePath model.url model.baseUrl { path = urlToPagePath model.url model.baseUrl
, query = model.url.query , query = model.url.query
, fragment = model.url.fragment , fragment = model.url.fragment
@ -460,9 +453,6 @@ update config appMsg model =
Err error -> Err error ->
Nothing Nothing
_ ->
Nothing
else else
Nothing Nothing
in in

View File

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