diff --git a/client/src/pages/survey.vue b/client/src/pages/survey.vue index d8dd32f6..79f0ff45 100644 --- a/client/src/pages/survey.vue +++ b/client/src/pages/survey.vue @@ -99,7 +99,34 @@ data: JSON.stringify(data) } } - } + }, + refetchQueries: [{ + query: SURVEY_QUERY, + variables: {id: this.id} + }], + // fixme: make the update work instead of refetching + // update: (store, {data: {updateAnswer: {answer}}}) => { + // // try { + // console.log(answer); + // const query = SURVEY_QUERY; + // const variables = {id: this.id}; + // const queryData = store.readQuery({query, variables}); + // console.log('queryData', queryData); + // if (queryData.survey) { + // console.log('answer.data', answer.data); + // queryData.survey.answer = { + // data: { + // ...data, + // __typename: 'AnswerNode' + // } + // }; + // store.writeQuery({query, variables, data: queryData}); + // } + // // } catch (e) { + // // console.error(e); + // // // Query did not exist in the cache, and apollo throws a generic Error. Do nothing + // // } + // } }); });