Relay: [Modern] Paging fetches data but props are not updates

Created on 15 Nov 2017  路  3Comments  路  Source: facebook/relay

I cloned and run this repo https://github.com/AndreiCalazans/hackernews-react-relay because of a problem in another project I have that also involves a PaginationContainer nested inside a QueryRenderer. The problem is that relay.loadMore(4) leads to the correct data being fetched from the server, but the props of the pagination component never get updated. This repo currently has the same wrong behavior.

In the picture you can see the 2nd correct fetch and the old items on the pagination

image

Anybody got any Idea?

Most helpful comment

another solution would be use use filters: [] on @connection directive

https://github.com/AndreiCalazans/hackernews-react-relay/blob/f4893c6faa7065e4a1b2be2aa4bdb5199d758e0a/src/components/LinkList.js#L116

@connection(key: "LinkList_allLinks", filters: [])

All 3 comments

Hello @luongthanhlam I just pushed a fix to that repo.

The problem was that We weren't setting the arguments for filter, therefore on the refetch it was calling it as null which broke the refetch.

screen shot 2017-11-16 at 08 34 11

here is the fix https://github.com/AndreiCalazans/hackernews-react-relay/blob/f4893c6faa7065e4a1b2be2aa4bdb5199d758e0a/src/components/LinkList.js#L159

another solution would be use use filters: [] on @connection directive

https://github.com/AndreiCalazans/hackernews-react-relay/blob/f4893c6faa7065e4a1b2be2aa4bdb5199d758e0a/src/components/LinkList.js#L116

@connection(key: "LinkList_allLinks", filters: [])

That fixed it. Thank you for the reply

Was this page helpful?
0 / 5 - 0 ratings