mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-01 07:45:22 +03:00
Replace another instance with single call to static request status.
This commit is contained in:
parent
560be03e85
commit
0c1e101ebd
@ -387,43 +387,28 @@ nextStep config siteMetadata mode secrets allRawResponses errors (StaticResponse
|
||||
case entry of
|
||||
NotFetched request rawResponses ->
|
||||
let
|
||||
usableRawResponses : RequestsAndPending
|
||||
usableRawResponses =
|
||||
rawResponses
|
||||
|> Dict.map
|
||||
(\key value ->
|
||||
value
|
||||
|> Result.map Just
|
||||
|> Result.withDefault Nothing
|
||||
)
|
||||
staticRequestsStatus =
|
||||
allRawResponses
|
||||
|> StaticHttpRequest.cacheRequestResolution ApplicationType.Cli request
|
||||
|
||||
hasPermanentError =
|
||||
usableRawResponses
|
||||
|> StaticHttpRequest.permanentError ApplicationType.Cli request
|
||||
|> isJust
|
||||
case staticRequestsStatus of
|
||||
StaticHttpRequest.HasPermanentError _ ->
|
||||
True
|
||||
|
||||
_ ->
|
||||
False
|
||||
|
||||
hasPermanentHttpError =
|
||||
not (List.isEmpty errors)
|
||||
|
||||
--|> List.any
|
||||
-- (\error ->
|
||||
-- case error of
|
||||
-- FailedStaticHttpRequestError _ ->
|
||||
-- True
|
||||
--
|
||||
-- _ ->
|
||||
-- False
|
||||
-- )
|
||||
( allUrlsKnown, knownUrlsToFetch ) =
|
||||
StaticHttpRequest.resolveUrls
|
||||
ApplicationType.Cli
|
||||
request
|
||||
(rawResponses
|
||||
|> Dict.map (\key value -> value |> Result.withDefault "" |> Just)
|
||||
--|> Dict.union (allRawResponses |> Dict.Extra.filterMap (\_ value -> value))
|
||||
--|> Dict.map (\key value -> value)
|
||||
|> Dict.union allRawResponses
|
||||
)
|
||||
case staticRequestsStatus of
|
||||
StaticHttpRequest.Incomplete newUrlsToFetch ->
|
||||
( False, newUrlsToFetch )
|
||||
|
||||
_ ->
|
||||
( True, [] )
|
||||
|
||||
fetchedAllKnownUrls =
|
||||
(rawResponses
|
||||
|
Loading…
Reference in New Issue
Block a user