I had a working component with infinite scroll I have none added any extra packages, and the extra data is being received from the API but for show reason the components has stopped re-rendering after the updateQuery function has run. Any help would be appreicated.
const { loading, error, data, fetchMore, subscribeToMore } = useQuery(GET_TIPS, {fetchPolicy: "network-only", variables: {filter: `{"valid": true}`, limit: 20}});
variables: {
filter: `{"_id": {"$lt": "${lastId}"}, "valid": true}`,
limit: 20
},
updateQuery(previousResult, { fetchMoreResult }) {
const connection = fetchMoreResult.getTips;
if (connection.length === 0) {
return {
getTips: [...previousResult.getTips],
};
}
lastId = connection[connection.length - 1]._id
if (connection.length < 20) {
setHasMore(false)
}
console.log(connection)
console.log(hasMore)
return {
getTips: [...previousResult.getTips, ...connection],
};
},```