Zaid-Ajaj / Feliz.Router

A router component for React and Elmish that is focused, powerful and extremely easy to use.
MIT License
78 stars 16 forks source link

Optionally do replaceState instead of pushState when calling Router.navigate #2

Closed kerams closed 5 years ago

kerams commented 5 years ago

In some cases you don't want to affect the history when chaning the URL, so it would be nice to have a parameter for this on Router.navigate

Zaid-Ajaj commented 5 years ago

Sounds good, but do you normally want to it have apply to all navigate operations if you set it globally in router itself:

Router.router [
  Router.mode.history // <-- this property?
  Router.onUrlChanged (UrlChanged >> dispatch)
  Router.application currentPage
]

or would you rather have a parameter on navigate:

Router.navigate("users", Router.modifyHistory) // <-- this?
// or
Router.navigate("users", Router.mode.history) // <-- maybe this?
kerams commented 5 years ago

The latter for sure. Then I'm not certain whether I'd like a parameter or a new method (with overloads) that does not modify history.

Zaid-Ajaj commented 5 years ago

I've added it as an optional parameter as of v1.1.0

Router.navigate("users", HistoryMode.ReplaceState)
// etc.
kerams commented 5 years ago

Awesome, appreciate it.