The following code is called when setting the filter, so when useExternal is set it just executes the externalSetFilter callback function. This works as expected.
/* if we have a filter display the max page and results accordingly */
setFilter: function setFilter(filter) {
var updatedResults = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
if (this.props.useExternal) {
this.props.externalSetFilter(filter);
return;
}
...
However when my callback function updates the results, causing the Griddle component to re-render, it uses this check and calls the above function again with this.state.filter which is empty.
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
// Check if results props changed
if (nextProps.results !== this.props.results) {
this.setFilter(this.state.filter, nextProps.results);
}
Griddle version
0.8.2
The following code is called when setting the filter, so when useExternal is set it just executes the externalSetFilter callback function. This works as expected.
However when my callback function updates the results, causing the Griddle component to re-render, it uses this check and calls the above function again with this.state.filter which is empty.