-
Notifications
You must be signed in to change notification settings - Fork 531
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
Configure Bugs in React-Instantsearch #1950
Comments
Hi @zackify, I'll fix the cleanUp bug asap. For my understanding does that mean that in your use case, at some point, you have something like this: Also you're right, changing the props of Also can you confirm that if you change for example the aroundLatLng parameter directly in the URL and reload the page it's correctly taken into account? Thanks :) |
I have a location field that will set a bounding box or lat / long. When you clear it out, it removes the props on configure. So yes, at some points configure is rendered without anything. When I am setting a prop on configure, it is not calling onSearchStateChanged until I change the query field, that triggers onSearchStateChanged, and puts the configure params in the url. Hope that helps!
They are not taken into account. This is probably my fault as the props are not passed to configure on reloading the page |
Are you using the props Here's a little example with pseudo code: constructor() {
super();
this.state = {searchState: //parse the url here};
}
onSearchStateChange = searchState => {
//change the configure values inside search state
//update the URL
this.setState({searchState});
};
render() {
return <InstantSearch
appId=""
apiKey=""
indexName=""
searchState={this.state.searchState}
createURL={this.createURL.bind(this)}
onSearchStateChange={this.onSearchStateChange.bind(this)}
>
<Configure aroundLatLng="5, 2.3522" />
</InstantSearch>;
} By doing that, you will first modify the search state according to your needs, then update the url with the new values and then do a |
I thought the whole point of configure is that you change the props on it
and your app updates with whatever props you pass to it. That's how it
worked in 2.2.5. It just didn't trigger onSesrchStateChanged. In v3 it
errors when you have it rendered with no props and doesn't trigger a search
state changed. Just confused as to why any time the props change it
wouldn't just call that function. Everything would work perfect. Your
example is doing exactly what my app is. Except I change the props on
configure if they add a location. And as I said, the app reflects that,
just no URL change. Hope that helps.
…On Tue, Feb 7, 2017 at 04:22 Marie-Laure Thuret ***@***.***> wrote:
Are you using the props searchState on the <InstantSearch/> root
component?
Here's a little example with pseudo code:
constructor() {
super();
this.state = {searchState: //parse the url here};
}
onSearchStateChange = searchState => {
//change the configure values inside search state
//update the URL
this.setState({searchState});
};
render() {
return <InstantSearch
appId=""
apiKey=""
indexName=""
searchState={this.state.searchState}
createURL={this.createURL.bind(this)}
onSearchStateChange={this.onSearchStateChange.bind(this)}
>
<Configure aroundLatLng="5, 2.3522" />
</InstantSearch>;
}
By doing that, you will first modify the search state according to your
needs, then update the url with the new values and then do a setState on
the searchState to trigger a new rendering of the page. Can this works
for you?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1950 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbacFcJA1qn1uTTmkol6naIAMEfUr9Sks5raDe-gaJpZM4L4ibb>
.
|
You're right there's been some miscomprehension. |
Thanks!!
…On Tue, Feb 7, 2017 at 10:45 Vincent Voyer ***@***.***> wrote:
Closed #1950 <#1950>
via 7e151db
<7e151db>
.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1950 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbacFsVSXsHqE5ffcEaeYwwbd29kECdks5raJGzgaJpZM4L4ibb>
.
|
Can you let me know when a release is out? You guys are the best |
<a name="3.1.0"></a> # [3.1.0](v3.0.0...v3.1.0) (2017-02-08) ### Bug Fixes * **Configure:** call onSearchStateChange when props are updated (#1953) ([7e151db](7e151db)), closes [#1950](#1950) * **Configure:** trigger onSearchStateChange with the right data ([11e5af8](11e5af8)) * **createConnector:** updates with latest props on state change (#1951) ([cd3a82c](cd3a82c)) ### Features * **ClearAll:** add withQuery to also clear the search query (#1958) ([c0e695b](c0e695b))
Bug: What is the current behavior?
Configure throws errors on page changes when it has no props.
Also, when you change the props passed to Configure, it does not call onSearchStateChanged, so the url isn't updated until changing the query or something else happens.
What project are you opening an issue for?
What is the version you are using? Always use the latest one before opening a bug issue.
v3.0.0
The text was updated successfully, but these errors were encountered: