Tag: relayjs
-
When using GraphQL and Relay and Fragment, how to see the data?
0 I am onto Step 4 of the Relay Tutorial at: https://relay.dev/docs/tutorial/fragments-1/ It was strange because when I don’t use Fragment, and have the following code: const data = useLazyLoadQuery<NewsfeedQueryType>( NewsfeedQuery, {} ) console.log("HERE 1", JSON.stringify(data, null, 4)); I was able to see in the dev console for the data: HERE 1 { "topStory": {…
-
GraphQL Relay mutation with spread fragment selection does not update state after commit
0 I have this todos-list component import { Suspense } from "react"; import { graphql, useFragment, useLazyLoadQuery } from "react-relay"; import { todosQuery } from "./__generated__/todosQuery.graphql"; import { todos_todos$key } from "./__generated__/todos_todos.graphql"; export default function Todos() { const data = useLazyLoadQuery<todosQuery>( graphql` query todosQuery { todos { …todos_todos } } `, {} ); return (…
-
How to call multiple mutations at the same time?
1 I have an array of ids, and I created a mutation that allow me to delete an item using only 1 id. Is there any way to call this mutation multiple times using Relay.Store.commitUpdate or this.props.relay.commitUpdate ? graphql relayjs Share Improve this question Follow edited Aug 11, 2017 at 1:11 jonathancardoso 11.8k77 gold badges5353…
-
GraphQL validation error
0 I am trying out relay-treasure hunt tutorial but getting the following error when I run npm start. I did update my schema by running npm run update-schema. Uncaught Error: GraphQL validation error “Cannot query field “game” on type “Query”.“ in file `/home/tharaka/My Projects/relay-treasurehunt/js/routes/AppHomeRoute.js`. Try updating your GraphQL schema if an argument/field/type was recently added.…
-
Update Relay Store from data saved on cache for Offline mode
0 I’m developing a React native app, and want to restore data saved on cache when the user opens the app again, but it’s offline. I was able to get the latest store by using store.getSource() and save it as a serialised JSON to the device storage. I do also recover and unserialise it, but…
-
How to convert the data retrieved by GraphQL + Relay to normal React state?
0 Example from the documentation: import type {AppQueryType} from ‘AppQueryType.graphql’; const React = require(‘React’); const {graphql, useQueryLoader, usePreloadedQuery} = require(‘react-relay’); const AppQuery = graphql` query AppQuery($id: ID!) { user(id: $id) { name } } `; type Props = { initialQueryRef: PreloadedQuery<AppQueryType>, }; function NameLoader(props) { const [queryReference, loadQuery] = useQueryLoader( AppQuery, props.initialQueryRef, /* e.g. provided…
-
What is the difference between Falcor and GraphQL?
176 GraphQL consists of a type system, query language and execution semantics, static validation, and type introspection, each outlined below. To guide you through each of these components, we’ve written an example designed to illustrate the various pieces of GraphQL. – https://github.com/facebook/graphql Falcor lets you represent all your remote data sources as a single domain…