我是GraphQL和阿波罗的新手,我不明白下面的'aliasEmail‘字段有什么问题。当我将这个添加到查询中时,我得到了这个错误消息。当我将它从查询中删除时,一切都工作得很好。它在'types.graphql‘中定义得很好,只是一个简单的字符串字段。
index.js:2178 Unhandled (in react apollo:Apollo(withRouter(EmailSettingsContainer))) Error: Network
error: Error writing result to store for query:
query getCompa
运行apollo client:codegen时,我得到以下错误:
✔ Loading Apollo Project
✖ Generating query files with 'typescript' target
→ Can only create NonNull of a Nullable GraphQLType but got: ID.
Error: Can only create NonNull of a Nullable GraphQLType but got: ID.
at invariant (~/Code/humu/node_modul
我正在和vue和vue-阿波罗一起做一个新的项目。
我有一个显示用户名(UserShow.vue)的组件:
<template>
<div v-if="!this.$apollo.queries.user.loading">
Your name is: {{user.firstname}}
</div>
</template>
<script>
import gql from "graphql-tag";
export default {
我正在使用apollo client for graphql。我在AppApolloModule中设置了要在AppModule中导入的客户端。我在一个服务中进行查询,该服务也直接导入到AppModule中。虽然服务是在AppApolloModule运行之前运行的,因此在执行查询时apollo没有初始化,但我得到了这个错误
Error: Client has not been defined yet
AppApolloModule
imports ....
export class AppApolloModule {
constructor(
apollo: Apol
我正在构建一个使用@apollo/client v3的react本机应用程序(使用类型记录)。我有许多变异&查询,它们都返回相同的类型,并且我总是希望接收相同的字段。因此,我为模式定义(在客户机中)提供了以下结构:
import { gql } from "@apollo/client";
gql`
fragment ConversationFragment on Conversation {
roomId
name
isDirect
participants {
id
isAdmin
isCre
我在我的服务器上使用Apollo,并且我正在尝试设计我的GraphQL GraphQL。我遇到的一个问题是,我是否应该更喜欢嵌套查询而不是根查询。
让我们在当前用户me具有多个invitations的示例中检查这两种方法。
根目录查询
me {
id
name
}
invitations {
id
message
}
invitations的解析程序返回当前用户的邀请。
嵌套查询
me {
id
name
invitations {
id
message
}
}
除了使用后一种方法将邀请嵌套在用户
我正试着跟随。
我正在将他们所做的完全复制到我的项目中,但是每当我调用client.query时,我都会得到一个400个状态代码,其中包含以下错误:
Error: Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory.
这是我的项目的index.js中的所有代码:
import { ApolloClient } from 'apollo-client&
我找到了一些关于如何用react-apollo模拟常规查询的资源。示例代码如下:
import ApolloClient from 'apollo-client';
import { ApolloProvider } from 'react-apollo';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { addMockFunctionsToSchema, makeExecutableSchema } from 'graphql-tools';
co
我正在使用apollo客户端在我的react应用程序中模拟graphql api。这是我的index.js (由create-react- app创建的react应用)
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import InventoryList from './components/InventoryList';
import Head