Missing selection set for object GraphQL+Apollo error

前端 未结 3 2161
無奈伤痛
無奈伤痛 2021-02-14 14:17

I have a set of mutations that trigger the local state of certain types of popups. They\'re generally set up like this:

  openDialog: (_, variables, { cache }) =         


        
3条回答
  •  滥情空心
    2021-02-14 14:43

    Solution is to add fields to the query (vs. declaring the top-level object you want to fetch without specifying the fields to fetch). If you have something like:

    {
      popups @client {
        id
        dialog
      }
    }
    

    you must declare some fields to fetch inside dialog, for example id:

    {
      popups @client {
        id
        dialog {
          id
        }
      }
    }
    

提交回复
热议问题