这是我的解析器,用于写入要存储的数据。
const navigationQuery = gql`
query getNavigation {
localNavigationState @client
}
`;
const localSetNavigationState = (_, { nav }, { cache }):NavigationState => {
let localNavigationState = {
...nav,
__typename
};
console.info("writing",localNavigationState);
cache.writeQuery({query: navigationQuery, data: {localNavigationState}});
return null;
};
这是我要写入存储的数据。 localNavigationState = {"path":"/","title":"lorem ipsum","actions":["qr"]}
写入后,这就是现在显示在商店中的数据:
{
localNavigationState: {"type":"json","json":{"path":"/","title":"lorem ipsum","actions":["qr"]}}
}
当将数据写入缓存时,将数据包装在 JSON 对象中,我怎么做错了?