reactjs - GraphQL query does not update on react router v4 history push -


i implement basic filtering option in react web app. have 3 components

videolist --------------------------  filter    result  --------  ---------------- category 

the filter component , result component both children of videolist component. in filter component when user clicks on category, pushing new url, this.props.history.push(/videos/${category.name}). seems react-router settings works correctly , videolist component gets new category name , passes result component.

<route exact path="/videos" component={videolist}/>, <route exact path="/videos/:category" render={props => <videolist {...props} />} />, 

in videolist component

<result category={category} />

the result component makes usage of new category name in own graphql query follow:

export default compose(   graphql(videos_query, {     options: props => {        return {         variables: {           filterbycategory: props.category ? props.category : null,               }       };     }, ... 

but, unknown me reasons when pushing new url first time props.data.videoquery (this return values graphql server) in result component gets undefined. however, when user clicks on category second time, result components renders correctly.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -