mirror of
https://github.com/ryan-haskell/elm-spa.git
synced 2024-11-22 11:31:58 +03:00
Update Main.elm
allow pushUrl to work without refreshing the page (calling init again). Taking inspiration from example app: https://github.com/ryannhg/elm-spa-realworld/blob/master/src/Main.elm#L84
This commit is contained in:
parent
51eb1976d4
commit
4a9d4f85c4
@ -84,7 +84,11 @@ update msg model =
|
||||
{ original | url = url }
|
||||
|
||||
( page, pageCmd ) =
|
||||
Pages.init (fromUrl url) shared
|
||||
if url.path == model.shared.url.path then
|
||||
Pages.load model.page shared
|
||||
|
||||
else
|
||||
Pages.init (fromUrl url) shared
|
||||
in
|
||||
( { model | page = page, shared = Pages.save page shared }
|
||||
, Cmd.map Pages pageCmd
|
||||
|
Loading…
Reference in New Issue
Block a user