Skip to content
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

History Manipulation #22

Open
eugenkiss opened this issue Jan 22, 2017 · 2 comments
Open

History Manipulation #22

eugenkiss opened this issue Jan 22, 2017 · 2 comments

Comments

@eugenkiss
Copy link

Great work on this project! I've created a similar project (https://github.com/eugenkiss/static-mobx-routing) and I'm comparing the different approaches we took to see if there are things to improve.

Consider the following use case. You are on the homepage (/). You enter the route /new-post and create a new post. This leads you to route /post/12. When you now press the browser's back button you go back directly to / instead of /new-post. The reason I find this intuitive is that the new post became the post with the id 12 and therefore it makes sense to replace the history entry /new-post after successfully having created a post. You can see this working in my demo project: http://static-mobx-routing.surge.sh/

How would you suggest implementing this use case with mobx-router?

@kitze
Copy link
Owner

kitze commented Mar 15, 2017

Hey man! Your router looks amazing! I would looove if we can brainstorm on this because I needed it in few of my projects. Ping me on twitter @thekitze and let me know when can we chat.

@eugenkiss
Copy link
Author

Will do! For general information purposes, here's the rough idea: Routes are part of a list (the history) that is (de)serializable and there is a pointer/index that points to the current route in the history. This pointer moves according to the user's history manipulation (e.g. pressing the back button decreases the by 1). You can manipulate this list however you please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants