-
Notifications
You must be signed in to change notification settings - Fork 504
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
docs(examples): add url sync #1542
Conversation
constructor() { | ||
super(); | ||
const history = window.history; | ||
this.state = {history, state: {...qs.parse(window.location.search.slice(1))}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to store window.history in the state? For convenience?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could totally be replaced with window.history each time yeah (like location)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let's do that otherwise we start wondering "Why is history here?"
|
||
render() { | ||
return <App {...this.props} | ||
state={this.state.state} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could name it this.state.searchState
?
2c6b867
to
a4206f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Cool HOC for URL's :)
LGTM, ultimately empty refinements entries could just be removed from the state I guess? |
Yes I was thinking the same. a new refactor to do ? :] |
Yep in another step :) |
uses browser history and a 700 ms threshold.
the url sync on our examples does not cover:
I can add them if you think it worth it.