You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Frontend routing was introduced in Tyrian 0.7.0, and this was tested for navigation by button press and by anchor link... but not at the same time! 🤦
With the best of intentions, when an anchor link is clicked and the href is determined to be internal, we do a pushState to update the address bar. Makes sense, you've clicked a link and you're going to want to see that link reflected in the address bar.
The problem is that this results in inconsistent behaviour with buttons (that are being used for navigation) where the push state must be done by the user via Nav.pushUrl.
The work around if you have button AND anchor based navigation is very simple, you need two Msg's that both mean 'change page':
The first is for things like buttons, where no-one would expect the address bar to be automatically updated. When this message hits the update function, you also return Nav.pushUrlCmd if you want the address bar to change.
The second is for anchor (i.e. a(href := "/page")("my link") ) links, which you do NOT use with Nav.pushUrl, just return Cmd.None (or whatever else you want to do) because the address bar has been taken care of.
The text was updated successfully, but these errors were encountered:
Frontend routing was introduced in Tyrian 0.7.0, and this was tested for navigation by button press and by anchor link... but not at the same time! 🤦
With the best of intentions, when an anchor link is clicked and the href is determined to be internal, we do a
pushState
to update the address bar. Makes sense, you've clicked a link and you're going to want to see that link reflected in the address bar.The problem is that this results in inconsistent behaviour with buttons (that are being used for navigation) where the push state must be done by the user via
Nav.pushUrl
.The work around if you have button AND anchor based navigation is very simple, you need two
Msg
's that both mean 'change page':Nav.pushUrl
Cmd
if you want the address bar to change.a(href := "/page")("my link")
) links, which you do NOT use withNav.pushUrl
, just returnCmd.None
(or whatever else you want to do) because the address bar has been taken care of.The text was updated successfully, but these errors were encountered: