Pass in all metadata to make sure files are generated correctly.

This commit is contained in:
Dillon Kearns 2020-10-22 12:49:24 -07:00
parent e59aebf6dc
commit 05704eb744
3 changed files with 8 additions and 4 deletions

View File

@ -408,7 +408,7 @@ initLegacy { secrets, mode, staticHttpCache } toModel contentCache siteMetadata
-- TODO need to handle errors better?
StaticResponses.init staticHttpCache siteMetadata config []
in
StaticResponses.nextStep config (siteMetadata |> Result.map (List.take 1)) mode secrets staticHttpCache [] staticResponses
StaticResponses.nextStep config siteMetadata (siteMetadata |> Result.map (List.take 1)) mode secrets staticHttpCache [] staticResponses
|> nextStepToEffect contentCache config (Model staticResponses secrets [] staticHttpCache mode [] (siteMetadata |> Result.withDefault []))
|> Tuple.mapFirst toModel
@ -476,6 +476,7 @@ updateAndSendPortIfDone contentCache config siteMetadata model toModel =
in
StaticResponses.nextStep
config
siteMetadata
(Ok nextToProcess)
model.mode
model.secrets
@ -563,6 +564,7 @@ update contentCache siteMetadata config msg model =
drop1 updatedModel
in
StaticResponses.nextStep config
siteMetadata
(Ok nextToProcess)
updatedModel.mode
updatedModel.secrets
@ -584,6 +586,7 @@ update contentCache siteMetadata config msg model =
drop1 model
in
StaticResponses.nextStep config
siteMetadata
(Ok nextToProcess)
updatedModel.mode
updatedModel.secrets

View File

@ -211,16 +211,17 @@ nextStep :
)
}
-> Result (List BuildError) (List ( PagePath pathKey, metadata ))
-> Result (List BuildError) (List ( PagePath pathKey, metadata ))
-> Mode
-> SecretsDict
-> RequestsAndPending
-> List BuildError
-> StaticResponses
-> NextStep pathKey
nextStep config siteMetadata mode secrets allRawResponses errors (StaticResponses staticResponses) =
nextStep config allSiteMetadata siteMetadata mode secrets allRawResponses errors (StaticResponses staticResponses) =
let
metadataForGenerateFiles =
siteMetadata
allSiteMetadata
|> Result.withDefault []
|> List.map
-- TODO extract helper function that processes next step *for a single page* at a time

View File

@ -31,7 +31,7 @@ all =
[ test "andThen" <|
\() ->
StaticResponses.init Dict.empty (Ok []) config []
|> StaticResponses.nextStep config (Ok []) Mode.Dev (SecretsDict.unmasked Dict.empty) Dict.empty []
|> StaticResponses.nextStep config (Ok []) (Ok []) Mode.Dev (SecretsDict.unmasked Dict.empty) Dict.empty []
|> Expect.equal
(StaticResponses.Finish
(ToJsPayload.Success