-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Advanced navigation patterns #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Using the RouteHandler mixin you have some ability to implement a few of these functions. I started working on some similar stuff here: https://github.com/reapp/reapp-platform/blob/master/src/mixins/RoutedViewListMixin.js I agree, the more logic we can put into the navigation mixin, the better. Just need the community to come up with some pull requests. |
@natew your link is dead :( |
Please note: this commit is still a work in progress! All history objects subclass History and support 2 main methods: - pushState(state, path) - replaceState(state, path) This API more closely matches the HTML5 history API, with the notable omission of the title argument which is currently ignored in all major browsers. It provides the user with the ability to store state specific to the current invocation of the current URL without storing that data in the URL itself. However, history objects that do not use the HTML5 history API (HashHistory and RefreshHistory) store their state ID in the query string. This should help with #767 and #828. This work was inspired by work done by @taurose in #843 and @insin in #828.
@taurose let me know if we need to reopen this |
Could you please reopen it ? History.go() and History.state needed ! Is it something that is planed ? |
I think it would be great to offer some advanced navigation functionality such as:
canGoBack()
canGo(n)
go(n)
// n positive or negative, like with history.go(n)canGoBackTo(name, params, query)
goBackTo(name, params, query)
// goes back to when the route was last activestate.historyId
// e.g. for caching stuff based on current history entry like form data, or choosing animations by comparing to previous stateThis could also be very useful for implementing up navigation in Android.
While this seems trivial to implement for in memory locations (for react-native), in my opionion it would also be great to have this for web apps. I've actually played around with this in the past, and I think it might actually be possible to make this happen for
HistoryLocation
by managing a counter within the history state object. I don't think it's possible withHashLocation
orRefreshLocation
though.Implementation-wise there's also the problem of how to provide persistency (hitting refresh button, closing browser), but I first wanted to hear what you think about this API.
On a related note, the current
goBack()
doesn't play well when using browser navigation. With this kind of approach, it should be possible to make it work reliably.Related #765
The text was updated successfully, but these errors were encountered: