Open albertalquisola opened 7 years ago
Fair enough. Would you be interested in making a PR?
Potentially. However, I'm not overly familiar with how to replicate this behavior in legacy browsers (browsers that dont support window history API)
I went ahead and wrote a quick implementation for replaceRoute
. Mind adding me as a collaborator so I can submit a PR? I cant push my branch up due to insufficient permissions.
That shouldn't be necessary, if you go to the Pull Requests page in this repo, you can click "New pull request" and select your own fork.
cool, thats fine. just submitted a PR. This is more a proof of concept. If you like the approach, I can refine/refactor a bit more and add test cases
Any chance we can get support for a call that looks something like this?
Under the hood, director is using
window.pushState()
on therouter.setRoute()
call which will push a new entry onto the window history stack. This makes the native browser history inflexible in certain cases.eg. if i only want to change query params (user isn't taken to new page) previous url:
example.com/home
current url:example.com/new/route
router.setRoute('/new/route?new=true');
Now, if the user clicks back button, they'll be taken to
example.com/new/route
which is the same page sans any query param filter. I would like the control to navigate them back toexample.com/home
instead.Also, this has been requested by a few of people: https://github.com/flatiron/director/issues/316