React Modern - filter PaginationContainer

64 Views Asked by At

I have a list of items which I fetch from a database using Relay's PaginationContainer. I have a loadMore method which works well and is fetching additional results to the existing list of displayed items.

Now I'm struggling with filtering the results. I want to use a filter in a way

this.props.relay.refetchConnection(
      PaginationConst.loadCount,
      () => {
        console.log('Refetch done');
        this.setState({isLoading: false});
      },
      {
        filter: {
          search: 'some_user_entered_value',
        },
      }
    )

This code works. However, the results of this query are added to the previous list of items. So if by default I display 10 latest items on the page during the first load of the page and next user starts filtering then the page displays first 10 items + items found by this refetchConnection query.

And obviously, I just want to display items found by refetchConnection with the filter including value entered by a user (not the sum of previous queries and a current query)

0

There are 0 best solutions below