Delete obsolete code (superceded by fetchRouteData).

This commit is contained in:
Dillon Kearns 2022-04-04 16:15:06 -07:00
parent 1667e84e97
commit d59c57ac01
3 changed files with 1 additions and 54 deletions

View File

@ -1,5 +1,5 @@
function elmPagesUiFile() {
return `port module Pages exposing (builtAt, reloadData)
return `port module Pages exposing (builtAt)
import Time
import Json.Decode
@ -9,19 +9,6 @@ import Json.Encode
builtAt : Time.Posix
builtAt =
Time.millisToPosix ${Math.round(global.builtAt.getTime())}
reloadData : { body : ( String, String ) } -> Cmd msg
reloadData options =
elmPagesReloadData
(Json.Encode.object
[ ( "content-type", options.body |> Tuple.first |> Json.Encode.string )
, ( "body", options.body |> Tuple.second |> Json.Encode.string )
]
)
port elmPagesReloadData : Json.Decode.Value -> Cmd msg
`;
}

View File

@ -27,12 +27,6 @@ function loadContentAndInitializeApp() {
loadNamedAnchor();
});
app.ports.elmPagesReloadData &&
app.ports.elmPagesReloadData.subscribe((data) => {
console.log("RELOAD DATA PORT!");
app.ports.fromJsPort.send({ tag: "Reload", data });
});
return app;
}

View File

@ -272,7 +272,6 @@ type Msg userMsg pageData sharedData errorPage
| UpdateCacheAndUrlNew Bool Url (Maybe userMsg) (Result Http.Error ( Url, ResponseSketch pageData sharedData ))
| PageScrollComplete
| HotReloadCompleteNew Bytes
| ReloadCurrentPageData RequestInfo
{-| -}
@ -396,11 +395,6 @@ update config appMsg model =
, FetchPageData Nothing url (UpdateCacheAndUrlNew False url Nothing)
)
ReloadCurrentPageData requestInfo ->
( model
, FetchPageData (Just requestInfo) model.url (UpdateCacheAndUrlNew False model.url Nothing)
)
UserMsg userMsg ->
case model.pageData of
Ok pageData ->
@ -670,16 +664,6 @@ application config =
(urls.currentUrl |> config.urlToRoute |> config.routeToPath |> Path.join)
pageData.userModel
|> Sub.map UserMsg
, config.fromJsPort
|> Sub.map
(\value ->
case value |> Decode.decodeValue fromJsPortDecoder of
Ok requestInfo ->
ReloadCurrentPageData requestInfo
Err _ ->
PageScrollComplete
)
, config.hotReloadData
|> Sub.map HotReloadCompleteNew
]
@ -725,24 +709,6 @@ withUserMsg config userMsg ( model, effect ) =
( model, effect )
fromJsPortDecoder : Decode.Decoder RequestInfo
fromJsPortDecoder =
Decode.field "tag" Decode.string
|> Decode.andThen
(\tag ->
case tag of
"Reload" ->
Decode.field "data"
(Decode.map2 RequestInfo
(Decode.field "content-type" Decode.string)
(Decode.field "body" Decode.string)
)
_ ->
Decode.fail <| "Unexpected tag " ++ tag
)
urlPathToPath : Url -> Path
urlPathToPath urls =
urls.path |> Path.fromString