React-Apollo不会在变量更改时触发网络请求

时间:2020-01-09 09:22:27

标签: reactjs apollo react-apollo apollo-client

我正在使用react-apollo(v3.1.3)中的查询组件。在我的情况下,variables是一个嵌套对象。在初始通话中设置为

{
  "dashboardFilter": {
    "page": {
      "pageNum": 0,
      "pageSize": 10,
      "sortBy": [
        {
          "sortDirection": "DESC",
          "sortField": "DASHBOARD_PICKUP_DATE_TIME"
        }
      ]
    },
    "loadStatus": [
      "OPEN"
    ]
  }
}

用户单击列后,变量对象更改为

{
  "dashboardFilter": {
    "page": {
      "pageNum": 0,
      "pageSize": 10,
      "sortBy": [
        {
          "sortDirection": "ASC",
          "sortField": "DASHBOARD_PICKUP_DATE_TIME"
        }
      ]
    },
    "loadStatus": [
      "OPEN"
    ]
  }
}

问题是,第一次拨打网络电话时,我接收到数据,但是当变量更改时,它不会发送网络电话。

这些是我要传递给Query组件的其他道具,除变量外,其他一切都保持不变。

{
  "handleLoading": true,
  "query": {<---Query stuff---->},
  "returnPartialData": true,
  "variables": {
    "dashboardFilter": {
      "page": {
        "pageNum": 0,
        "pageSize": 10,
        "sortBy": [
          {
            "sortDirection": "DESC",
            "sortField": "DASHBOARD_PICKUP_DATE_TIME"
          }
        ]
      },
      "loadStatus": [
        "OPEN"
      ]
    }
  },
  "entityType": "Load",
  "passThruMissingData": false
}

我也尝试过设置fetchPolicy="network-only"

我在做错什么吗?

0 个答案:

没有答案