Using @defer under an array field will return multiple patches. Patches are unique combinations of label and path
{
items {
id
...frag @defer(label: "my-label")
}
}| import { useNavigationParam } from 'react-navigation-hooks'; | |
| import { graphql, usePreloadedQuery } from 'react-relay/hooks'; | |
| const query = graphql` | |
| query TaskDetailQuery($nodeId: ID!) { | |
| task: node(id: $nodeId) { | |
| ... on Task { | |
| title | |
| } | |
| } |
Using @defer under an array field will return multiple patches. Patches are unique combinations of label and path
{
items {
id
...frag @defer(label: "my-label")
}
}| import { useEffect } from 'react'; | |
| import { graphql, readInlineData } from 'react-relay'; | |
| import { useHistory } from '../routing/useHistory'; | |
| import { useAuth_user } from './__generated__/useAuth_user.graphql'; | |
| const useAuthFragment = graphql` | |
| fragment useAuth_user on User @inline { | |
| id |
| import { ROOT_ID } from 'relay-runtime'; | |
| import { useRelayEnvironment } from 'react-relay/hooks'; | |
| import { useLocation, useHistory } from 'react-router-dom'; | |
| import { commitLocalUpdate } from 'react-relay' | |
| import { useMutation } from 'relay-hooks/lib'; | |
| import { AuthUserMutation } from 'mutations/AuthUserMutation'; | |
| export const TOKEN_KEY = 'KEY'; |
| it('should call mutation properly', async () => { | |
| // eslint-disable-next-line | |
| const { debug, getByText, getByTestId } = render(<MyComponent />); | |
| const customMockResolvers = { | |
| ...mockResolvers, | |
| }; | |
| const name = 'myName'; |
| import { mongooseLoader } from '@entria/graphql-mongoose-loader'; | |
| import DataLoader from 'dataloader'; | |
| import { ConnectionArguments } from 'graphql-relay'; | |
| import { Model, Types } from 'mongoose'; | |
| import { buildMongoConditionsFromFilters } from '@entria/graphql-mongo-helpers'; | |
| import { withConnectionCursor } from './withConnectionCursor'; | |
| const defaulViewerCanSee = (context, data) => { |
| const UserType = new GraphQLObjectType<IUser, GraphQLContext>({ | |
| name: 'User', | |
| description: 'User data', | |
| fields: () => ({ | |
| id: globalIdField('User'), | |
| ...mongooseIDResolver, | |
| name: { | |
| type: GraphQLString, | |
| resolve: user => user.name, | |
| }, |
| import { toGlobalId } from 'graphql-relay'; | |
| import { Types } from 'mongoose'; | |
| import { getObjectId } from './getObjectId'; | |
| import { | |
| clearDbAndRestartCounters, | |
| connectMongoose, | |
| createUser, | |
| disconnectMongoose | |
| } from '../../../test/helpers'; |
| const mutation = createEditSingleFieldMutation({ | |
| name: 'UserEditName', | |
| model: User, | |
| fieldName: 'title', | |
| fieldType: GraphQLString, | |
| clearCache: UserLoader.clearCache, | |
| notFoundMessage: ({ t }) => t('User not found'), | |
| successMessage: ({ t }) => t('User edited successfully'), | |
| outputFields: { | |
| user: { |
| export const initEnvironment = (records = {}) => { | |
| const network = Network.create(cacheHandler); | |
| const source = new RecordSource(records); | |
| const store = new Store(source, { | |
| // This property tells Relay to not immediately clear its cache when the user | |
| // navigates around the app. Relay will hold onto the specified number of | |
| // query results, allowing the user to return to recently visited pages | |
| // and reusing cached data if its available/fresh. | |
| gcReleaseBufferSize: 10, |