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

View File

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

View File

@ -31,7 +31,7 @@ all =
[ test "andThen" <| [ test "andThen" <|
\() -> \() ->
StaticResponses.init Dict.empty (Ok []) config [] 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 |> Expect.equal
(StaticResponses.Finish (StaticResponses.Finish
(ToJsPayload.Success (ToJsPayload.Success