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

Allow setting history.state #4

Open
tmeasday opened this issue Sep 12, 2014 · 5 comments
Open

Allow setting history.state #4

tmeasday opened this issue Sep 12, 2014 · 5 comments
Assignees

Comments

@tmeasday
Copy link
Contributor

Not sure if you agree with the name @cmather -- I'll use this to set the last known scroll position in an onScroll handler.

@tmeasday tmeasday self-assigned this Sep 12, 2014
@tmeasday tmeasday changed the title Allow Location.replaceState to set history.state Allow setting history.state Sep 13, 2014
@tmeasday
Copy link
Contributor Author

@cmather -- please review the commits attached to the various tickets when you have a sec.

@cmather
Copy link
Contributor

cmather commented Sep 17, 2014

Ok will do

On Sep 16, 2014, at 6:28 PM, Tom Coleman [email protected] wrote:

@cmather -- please review the commits attached to the various tickets when you have a sec.


Reply to this email directly or view it on GitHub.

@tmeasday
Copy link
Contributor Author

@cmather - here's a small proto-package that achieves the scroll saving in the way we talked about: https://github.com/tmeasday/iron-scroll. See the example for very basic usage. Probably a IR onRun hook would make sense too. Let me know if anything I'm doing here doesn't make sense.

@tmeasday tmeasday assigned cmather and unassigned tmeasday Sep 18, 2014
@tmeasday
Copy link
Contributor Author

A problem with this is that it forces a redispatch of the router every time you change history.state, which is unlikely to be what you want.

@tmeasday
Copy link
Contributor Author

This works but the issues remaining are:

  1. Where should it go? Right now it's Location.get().options.historyState which is pretty ugly.
  2. We need to update IR to call out to it rather than always Location.go(). Not sure if this means Location.go() should take {replaceState} as a param, or IR should choose between Location.go() and Location.replaceState(). [https://github.com/replaceState support #5]
  3. If you change the state outside of routing, you probably don't want the router to re-dispatch. Not sure what the cleanest way to allow this is. See also [Discussion] Router.current().location.hash not updating causes inconsistent behavior iron-router#893 for the equivalent thing when changing hash frag.

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

No branches or pull requests

2 participants