Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency @apollo/client to v3.7.10 #7520

Merged
merged 4 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"test:watch": "yarn test --watch"
},
"dependencies": {
"@apollo/client": "3.7.5",
"@apollo/client": "3.7.10",
"@babel/runtime-corejs3": "7.21.0",
"@redwoodjs/auth": "4.0.0",
"core-js": "3.29.1",
Expand Down
12 changes: 8 additions & 4 deletions packages/web/src/apollo/typeOverride.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ import type {

// @MARK: Override relevant types from Apollo here
declare global {
interface QueryOperationResult<TData = any, TVariables = OperationVariables>
extends QueryResult<TData, TVariables> {}
interface QueryOperationResult<
TData = any,
TVariables extends OperationVariables = OperationVariables
> extends QueryResult<TData, TVariables> {}
interface MutationOperationResult<TData, TVariables>
extends MutationTuple<TData, TVariables> {}

interface GraphQLQueryHookOptions<TData, TVariables>
extends QueryHookOptions<TData, TVariables> {}
interface GraphQLQueryHookOptions<
TData,
TVariables extends OperationVariables
> extends QueryHookOptions<TData, TVariables> {}
interface GraphQLMutationHookOptions<TData, TVariables>
extends MutationHookOptions<TData, TVariables> {}
}
Expand Down
8 changes: 6 additions & 2 deletions packages/web/src/components/GraphQLHooksProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { OperationVariables } from '@apollo/client'
import type { DocumentNode } from 'graphql'

type DefaultUseQueryType = <
TData = any,
TVariables = GraphQLOperationVariables
TVariables extends OperationVariables = GraphQLOperationVariables
>(
query: DocumentNode,
options?: GraphQLQueryHookOptions<TData, TVariables>
Expand Down Expand Up @@ -70,7 +71,10 @@ export const GraphQLHooksProvider = <
)
}

export function useQuery<TData = any, TVariables = GraphQLOperationVariables>(
export function useQuery<
TData = any,
TVariables extends OperationVariables = GraphQLOperationVariables
>(
query: DocumentNode,
options?: GraphQLQueryHookOptions<TData, TVariables>
): QueryOperationResult<TData, TVariables> {
Expand Down
37 changes: 23 additions & 14 deletions packages/web/src/components/createCell.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ComponentProps, JSXElementConstructor } from 'react'

import { OperationVariables } from '@apollo/client'
import type { DocumentNode } from 'graphql'
import type { A } from 'ts-toolbelt'

Expand Down Expand Up @@ -52,20 +53,25 @@ export type CellProps<
CellPropsVariables<CellType, GQLVariables>
>

export type CellLoadingProps<TVariables = any> = Partial<
Omit<QueryOperationResult<any, TVariables>, 'loading' | 'error' | 'data'>
>
export type CellLoadingProps<TVariables extends OperationVariables = any> =
Partial<
Omit<QueryOperationResult<any, TVariables>, 'loading' | 'error' | 'data'>
>

export type CellFailureProps<TVariables = any> = Partial<
Omit<QueryOperationResult<any, TVariables>, 'loading' | 'error' | 'data'> & {
error: QueryOperationResult['error'] | Error // for tests and storybook
/**
* @see {@link https://www.apollographql.com/docs/apollo-server/data/errors/#error-codes}
*/
errorCode: string
updating: boolean
}
>
export type CellFailureProps<TVariables extends OperationVariables = any> =
Partial<
Omit<
QueryOperationResult<any, TVariables>,
'loading' | 'error' | 'data'
> & {
error: QueryOperationResult['error'] | Error // for tests and storybook
/**
* @see {@link https://www.apollographql.com/docs/apollo-server/data/errors/#error-codes}
*/
errorCode: string
updating: boolean
}
>

// aka guarantee that all properties in T exist
// This is necessary for Cells, because if it doesn't exist it'll go to Empty or Failure
Expand Down Expand Up @@ -95,7 +101,10 @@ export type CellSuccessData<TData = any> = Omit<Guaranteed<TData>, '__typename'>
* `updating` is just `loading` renamed; since Cells default to stale-while-refetch,
* this prop lets users render something like a spinner to show that a request is in-flight.
*/
export type CellSuccessProps<TData = any, TVariables = any> = Partial<
export type CellSuccessProps<
TData = any,
TVariables extends OperationVariables = any
> = Partial<
Omit<
QueryOperationResult<TData, TVariables>,
'loading' | 'error' | 'data'
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ __metadata:
languageName: node
linkType: hard

"@apollo/client@npm:3.7.5":
version: 3.7.5
resolution: "@apollo/client@npm:3.7.5"
"@apollo/client@npm:3.7.10":
version: 3.7.10
resolution: "@apollo/client@npm:3.7.10"
dependencies:
"@graphql-typed-document-node/core": ^3.1.1
"@wry/context": ^0.7.0
Expand Down Expand Up @@ -89,7 +89,7 @@ __metadata:
optional: true
subscriptions-transport-ws:
optional: true
checksum: 833820835bf91d9a17318c0f89ffd876ed2a689ce0e7d017aa0c0f5266468ed7335752a9e4f39319e99ae2f741fa7bfe830fd64568b36d9514b365044639cb9c
checksum: 0320c2ca606d8d391739cb97b308f6d05fffad1d48a18ef71255040ff34a3d48e568961b5c425eb9027ecd7dbd9a5e95bd9a06e0b7c84211608950d878e3cafa
languageName: node
linkType: hard

Expand Down Expand Up @@ -7031,7 +7031,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@redwoodjs/web@workspace:packages/web"
dependencies:
"@apollo/client": 3.7.5
"@apollo/client": 3.7.10
"@babel/cli": 7.21.0
"@babel/core": 7.21.3
"@babel/runtime-corejs3": 7.21.0
Expand Down