Relay: Why `QueryRenderer` not to rerender when variables Change?

Created on 14 May 2018  路  6Comments  路  Source: facebook/relay

Most helpful comment

The problem is resolved.
I forget to upgrade React-Dom to 16.3.0 ...

All 6 comments

hey @xyy94813 the QueryRenderer itself wont re-render, but when you pass new variables we will re-fetch the query with the new variable and call your render prop again; does that make sense?

thx.
But it don't re-fetch after i upgrade relay to v1.6.0 in my project.

The problem is resolved.
I forget to upgrade React-Dom to 16.3.0 ...

I have the Base Component which will have a QueryRenderer to fetch data for header, food items, filtering options. In the render method, i would like to display the

, and a sidebar . Now when on click of a item in , i am changing the state in redux , which in turn is used as variables for the QueryRender. The QueryRender refetches the data again with the new filters. The problem is since
and is also inside renderer method of queryrender, All the components get refreshed. Is there any way to handle this situation where only the listing changes based on new variables.

@ankit5174 you need to use a refetch container in this case, instead of a QR

@sibelius I assume FoodList will be the refetch Container. If that is so then this.props.relay.refetch of FoodList will be available in the same component. But i need to make the refetch call from component. Any way we can expose the functions from one component to its sibling?

Was this page helpful?
0 / 5 - 0 ratings