我正尝试通过以下命令将数据直接写入阿波罗缓存:
client.writeQuery(
{ query: GET_MOVIES },
{ data: { movies: response.data.results } }
);
response.data.results :
[{id:1, title:'title', ...}, ...]
const GET_MOVIES = gql`
query myQuery {
movies @client {
id
}
}
`;
并产生以下错误:
Error: Error writing result to store for query:
Cannot read property 'movies' of undefined
TypeError: Cannot read property 'movies' of undefined