apollo

React Uncaught Invariant Violation: Could not find “client” in the context of ApolloConsumer. Wrap the root component in an <ApolloProvider>

不想你离开。 提交于 2021-02-10 08:32:03
问题 I have a React app using react-apollo:2.5.8 and a library of custom components that I install via NPM and use within the app. The library has react-apollo:2.5.8 listed in peer and dev dependencies. Ever since I upgraded react-apollo to 2.5.8 I have been getting this error `Uncaught Invariant Violation: Could not find "client" in the context of ApolloConsumer. Wrap the root component in an <ApolloProvider>.` I tried listing React-apollo within externals in the Webpack build for the library as

React Uncaught Invariant Violation: Could not find “client” in the context of ApolloConsumer. Wrap the root component in an <ApolloProvider>

佐手、 提交于 2021-02-10 08:31:50
问题 I have a React app using react-apollo:2.5.8 and a library of custom components that I install via NPM and use within the app. The library has react-apollo:2.5.8 listed in peer and dev dependencies. Ever since I upgraded react-apollo to 2.5.8 I have been getting this error `Uncaught Invariant Violation: Could not find "client" in the context of ApolloConsumer. Wrap the root component in an <ApolloProvider>.` I tried listing React-apollo within externals in the Webpack build for the library as

ApolloClient from apollo-boost attemped to assign to readonly property

主宰稳场 提交于 2021-02-10 03:09:07
问题 I'm working with react-native, and trying to load Apollo from apollo-boost. When I attempt to import the client, I get the error message "Attempted to assign to readonly property." I'm not sure how to work around this, and it seems from the stack trace that it's in the apollo-boost package. Anybody know how I can work around this? edit: Adding picture and details. I'm getting this when I try to load the app through Expo. Right when it starts, I get this. The first file in my app the stack

ApolloClient from apollo-boost attemped to assign to readonly property

六眼飞鱼酱① 提交于 2021-02-10 03:09:00
问题 I'm working with react-native, and trying to load Apollo from apollo-boost. When I attempt to import the client, I get the error message "Attempted to assign to readonly property." I'm not sure how to work around this, and it seems from the stack trace that it's in the apollo-boost package. Anybody know how I can work around this? edit: Adding picture and details. I'm getting this when I try to load the app through Expo. Right when it starts, I get this. The first file in my app the stack

ApolloClient from apollo-boost attemped to assign to readonly property

非 Y 不嫁゛ 提交于 2021-02-10 03:07:32
问题 I'm working with react-native, and trying to load Apollo from apollo-boost. When I attempt to import the client, I get the error message "Attempted to assign to readonly property." I'm not sure how to work around this, and it seems from the stack trace that it's in the apollo-boost package. Anybody know how I can work around this? edit: Adding picture and details. I'm getting this when I try to load the app through Expo. Right when it starts, I get this. The first file in my app the stack

How to force Apollo Client to use cached data

谁都会走 提交于 2021-02-08 07:52:37
问题 We have an application that initially load a list of widgets: query Widgets() { widgets() { ...Widgets } } fragment Widgets on Widgets { name description rootWidget widgets { ...WidgetInterface } } fragment WidgetInterface on WidgetInterface { id name description type } later on I render this widgets, where every react component is wrapped with another graphql call to get the data for a single widget. As we fetch this data initially I would expect apollo get the data from local store, but it

Apollo+GraphQL - Heuristic Fragment Manual Matching

痞子三分冷 提交于 2021-02-08 06:25:16
问题 I have a headless Craft CMS that is returning data to my Nuxtjs app through a GraphQL endpoint through Apollo. I have a field that can return one of three different block types: richText , image , and pullQuote . My GraphQL endpoint looks like this: query($section:[String], $slug:[String]) { entries(section: $section, slug: $slug) { id, title, uri, ... on blog_blog_Entry{ contentEngine{ __typename, ...on contentEngine_richText_BlockType{ __typename, id, richText fontColor, backgroundColor } .

missing attribute on result, Vue, Apollo and GraphQL

折月煮酒 提交于 2021-02-07 19:18:30
问题 Im totally new to developing with Apollo & GraphQL in Vue applications, and have been stuck on a small problem for some time now. I keep getting the error: Missing clients attribute on result I can see that the request returns data in the Network tab, so it seems to be something else than the query, when it's failing, but cant quite figure out what it is. Currently im doing this query: MyQuery.js import gql from 'graphql-tag'; export const allClientsQuery = gql` query clients { client: client

missing attribute on result, Vue, Apollo and GraphQL

佐手、 提交于 2021-02-07 19:18:19
问题 Im totally new to developing with Apollo & GraphQL in Vue applications, and have been stuck on a small problem for some time now. I keep getting the error: Missing clients attribute on result I can see that the request returns data in the Network tab, so it seems to be something else than the query, when it's failing, but cant quite figure out what it is. Currently im doing this query: MyQuery.js import gql from 'graphql-tag'; export const allClientsQuery = gql` query clients { client: client

Multiple Queries/Mutation in Apollo 2.1

心不动则不痛 提交于 2021-02-06 08:46:57
问题 I need some help using the new Query and Mutation component in Apollo 2.1, especially with multiple queries and mutations. I have the following problems: I have a graphql request that depends on a previous graphql result, how can I deal with this? How do I add two different mutations (in my component I need to do two different actions) in a component that already has a query? 回答1: edit 2019/08/24 from the Apollo docs: The new hooks API for Apollo Client is a simpler way to fetch data in your