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

cycling between two hashes leads to incorrect location stack #48

Closed
hedgepigdaniel opened this issue Jul 16, 2019 · 2 comments · Fixed by #56
Closed

cycling between two hashes leads to incorrect location stack #48

hedgepigdaniel opened this issue Jul 16, 2019 · 2 comments · Fixed by #56

Comments

@hedgepigdaniel
Copy link
Collaborator

const  action1 = {
  type: 'HOME',
  hash: 's1',
}
const action2 = {
  type: 'HOME',
  hash: 's2',
}

If you render links corresponding to these actions and then click on them in the following order:

dispatch(action1);
dispatch(action2);
dispatch(action1);

Then the kind of the 3rd action when it hits the reducers is back rather than push, and the browser stack has 2 entries instead of three.

@hedgepigdaniel
Copy link
Collaborator Author

Cycling between three actions is fine - the bug only occurs when transitioning to the previous hash.

@hedgepigdaniel
Copy link
Collaborator Author

Reproduceable on the repro/scroll branch. Try using the section links in the sidebar. A pattern of 0-1-4-0-1-4 etc works fine, but a pattern like 0-1-0-1 etc does not.

hedgepigdaniel added a commit that referenced this issue Sep 10, 2019
…next action (#56)

Previously, actions dispatched by the user to push/replace the route were intercepted and turned into back/next actions if they matched the next or previous entry in the history stack. This meant that it was not possible to push/replace the next/previous route in the history stack. This change removes that behaviour, so that the direction of dispatched actions are preserved.

BREAKING CHANGE: dispatching a route that matches the previous/next route in the history stack is no longer reinterpreted as a back/next action

BREAKING CHANGE: history functions `set`/`setParams`/`setState`/`setQuery`/`setHash`/`setBasename` no longer accept a function as an argument

BREAKING CHANGE: history functions `set`/`setParams`/`setState`/`setQuery` no longer merge their arguments with the existing params/state/query

BREAKING CHANGE: history functions `back`/`next`/`jump` no longer accept a state argument

Fixes #48
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

Successfully merging a pull request may close this issue.

1 participant