Remove some ContentCache references.

This commit is contained in:
Dillon Kearns 2022-02-03 20:11:22 -08:00
parent 69cdf963cf
commit 1ed1d8bb8a

View File

@ -23,7 +23,6 @@ import Internal.ApiRoute exposing (ApiRoute(..))
import Json.Decode as Decode import Json.Decode as Decode
import Json.Encode import Json.Encode
import PageServerResponse exposing (PageServerResponse) import PageServerResponse exposing (PageServerResponse)
import Pages.ContentCache as ContentCache exposing (ContentCache)
import Pages.Flags import Pages.Flags
import Pages.Http import Pages.Http
import Pages.Internal.ApplicationType as ApplicationType import Pages.Internal.ApplicationType as ApplicationType
@ -86,10 +85,6 @@ cliApplication :
-> Program (Maybe route) -> Program (Maybe route)
cliApplication config = cliApplication config =
let let
contentCache : ContentCache
contentCache =
ContentCache.init Nothing
site : SiteConfig siteData site : SiteConfig siteData
site = site =
getSiteConfig config getSiteConfig config
@ -112,11 +107,11 @@ cliApplication config =
Decode.decodeValue (RenderRequest.decoder config) flags Decode.decodeValue (RenderRequest.decoder config) flags
|> Result.withDefault RenderRequest.default |> Result.withDefault RenderRequest.default
in in
init site renderRequest contentCache config flags init site renderRequest config flags
|> Tuple.mapSecond (perform site renderRequest config config.toJsPort) |> Tuple.mapSecond (perform site renderRequest config config.toJsPort)
, update = , update =
\msg model -> \msg model ->
update site contentCache config msg model update site config msg model
|> Tuple.mapSecond (perform site model.maybeRequestJson config config.toJsPort) |> Tuple.mapSecond (perform site model.maybeRequestJson config config.toJsPort)
, subscriptions = , subscriptions =
\_ -> \_ ->
@ -397,19 +392,17 @@ flagsDecoder =
init : init :
SiteConfig siteData SiteConfig siteData
-> RenderRequest route -> RenderRequest route
-> ContentCache
-> ProgramConfig userMsg userModel route siteData pageData sharedData -> ProgramConfig userMsg userModel route siteData pageData sharedData
-> Decode.Value -> Decode.Value
-> ( Model route, Effect ) -> ( Model route, Effect )
init site renderRequest contentCache config flags = init site renderRequest config flags =
case Decode.decodeValue flagsDecoder flags of case Decode.decodeValue flagsDecoder flags of
Ok { staticHttpCache, isDevServer } -> Ok { staticHttpCache, isDevServer } ->
initLegacy site renderRequest { staticHttpCache = staticHttpCache, isDevServer = isDevServer } contentCache config flags initLegacy site renderRequest { staticHttpCache = staticHttpCache, isDevServer = isDevServer } config flags
Err error -> Err error ->
updateAndSendPortIfDone updateAndSendPortIfDone
site site
contentCache
config config
{ staticResponses = StaticResponses.error { staticResponses = StaticResponses.error
, errors = , errors =
@ -432,11 +425,10 @@ initLegacy :
SiteConfig siteData SiteConfig siteData
-> RenderRequest route -> RenderRequest route
-> { staticHttpCache : Dict String (Maybe String), isDevServer : Bool } -> { staticHttpCache : Dict String (Maybe String), isDevServer : Bool }
-> ContentCache
-> ProgramConfig userMsg userModel route siteData pageData sharedData -> ProgramConfig userMsg userModel route siteData pageData sharedData
-> Decode.Value -> Decode.Value
-> ( Model route, Effect ) -> ( Model route, Effect )
initLegacy site renderRequest { staticHttpCache, isDevServer } contentCache config flags = initLegacy site renderRequest { staticHttpCache, isDevServer } config flags =
let let
staticResponses : StaticResponses staticResponses : StaticResponses
staticResponses = staticResponses =
@ -507,34 +499,31 @@ initLegacy site renderRequest { staticHttpCache, isDevServer } contentCache conf
in in
StaticResponses.nextStep config initialModel Nothing StaticResponses.nextStep config initialModel Nothing
|> nextStepToEffect site |> nextStepToEffect site
contentCache
config config
initialModel initialModel
updateAndSendPortIfDone : updateAndSendPortIfDone :
SiteConfig siteData SiteConfig siteData
-> ContentCache
-> ProgramConfig userMsg userModel route siteData pageData sharedData -> ProgramConfig userMsg userModel route siteData pageData sharedData
-> Model route -> Model route
-> ( Model route, Effect ) -> ( Model route, Effect )
updateAndSendPortIfDone site contentCache config model = updateAndSendPortIfDone site config model =
StaticResponses.nextStep StaticResponses.nextStep
config config
model model
Nothing Nothing
|> nextStepToEffect site contentCache config model |> nextStepToEffect site config model
{-| -} {-| -}
update : update :
SiteConfig siteData SiteConfig siteData
-> ContentCache
-> ProgramConfig userMsg userModel route siteData pageData sharedData -> ProgramConfig userMsg userModel route siteData pageData sharedData
-> Msg -> Msg
-> Model route -> Model route
-> ( Model route, Effect ) -> ( Model route, Effect )
update site contentCache config msg model = update site config msg model =
case msg of case msg of
GotDataBatch batch -> GotDataBatch batch ->
let let
@ -561,7 +550,7 @@ update site contentCache config msg model =
StaticResponses.nextStep config StaticResponses.nextStep config
updatedModel updatedModel
Nothing Nothing
|> nextStepToEffect site contentCache config updatedModel |> nextStepToEffect site config updatedModel
Continue -> Continue ->
let let
@ -572,7 +561,7 @@ update site contentCache config msg model =
StaticResponses.nextStep config StaticResponses.nextStep config
updatedModel updatedModel
Nothing Nothing
|> nextStepToEffect site contentCache config updatedModel |> nextStepToEffect site config updatedModel
GotBuildError buildError -> GotBuildError buildError ->
let let
@ -586,17 +575,16 @@ update site contentCache config msg model =
StaticResponses.nextStep config StaticResponses.nextStep config
updatedModel updatedModel
Nothing Nothing
|> nextStepToEffect site contentCache config updatedModel |> nextStepToEffect site config updatedModel
nextStepToEffect : nextStepToEffect :
SiteConfig siteData SiteConfig siteData
-> ContentCache
-> ProgramConfig userMsg userModel route siteData pageData sharedData -> ProgramConfig userMsg userModel route siteData pageData sharedData
-> Model route -> Model route
-> ( StaticResponses, StaticResponses.NextStep route ) -> ( StaticResponses, StaticResponses.NextStep route )
-> ( Model route, Effect ) -> ( Model route, Effect )
nextStepToEffect site contentCache config model ( updatedStaticResponsesModel, nextStep ) = nextStepToEffect site config model ( updatedStaticResponsesModel, nextStep ) =
case nextStep of case nextStep of
StaticResponses.Continue updatedAllRawResponses httpRequests maybeRoutes -> StaticResponses.Continue updatedAllRawResponses httpRequests maybeRoutes ->
let let
@ -655,7 +643,6 @@ nextStepToEffect site contentCache config model ( updatedStaticResponsesModel, n
in in
if List.isEmpty doNow && updatedRoutes /= model.staticRoutes then if List.isEmpty doNow && updatedRoutes /= model.staticRoutes then
nextStepToEffect site nextStepToEffect site
contentCache
config config
updatedModel updatedModel
(StaticResponses.nextStep config (StaticResponses.nextStep config