Fix bug where surveys don't retain answers without reloading
This commit is contained in:
parent
5c2ed30ccf
commit
23936ec6ae
|
|
@ -99,7 +99,34 @@
|
||||||
data: JSON.stringify(data)
|
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
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue