react-apollo-hooks icon indicating copy to clipboard operation
react-apollo-hooks copied to clipboard

Is it possible to query with pagination?

Open metamn opened this issue 5 years ago • 3 comments

Something like fetchMore: https://www.apollographql.com/docs/react/features/pagination/

Thanks a lot!

metamn avatar Jun 25 '19 10:06 metamn

Yes, useQuery returns some helper functions like fetchMore, updateQuery...

const { fetchMore }  = useQuery(QUERY)

flytaly avatar Jun 25 '19 12:06 flytaly

Yes, useQuery returns some helper functions like fetchMore, updateQuery...

const { fetchMore }  = useQuery(QUERY)

I have an issue with fetchMore and fetchPolicy: 'no-cache', it is not rendering the updateQuery new data

updateQuery: (prev, nexData) => {
                if (!nexData.fetchMoreResult) return prev;
                const newList = {
                    ...prev,
                    list: [...prev.issues, ...nexData.fetchMoreResult.list]
                };
                return newList;
            }

cross13 avatar Jun 25 '19 12:06 cross13

oh thanks !!!! :)

metamn avatar Jun 25 '19 13:06 metamn