gpt4 book ai didi

react-apollo - 网络错误: Converting circular structure to JSON on refetch

转载 作者:行者123 更新时间:2023-12-02 20:33:23 25 4
gpt4 key购买 nike

这是一个很奇怪的问题。

我有一个相当简单的查询,无论我触发多少次,它在 Graphiql 中都运行得很好

但在浏览器中,当我调用 data.refetch() 时,就会出现问题。最奇怪的是,在 Chromium 中我得到网络错误:将循环结构转换为 JSON当如果 FF 时错误是网络错误:循环对象值

在 Chrome 中,我没有安装 redux-dev-tools,错误与 Chromium 中的错误相同

其他查询重新获取得很好,但这个查询被卡住了!当然我已经多次重启服务器,清除缓存等等..

我使用的是 apollo v2,查询没有什么特别的:

query ProductsListQuery($offset: Int!, $limit: Int!) {
products(offset: $offset, limit: $limit) {
items {
id
title
shortDescription
tags
imagesIds
__typename
}
total
__typename
}
}

结果:

{
"data": {
"products": {
"items": [
{
"id": "5a39b5469066625581a326c4",
"title": "Test1",
"shortDescription": "",
"tags": [],
"imagesIds": {
"main": null
},
"__typename": "Product"
},
{
"id": "5a39b55b9066625581a3270b",
"title": "Test2",
"shortDescription": "",
"tags": [],
"imagesIds": {
"main": null
},
"__typename": "Product"
}
],
"total": 2,
"__typename": "ProductsPaginated"
}
}
}

最佳答案

感谢@Daniel Rearden,我研究了如何触发重新获取,并发现这不起作用,原因我无法解释:

<Button onClick={data.refetch} />

但这可行

<Button onClick={() => data.refetch() />

关于react-apollo - 网络错误: Converting circular structure to JSON on refetch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47897516/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com