mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-25 12:52:27 +03:00
Make sure send page progress events get kicked off when there are no initial requests from getStaticRoutes or generateFiles.
This commit is contained in:
parent
46ea40c715
commit
e11d359222
@ -699,18 +699,36 @@ nextStepToEffect contentCache config model ( updatedStaticResponsesModel, nextSt
|
||||
|
||||
Nothing ->
|
||||
model.unprocessedPages
|
||||
|
||||
updatedModel =
|
||||
{ model
|
||||
| allRawResponses = updatedAllRawResponses
|
||||
, pendingRequests = pending
|
||||
, staticResponses = updatedStaticResponsesModel
|
||||
, staticRoutes = updatedRoutes
|
||||
, unprocessedPages = updatedUnprocessedPages
|
||||
}
|
||||
in
|
||||
( { model
|
||||
| allRawResponses = updatedAllRawResponses
|
||||
, pendingRequests = pending
|
||||
, staticResponses = updatedStaticResponsesModel
|
||||
, staticRoutes = updatedRoutes
|
||||
, unprocessedPages = updatedUnprocessedPages
|
||||
}
|
||||
, doNow
|
||||
|> List.map Effect.FetchHttp
|
||||
|> Effect.Batch
|
||||
)
|
||||
if List.isEmpty doNow && updatedRoutes /= model.staticRoutes then
|
||||
nextStepToEffect contentCache
|
||||
config
|
||||
updatedModel
|
||||
(StaticResponses.nextStep config
|
||||
updatedModel.mode
|
||||
updatedModel.secrets
|
||||
updatedModel.allRawResponses
|
||||
updatedModel.errors
|
||||
updatedModel.staticResponses
|
||||
Nothing
|
||||
)
|
||||
|
||||
else
|
||||
( updatedModel
|
||||
, (doNow
|
||||
|> List.map Effect.FetchHttp
|
||||
)
|
||||
|> Effect.Batch
|
||||
)
|
||||
|
||||
StaticResponses.Finish toJsPayload ->
|
||||
case model.mode of
|
||||
|
@ -415,8 +415,13 @@ nextStep config mode secrets allRawResponses errors staticResponses_ maybeRoutes
|
||||
)
|
||||
|> Dict.fromList
|
||||
|> StaticResponses
|
||||
|
||||
newThing =
|
||||
[]
|
||||
in
|
||||
nextStep config mode secrets allRawResponses errors newState (Just staticRoutes)
|
||||
( newState
|
||||
, Continue allRawResponses newThing (Just staticRoutes)
|
||||
)
|
||||
|
||||
Err error_ ->
|
||||
( staticResponses_
|
||||
|
@ -21,6 +21,7 @@ import Pages.StaticHttp.Request as Request
|
||||
import PagesHttp
|
||||
import ProgramTest exposing (ProgramTest)
|
||||
import Regex
|
||||
import RenderRequest
|
||||
import Secrets
|
||||
import SimulatedEffect.Cmd
|
||||
import SimulatedEffect.Http as Http
|
||||
@ -828,7 +829,25 @@ startLowLevel generateFiles documentBodyResult staticHttpCache pages =
|
||||
|> StaticHttp.succeed
|
||||
, urlToRoute = .path >> Route
|
||||
, update = \_ _ _ _ -> ( (), Cmd.none )
|
||||
, staticData = \_ -> StaticHttp.succeed ()
|
||||
, staticData =
|
||||
\(Route pageRoute) ->
|
||||
let
|
||||
thing =
|
||||
pages
|
||||
|> Dict.fromList
|
||||
|> Dict.get
|
||||
(pageRoute
|
||||
|> String.split "/"
|
||||
|> List.filter (\pathPart -> pathPart /= "")
|
||||
)
|
||||
in
|
||||
case thing of
|
||||
Just request ->
|
||||
--\_ _ -> { view = \_ -> { title = "Title", body = Html.text "" }, head = [] }
|
||||
request |> StaticHttp.map (\_ -> ())
|
||||
|
||||
Nothing ->
|
||||
Debug.todo <| "Couldn't find page: " ++ pageRoute ++ "\npages: " ++ Debug.toString pages
|
||||
, site =
|
||||
\_ ->
|
||||
{ staticData = StaticHttp.succeed ()
|
||||
@ -852,9 +871,7 @@ startLowLevel generateFiles documentBodyResult staticHttpCache pages =
|
||||
in
|
||||
case thing of
|
||||
Just request ->
|
||||
request
|
||||
|> StaticHttp.map
|
||||
(\_ -> { view = \_ -> { title = "Title", body = Html.text "" }, head = [] })
|
||||
\_ _ -> { view = \_ -> { title = "Title", body = Html.text "" }, head = [] }
|
||||
|
||||
Nothing ->
|
||||
Debug.todo <| "Couldn't find page: " ++ Debug.toString page ++ "\npages: " ++ Debug.toString pages
|
||||
@ -900,7 +917,7 @@ startLowLevel generateFiles documentBodyResult staticHttpCache pages =
|
||||
-> ( model, Effect pathKey )
|
||||
-}
|
||||
ProgramTest.createDocument
|
||||
{ init = init Nothing identity contentCache config
|
||||
{ init = init RenderRequest.FullBuild identity contentCache config
|
||||
, update = update contentCache config
|
||||
, view = \_ -> { title = "", body = [] }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user