mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-04 09:56:44 +03:00
Don't call a route's init when staying on the same path.
This commit is contained in:
parent
5ccf361985
commit
98736e0a39
@ -423,9 +423,7 @@ update config appMsg model =
|
|||||||
)
|
)
|
||||||
|
|
||||||
else
|
else
|
||||||
( { model
|
( model
|
||||||
| url = url
|
|
||||||
}
|
|
||||||
, NoEffect
|
, NoEffect
|
||||||
)
|
)
|
||||||
-- TODO is it reasonable to always re-fetch route data if you re-navigate to the current route? Might be a good
|
-- TODO is it reasonable to always re-fetch route data if you re-navigate to the current route? Might be a good
|
||||||
@ -605,10 +603,14 @@ update config appMsg model =
|
|||||||
, actionData = newActionData
|
, actionData = newActionData
|
||||||
}
|
}
|
||||||
|
|
||||||
( userModel, _ ) =
|
( userModel, userEffect ) =
|
||||||
-- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
|
-- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
|
||||||
-- instead of calling update, call pushUrl (I think?)
|
-- instead of calling update, call pushUrl (I think?)
|
||||||
-- TODO include user Cmd
|
-- TODO include user Cmd
|
||||||
|
if stayingOnSamePath then
|
||||||
|
( previousPageData.userModel, NoEffect )
|
||||||
|
|
||||||
|
else
|
||||||
config.update model.pageFormState
|
config.update model.pageFormState
|
||||||
(model.inFlightFetchers |> toFetcherState)
|
(model.inFlightFetchers |> toFetcherState)
|
||||||
(model.transition |> Maybe.map Tuple.second)
|
(model.transition |> Maybe.map Tuple.second)
|
||||||
@ -626,6 +628,7 @@ update config appMsg model =
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
previousPageData.userModel
|
previousPageData.userModel
|
||||||
|
|> Tuple.mapSecond UserCmd
|
||||||
|
|
||||||
updatedModel : Model userModel pageData actionData sharedData
|
updatedModel : Model userModel pageData actionData sharedData
|
||||||
updatedModel =
|
updatedModel =
|
||||||
@ -656,10 +659,13 @@ update config appMsg model =
|
|||||||
, currentPath = newUrl.path
|
, currentPath = newUrl.path
|
||||||
}
|
}
|
||||||
, if not stayingOnSamePath && scrollToTopWhenDone then
|
, if not stayingOnSamePath && scrollToTopWhenDone then
|
||||||
ScrollToTop
|
Batch
|
||||||
|
[ ScrollToTop
|
||||||
|
, userEffect
|
||||||
|
]
|
||||||
|
|
||||||
else
|
else
|
||||||
NoEffect
|
userEffect
|
||||||
)
|
)
|
||||||
|> (case maybeUserMsg of
|
|> (case maybeUserMsg of
|
||||||
Just userMsg ->
|
Just userMsg ->
|
||||||
@ -1392,7 +1398,8 @@ loadDataAndUpdateUrl ( newPageData, newSharedData, newActionData ) maybeUserMsg
|
|||||||
, actionData = newActionData
|
, actionData = newActionData
|
||||||
}
|
}
|
||||||
|
|
||||||
( userModel, _ ) =
|
-- TODO use userEffect here?
|
||||||
|
( userModel, userEffect ) =
|
||||||
-- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
|
-- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
|
||||||
-- instead of calling update, call pushUrl (I think?)
|
-- instead of calling update, call pushUrl (I think?)
|
||||||
-- TODO include user Cmd
|
-- TODO include user Cmd
|
||||||
|
Loading…
Reference in New Issue
Block a user