mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-01 16:36:19 +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
|
||||
( { model
|
||||
| url = url
|
||||
}
|
||||
( model
|
||||
, NoEffect
|
||||
)
|
||||
-- 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
|
||||
}
|
||||
|
||||
( userModel, _ ) =
|
||||
( userModel, userEffect ) =
|
||||
-- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
|
||||
-- instead of calling update, call pushUrl (I think?)
|
||||
-- TODO include user Cmd
|
||||
if stayingOnSamePath then
|
||||
( previousPageData.userModel, NoEffect )
|
||||
|
||||
else
|
||||
config.update model.pageFormState
|
||||
(model.inFlightFetchers |> toFetcherState)
|
||||
(model.transition |> Maybe.map Tuple.second)
|
||||
@ -626,6 +628,7 @@ update config appMsg model =
|
||||
}
|
||||
)
|
||||
previousPageData.userModel
|
||||
|> Tuple.mapSecond UserCmd
|
||||
|
||||
updatedModel : Model userModel pageData actionData sharedData
|
||||
updatedModel =
|
||||
@ -656,10 +659,13 @@ update config appMsg model =
|
||||
, currentPath = newUrl.path
|
||||
}
|
||||
, if not stayingOnSamePath && scrollToTopWhenDone then
|
||||
ScrollToTop
|
||||
Batch
|
||||
[ ScrollToTop
|
||||
, userEffect
|
||||
]
|
||||
|
||||
else
|
||||
NoEffect
|
||||
userEffect
|
||||
)
|
||||
|> (case maybeUserMsg of
|
||||
Just userMsg ->
|
||||
@ -1392,7 +1398,8 @@ loadDataAndUpdateUrl ( newPageData, newSharedData, newActionData ) maybeUserMsg
|
||||
, actionData = newActionData
|
||||
}
|
||||
|
||||
( userModel, _ ) =
|
||||
-- TODO use userEffect here?
|
||||
( userModel, userEffect ) =
|
||||
-- TODO if urlWithoutRedirectResolution is different from the url with redirect resolution, then
|
||||
-- instead of calling update, call pushUrl (I think?)
|
||||
-- TODO include user Cmd
|
||||
|
Loading…
Reference in New Issue
Block a user