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

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
)
} }