mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-24 06:54:03 +03:00
Remove unused.
This commit is contained in:
parent
b58d148e31
commit
3c4df2fb28
@ -45,11 +45,6 @@ import Time
|
||||
import Url exposing (Url)
|
||||
|
||||
|
||||
type Transition
|
||||
= Loading Int Path
|
||||
| Submitting FormData
|
||||
|
||||
|
||||
{-| -}
|
||||
type alias Program userModel userMsg pageData actionData sharedData errorPage =
|
||||
Platform.Program Flags (Model userModel pageData actionData sharedData) (Msg userMsg pageData actionData sharedData errorPage)
|
||||
@ -430,7 +425,7 @@ update config appMsg model =
|
||||
-- parallel to the browser behavior
|
||||
|> startNewGetLoad url (UpdateCacheAndUrlNew True url Nothing)
|
||||
|
||||
FetcherComplete forPageReload fetcherKey transitionId___ userMsgResult ->
|
||||
FetcherComplete _ fetcherKey _ userMsgResult ->
|
||||
case userMsgResult of
|
||||
Ok ( userMsg, maybeFetcherDoneActionData ) ->
|
||||
( { model
|
||||
@ -772,7 +767,7 @@ update config appMsg model =
|
||||
toFetcherState : Dict String ( Int, Pages.Transition.FetcherState actionData ) -> Dict String (Pages.Transition.FetcherState actionData)
|
||||
toFetcherState inFlightFetchers =
|
||||
inFlightFetchers
|
||||
|> Dict.map (\_ ( index, fetcherState ) -> fetcherState)
|
||||
|> Dict.map (\_ ( _, fetcherState ) -> fetcherState)
|
||||
|
||||
|
||||
performUserMsg :
|
||||
@ -933,7 +928,7 @@ startFetcher fetcherKey transitionId options model =
|
||||
Http.expectBytesResponse (FetcherComplete False fetcherKey model.nextTransitionKey)
|
||||
(\bytes ->
|
||||
case bytes of
|
||||
Http.GoodStatus_ metadata bytesBody ->
|
||||
Http.GoodStatus_ _ bytesBody ->
|
||||
( options.decoder (Ok bytesBody)
|
||||
|> Just
|
||||
, Nothing
|
||||
@ -949,7 +944,7 @@ startFetcher fetcherKey transitionId options model =
|
||||
Http.NetworkError_ ->
|
||||
Err <| Http.NetworkError
|
||||
|
||||
Http.BadStatus_ metadata body ->
|
||||
Http.BadStatus_ metadata _ ->
|
||||
Err <| Http.BadStatus metadata.statusCode
|
||||
)
|
||||
, tracker = Nothing
|
||||
@ -980,7 +975,7 @@ startFetcher2 config fromPageReload fetcherKey transitionId formData model =
|
||||
Cmd.batch
|
||||
[ cancelStaleFetchers model
|
||||
, case Dict.get fetcherKey model.inFlightFetchers of
|
||||
Just ( inFlightId, inFlightFetcher ) ->
|
||||
Just ( inFlightId, _ ) ->
|
||||
Http.cancel (String.fromInt inFlightId)
|
||||
|
||||
Nothing ->
|
||||
@ -991,7 +986,7 @@ startFetcher2 config fromPageReload fetcherKey transitionId formData model =
|
||||
Http.expectBytesResponse (FetcherComplete fromPageReload fetcherKey model.nextTransitionKey)
|
||||
(\bytes ->
|
||||
case bytes of
|
||||
Http.GoodStatus_ metadata bytesBody ->
|
||||
Http.GoodStatus_ _ bytesBody ->
|
||||
let
|
||||
decodedAction : Maybe actionData
|
||||
decodedAction =
|
||||
@ -999,10 +994,10 @@ startFetcher2 config fromPageReload fetcherKey transitionId formData model =
|
||||
Just (ResponseSketch.RenderPage _ maybeAction) ->
|
||||
maybeAction
|
||||
|
||||
Just (ResponseSketch.HotUpdate pageData shared maybeAction) ->
|
||||
Just (ResponseSketch.HotUpdate _ _ maybeAction) ->
|
||||
maybeAction
|
||||
|
||||
Just (ResponseSketch.NotFound notFound) ->
|
||||
Just (ResponseSketch.NotFound _) ->
|
||||
Nothing
|
||||
|
||||
_ ->
|
||||
@ -1020,7 +1015,7 @@ startFetcher2 config fromPageReload fetcherKey transitionId formData model =
|
||||
Http.NetworkError_ ->
|
||||
Err <| Http.NetworkError
|
||||
|
||||
Http.BadStatus_ metadata body ->
|
||||
Http.BadStatus_ metadata _ ->
|
||||
Err <| Http.BadStatus metadata.statusCode
|
||||
)
|
||||
, tracker = Just (String.fromInt transitionId)
|
||||
@ -1042,7 +1037,7 @@ cancelStaleFetchers model =
|
||||
model.inFlightFetchers
|
||||
|> Dict.toList
|
||||
|> List.filterMap
|
||||
(\( fetcherKey, ( id, fetcher ) ) ->
|
||||
(\( _, ( id, fetcher ) ) ->
|
||||
case fetcher.status of
|
||||
Pages.Transition.FetcherReloading _ ->
|
||||
Http.cancel (String.fromInt id)
|
||||
@ -1257,7 +1252,7 @@ fetchRouteData forPageDataReload transitionKey toMsg config url details =
|
||||
Http.NetworkError_ ->
|
||||
Err Http.NetworkError
|
||||
|
||||
Http.BadStatus_ metadata body ->
|
||||
Http.BadStatus_ _ body ->
|
||||
body
|
||||
|> Bytes.Decode.decode config.decodeResponse
|
||||
|> Result.fromMaybe "Decoding error"
|
||||
@ -1309,7 +1304,7 @@ startNewGetLoad urlToGet toMsg ( model, effect ) =
|
||||
cancelIfStale : Effect userMsg pageData actionData sharedData userEffect errorPage
|
||||
cancelIfStale =
|
||||
case model.transition of
|
||||
Just ( transitionKey, Pages.Transition.Loading path loadingKind ) ->
|
||||
Just ( transitionKey, Pages.Transition.Loading _ _ ) ->
|
||||
CancelRequest transitionKey
|
||||
|
||||
_ ->
|
||||
@ -1320,13 +1315,13 @@ startNewGetLoad urlToGet toMsg ( model, effect ) =
|
||||
, transition =
|
||||
( model.nextTransitionKey
|
||||
, case model.transition of
|
||||
Just ( transitionKey, Pages.Transition.LoadAfterSubmit submitData _ _ ) ->
|
||||
Just ( _, Pages.Transition.LoadAfterSubmit submitData _ _ ) ->
|
||||
Pages.Transition.LoadAfterSubmit
|
||||
submitData
|
||||
(urlToGet.path |> Path.fromString)
|
||||
Pages.Transition.Load
|
||||
|
||||
Just ( transitionKey, Pages.Transition.Submitting submitData ) ->
|
||||
Just ( _, Pages.Transition.Submitting submitData ) ->
|
||||
Pages.Transition.LoadAfterSubmit
|
||||
submitData
|
||||
(urlToGet.path |> Path.fromString)
|
||||
|
@ -31,7 +31,7 @@ import Pages.ProgramConfig exposing (ProgramConfig)
|
||||
import Pages.SiteConfig exposing (SiteConfig)
|
||||
import Pages.StaticHttp.Request
|
||||
import Path exposing (Path)
|
||||
import RenderRequest exposing (IncludeHtml(..), RenderRequest)
|
||||
import RenderRequest exposing (RenderRequest)
|
||||
import RequestsAndPending exposing (RequestsAndPending)
|
||||
import TerminalText as Terminal
|
||||
import Url exposing (Url)
|
||||
@ -106,7 +106,7 @@ cliApplication config =
|
||||
|> Tuple.mapSecond (perform site renderRequest config)
|
||||
, update =
|
||||
\msg model ->
|
||||
update site config msg model
|
||||
update config msg model
|
||||
|> Tuple.mapSecond (perform site model.maybeRequestJson config)
|
||||
, subscriptions =
|
||||
\_ ->
|
||||
@ -279,9 +279,6 @@ perform site renderRequest config effect =
|
||||
|> config.sendPageData
|
||||
|> Cmd.map never
|
||||
|
||||
Effect.Continue ->
|
||||
Cmd.none
|
||||
|
||||
|
||||
flagsDecoder :
|
||||
Decode.Decoder
|
||||
@ -340,7 +337,6 @@ init site renderRequest config flags =
|
||||
)
|
||||
in
|
||||
updateAndSendPortIfDone
|
||||
site
|
||||
config
|
||||
{ staticResponses = StaticResponses.empty Effect.NoEffect
|
||||
, errors =
|
||||
@ -357,7 +353,6 @@ init site renderRequest config flags =
|
||||
|
||||
Err error ->
|
||||
updateAndSendPortIfDone
|
||||
site
|
||||
config
|
||||
{ staticResponses = StaticResponses.empty Effect.NoEffect
|
||||
, errors =
|
||||
@ -461,7 +456,7 @@ initLegacy site ((RenderRequest.SinglePage includeHtml singleRequest _) as rende
|
||||
Nothing ->
|
||||
--sendSinglePageProgress site model.allRawResponses config model payload
|
||||
(case isAction of
|
||||
Just actionRequest ->
|
||||
Just _ ->
|
||||
config.action (RenderRequest.maybeRequestPayload renderRequest |> Maybe.withDefault Json.Encode.null) serverRequestPayload.frontmatter |> DataSource.map Just
|
||||
|
||||
Nothing ->
|
||||
@ -473,7 +468,7 @@ initLegacy site ((RenderRequest.SinglePage includeHtml singleRequest _) as rende
|
||||
actionHeaders2 : Maybe { statusCode : Int, headers : List ( String, String ) }
|
||||
actionHeaders2 =
|
||||
case something of
|
||||
Just (PageServerResponse.RenderPage responseThing actionThing) ->
|
||||
Just (PageServerResponse.RenderPage responseThing _) ->
|
||||
Just responseThing
|
||||
|
||||
Just (PageServerResponse.ServerResponse responseThing) ->
|
||||
@ -500,7 +495,7 @@ initLegacy site ((RenderRequest.SinglePage includeHtml singleRequest _) as rende
|
||||
maybeActionData : Maybe actionData
|
||||
maybeActionData =
|
||||
case something of
|
||||
Just (PageServerResponse.RenderPage responseThing actionThing) ->
|
||||
Just (PageServerResponse.RenderPage _ actionThing) ->
|
||||
Just actionThing
|
||||
|
||||
_ ->
|
||||
@ -615,7 +610,7 @@ initLegacy site ((RenderRequest.SinglePage includeHtml singleRequest _) as rende
|
||||
--PageServerResponse.ServerResponse serverResponse
|
||||
-- TODO handle error?
|
||||
let
|
||||
( actionHeaders, byteEncodedPageData ) =
|
||||
( _, byteEncodedPageData ) =
|
||||
( serverResponse.headers
|
||||
--ignored1.headers
|
||||
, PageServerResponse.toRedirect serverResponse
|
||||
@ -784,7 +779,7 @@ initLegacy site ((RenderRequest.SinglePage includeHtml singleRequest _) as rende
|
||||
|
||||
RenderRequest.NotFound notFoundPath ->
|
||||
(DataSource.map2
|
||||
(\resolved1 resolvedGlobalHeadTags ->
|
||||
(\_ _ ->
|
||||
render404Page config
|
||||
Nothing
|
||||
--(Result.toMaybe sharedDataResult)
|
||||
@ -810,30 +805,28 @@ initLegacy site ((RenderRequest.SinglePage includeHtml singleRequest _) as rende
|
||||
}
|
||||
in
|
||||
StaticResponses.nextStep initialModel
|
||||
|> nextStepToEffect site
|
||||
|> nextStepToEffect
|
||||
config
|
||||
initialModel
|
||||
|
||||
|
||||
updateAndSendPortIfDone :
|
||||
SiteConfig
|
||||
-> ProgramConfig userMsg userModel route pageData actionData sharedData effect mappedMsg errorPage
|
||||
ProgramConfig userMsg userModel route pageData actionData sharedData effect mappedMsg errorPage
|
||||
-> Model route
|
||||
-> ( Model route, Effect )
|
||||
updateAndSendPortIfDone site config model =
|
||||
updateAndSendPortIfDone config model =
|
||||
StaticResponses.nextStep
|
||||
model
|
||||
|> nextStepToEffect site config model
|
||||
|> nextStepToEffect config model
|
||||
|
||||
|
||||
{-| -}
|
||||
update :
|
||||
SiteConfig
|
||||
-> ProgramConfig userMsg userModel route pageData actionData sharedData effect mappedMsg errorPage
|
||||
ProgramConfig userMsg userModel route pageData actionData sharedData effect mappedMsg errorPage
|
||||
-> Msg
|
||||
-> Model route
|
||||
-> ( Model route, Effect )
|
||||
update site config msg model =
|
||||
update config msg model =
|
||||
case msg of
|
||||
GotDataBatch batch ->
|
||||
let
|
||||
@ -844,7 +837,7 @@ update site config msg model =
|
||||
in
|
||||
StaticResponses.nextStep
|
||||
updatedModel
|
||||
|> nextStepToEffect site config updatedModel
|
||||
|> nextStepToEffect config updatedModel
|
||||
|
||||
GotBuildError buildError ->
|
||||
let
|
||||
@ -857,16 +850,15 @@ update site config msg model =
|
||||
in
|
||||
StaticResponses.nextStep
|
||||
updatedModel
|
||||
|> nextStepToEffect site config updatedModel
|
||||
|> nextStepToEffect config updatedModel
|
||||
|
||||
|
||||
nextStepToEffect :
|
||||
SiteConfig
|
||||
-> ProgramConfig userMsg userModel route pageData actionData sharedData effect mappedMsg errorPage
|
||||
ProgramConfig userMsg userModel route pageData actionData sharedData effect mappedMsg errorPage
|
||||
-> Model route
|
||||
-> StaticResponses.NextStep route Effect
|
||||
-> ( Model route, Effect )
|
||||
nextStepToEffect site config model nextStep =
|
||||
nextStepToEffect config model nextStep =
|
||||
case nextStep of
|
||||
StaticResponses.Continue httpRequests updatedStaticResponsesModel ->
|
||||
let
|
||||
@ -877,7 +869,7 @@ nextStepToEffect site config model nextStep =
|
||||
}
|
||||
in
|
||||
if List.isEmpty httpRequests then
|
||||
nextStepToEffect site
|
||||
nextStepToEffect
|
||||
config
|
||||
updatedModel
|
||||
(StaticResponses.nextStep
|
||||
|
@ -11,4 +11,3 @@ type Effect
|
||||
| Batch (List Effect)
|
||||
| SendSinglePage ToJsSuccessPayloadNewCombined
|
||||
| SendSinglePageNew Bytes ToJsSuccessPayloadNewCombined
|
||||
| Continue
|
||||
|
@ -475,7 +475,7 @@ startLowLevel apiRoutes staticHttpCache pages =
|
||||
(Encode.object [])
|
||||
)
|
||||
(config apiRoutes pages)
|
||||
, update = update site (config apiRoutes pages)
|
||||
, update = update (config apiRoutes pages)
|
||||
, view = \_ -> { title = "", body = [] }
|
||||
}
|
||||
|> ProgramTest.withSimulatedEffects simulateEffects
|
||||
@ -631,7 +631,7 @@ startWithRoutes pageToLoad _ staticHttpCache pages =
|
||||
(Encode.object [])
|
||||
)
|
||||
(config [] pages)
|
||||
, update = update site (config [] pages)
|
||||
, update = update (config [] pages)
|
||||
, view = \_ -> { title = "", body = [] }
|
||||
}
|
||||
|> ProgramTest.withSimulatedEffects simulateEffects
|
||||
@ -694,9 +694,6 @@ simulateEffects effect =
|
||||
, SimulatedEffect.Cmd.none
|
||||
]
|
||||
|
||||
Effect.Continue ->
|
||||
SimulatedEffect.Cmd.none
|
||||
|
||||
Effect.SendSinglePageNew _ toJsSuccessPayloadNewCombined ->
|
||||
SimulatedEffect.Cmd.batch
|
||||
[ toJsSuccessPayloadNewCombined
|
||||
|
Loading…
Reference in New Issue
Block a user