apollographql / react-apollo

:recycle: React integration for Apollo Client
https://www.apollographql.com/docs/react/
MIT License
6.85k stars 790 forks source link

Refetch or re-using lazy query make data incomplete. #4017

Open ThomasP1988 opened 4 years ago

ThomasP1988 commented 4 years ago

Hi everyone,

BUG: When I refetch (or re-use a lazy query a second time), a nested array is correctly returned by the server but does not appear in the data variable, which gives me an empty array.

schema of my request `const questionFragment = gql' fragment Question_question on Question { id, category, type, label, required, dateCreated, options { position, id, label } } ';

const questionSetFragment = gql' fragment QuestionSet_questionSet on QuestionSet { category, dateCreated, questions { position, questionId, status }, } ';

export const LIST_QUESTIONS_BY_CATEGORY = gql' query listQuestionsByCategory($category: String, $limit: Int, $from: String) { questionsByCategory(category: $category, filterDisabled: false, limit: $limit, from: $from) { questions { ...Question_question } } questionSet(category: $category) { ...QuestionSet_questionSet } } ${questionFragment} ${questionSetFragment} ';`

this part questions { position, questionId, status },

is empty even through the array has data in the http response.

Version I use React-apollo 3.1.5, i tried to downgrade to 3.1.4 but it's still the same.

Any help would be welcome :) have a good day