OnPageChange behavior for same URL path RFC #184
dillonkearns
started this conversation in
Ideas
Replies: 1 comment
-
I like the idea of having this event on every page navigation even when it is a hash link I just feel like the name Not sure exactly what name I would give though, but maybe something like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The OnPageChange Msg allows users to listen for page change events since
elm-pages
wraps theBrowser.application
and handles routing.What should happen in these two cases?
/docs/getting-started
and click a link to/docs/getting-started#cli
)/docs
and you click a link to/docs
)It seems like the user should have some way to know about this event. So the obvious solution is to just fire
OnPageChange
in both cases. Because otherwise the user would simply have no way to handle those events.init
andCmd
s for these casesWhat about
init
? In cases (1) and (2), shouldinit
be triggered, causing the page's Model to be started from scratch, and firing off any user Cmd's for the page? This would mean that clicking to a URL fragment would cause a newinit
, for example if you click a link in the table of contents to take you to a new section. That feels a little strange in that case.One possible direction to explore is to give the user a way to call
init
inShared.elm
.Then you could define custom logic for how to handle those situations in your app. You could even trigger an event on page change.
That's pretty low-level, though, and it would be ideal to just "do the right thing" if there's a way to get intuitive behavior without exposing low-level details like that.
Beta Was this translation helpful? Give feedback.
All reactions