@nerdwallet/apollo-cache-policies
Advanced tools
Comparing version 2.8.0 to 2.9.0
@@ -0,5 +1,8 @@ | ||
2.9.0 (Dan Reynolds) | ||
Bump compatibility to @apollo/client 3.7. | ||
2.8.0 (Dan Reynolds) | ||
* Add support for reactive filter changes in `useFragmentWhere`. | ||
* Adds `writeFragmentWhere` API. | ||
Add support for reactive filter changes in `useFragmentWhere`. | ||
@@ -6,0 +9,0 @@ 2.7.0 (Dan Reynolds) |
@@ -8,2 +8,3 @@ import { DocumentNode } from 'graphql'; | ||
client: import("@apollo/client").ApolloClient<any>; | ||
observable: import("@apollo/client").ObservableQuery<Record<string, FragmentType | null>, import("@apollo/client").OperationVariables>; | ||
previousData?: Record<string, FragmentType | null> | undefined; | ||
@@ -13,3 +14,3 @@ error?: import("@apollo/client").ApolloError | undefined; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
called: true; | ||
called: boolean; | ||
variables: import("@apollo/client").OperationVariables | undefined; | ||
@@ -21,5 +22,9 @@ startPolling: (pollInterval: number) => void; | ||
refetch: (variables?: Partial<import("@apollo/client").OperationVariables> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FragmentType | null>>>; | ||
fetchMore: ((fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<import("@apollo/client").OperationVariables, Record<string, FragmentType | null>> & import("@apollo/client").FetchMoreOptions<Record<string, FragmentType | null>, import("@apollo/client").OperationVariables>) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FragmentType | null>>>) & (<TData2, TVariables2>(fetchMoreOptions: { | ||
query?: DocumentNode | import("@graphql-typed-document-node/core").TypedDocumentNode<Record<string, FragmentType | null>, import("@apollo/client").OperationVariables> | undefined; | ||
} & import("@apollo/client").FetchMoreQueryOptions<TVariables2, Record<string, FragmentType | null>> & import("@apollo/client").FetchMoreOptions<TData2, TVariables2>) => Promise<import("@apollo/client").ApolloQueryResult<TData2>>); | ||
reobserve: (newOptions?: Partial<import("@apollo/client").WatchQueryOptions<import("@apollo/client").OperationVariables, Record<string, FragmentType | null>>> | undefined, newNetworkStatus?: import("@apollo/client").NetworkStatus | undefined) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FragmentType | null>>>; | ||
fetchMore: <TFetchData = Record<string, FragmentType | null>, TFetchVars = import("@apollo/client").OperationVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & { | ||
updateQuery?: ((previousQueryResult: Record<string, FragmentType | null>, options: { | ||
fetchMoreResult: TFetchData; | ||
variables: TFetchVars; | ||
}) => Record<string, FragmentType | null>) | undefined; | ||
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>; | ||
} & { | ||
@@ -26,0 +31,0 @@ data: FragmentType | null; |
@@ -6,2 +6,3 @@ import { DocumentNode } from 'graphql'; | ||
client: import("@apollo/client").ApolloClient<any>; | ||
observable: import("@apollo/client").ObservableQuery<Record<string, FragmentType[]>, import("@apollo/client").OperationVariables>; | ||
previousData?: Record<string, FragmentType[]> | undefined; | ||
@@ -11,3 +12,3 @@ error?: import("@apollo/client").ApolloError | undefined; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
called: true; | ||
called: boolean; | ||
variables: import("@apollo/client").OperationVariables | undefined; | ||
@@ -19,5 +20,9 @@ startPolling: (pollInterval: number) => void; | ||
refetch: (variables?: Partial<import("@apollo/client").OperationVariables> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FragmentType[]>>>; | ||
fetchMore: ((fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<import("@apollo/client").OperationVariables, Record<string, FragmentType[]>> & import("@apollo/client").FetchMoreOptions<Record<string, FragmentType[]>, import("@apollo/client").OperationVariables>) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FragmentType[]>>>) & (<TData2, TVariables2>(fetchMoreOptions: { | ||
query?: DocumentNode | import("@graphql-typed-document-node/core").TypedDocumentNode<Record<string, FragmentType[]>, import("@apollo/client").OperationVariables> | undefined; | ||
} & import("@apollo/client").FetchMoreQueryOptions<TVariables2, Record<string, FragmentType[]>> & import("@apollo/client").FetchMoreOptions<TData2, TVariables2>) => Promise<import("@apollo/client").ApolloQueryResult<TData2>>); | ||
reobserve: (newOptions?: Partial<import("@apollo/client").WatchQueryOptions<import("@apollo/client").OperationVariables, Record<string, FragmentType[]>>> | undefined, newNetworkStatus?: import("@apollo/client").NetworkStatus | undefined) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FragmentType[]>>>; | ||
fetchMore: <TFetchData = Record<string, FragmentType[]>, TFetchVars = import("@apollo/client").OperationVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & { | ||
updateQuery?: ((previousQueryResult: Record<string, FragmentType[]>, options: { | ||
fetchMoreResult: TFetchData; | ||
variables: TFetchVars; | ||
}) => Record<string, FragmentType[]>) | undefined; | ||
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>; | ||
} & { | ||
@@ -24,0 +29,0 @@ data: FragmentType[]; |
@@ -10,3 +10,3 @@ "use strict"; | ||
const client_2 = require("@apollo/client"); | ||
const useDeepMemo_1 = require("@apollo/client/react/hooks/utils/useDeepMemo"); | ||
const equality_1 = require("@wry/equality"); | ||
// A hook for subscribing to a fragment for entities in the Apollo cache matching a given filter from a React component. | ||
@@ -20,3 +20,7 @@ function useFragmentWhere(fragment, filter) { | ||
const filterVar = filterVarRef.current; | ||
useDeepMemo_1.useDeepMemo(() => filterVar(filter), filter); | ||
react_1.useEffect(() => { | ||
if (!equality_1.equal(filter, filterVar())) { | ||
filterVar(filter); | ||
} | ||
}, [filter]); | ||
const query = utils_2.useOnce(() => utils_1.buildWatchFragmentWhereQuery({ | ||
@@ -23,0 +27,0 @@ filter, |
@@ -5,2 +5,3 @@ import { DocumentNode } from "graphql"; | ||
client: import("@apollo/client").ApolloClient<any>; | ||
observable: import("@apollo/client").ObservableQuery<Record<string, FieldType>, import("@apollo/client").OperationVariables>; | ||
previousData?: Record<string, FieldType> | undefined; | ||
@@ -10,3 +11,3 @@ error?: import("@apollo/client").ApolloError | undefined; | ||
networkStatus: import("@apollo/client").NetworkStatus; | ||
called: true; | ||
called: boolean; | ||
variables: import("@apollo/client").OperationVariables | undefined; | ||
@@ -18,5 +19,9 @@ startPolling: (pollInterval: number) => void; | ||
refetch: (variables?: Partial<import("@apollo/client").OperationVariables> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FieldType>>>; | ||
fetchMore: ((fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<import("@apollo/client").OperationVariables, Record<string, FieldType>> & import("@apollo/client").FetchMoreOptions<Record<string, FieldType>, import("@apollo/client").OperationVariables>) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FieldType>>>) & (<TData2, TVariables2>(fetchMoreOptions: { | ||
query?: DocumentNode | import("@graphql-typed-document-node/core").TypedDocumentNode<Record<string, FieldType>, import("@apollo/client").OperationVariables> | undefined; | ||
} & import("@apollo/client").FetchMoreQueryOptions<TVariables2, Record<string, FieldType>> & import("@apollo/client").FetchMoreOptions<TData2, TVariables2>) => Promise<import("@apollo/client").ApolloQueryResult<TData2>>); | ||
reobserve: (newOptions?: Partial<import("@apollo/client").WatchQueryOptions<import("@apollo/client").OperationVariables, Record<string, FieldType>>> | undefined, newNetworkStatus?: import("@apollo/client").NetworkStatus | undefined) => Promise<import("@apollo/client").ApolloQueryResult<Record<string, FieldType>>>; | ||
fetchMore: <TFetchData = Record<string, FieldType>, TFetchVars = import("@apollo/client").OperationVariables>(fetchMoreOptions: import("@apollo/client").FetchMoreQueryOptions<TFetchVars, TFetchData> & { | ||
updateQuery?: ((previousQueryResult: Record<string, FieldType>, options: { | ||
fetchMoreResult: TFetchData; | ||
variables: TFetchVars; | ||
}) => Record<string, FieldType>) | undefined; | ||
}) => Promise<import("@apollo/client").ApolloQueryResult<TFetchData>>; | ||
} & { | ||
@@ -23,0 +28,0 @@ data: FieldType; |
{ | ||
"name": "@nerdwallet/apollo-cache-policies", | ||
"version": "2.8.0", | ||
"version": "2.9.0", | ||
"description": "An extension to the InMemoryCache from Apollo that adds additional cache policies.", | ||
@@ -30,3 +30,3 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"@apollo/client": "^3.4.16", | ||
"@apollo/client": "^3.7.0", | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
@@ -40,3 +40,3 @@ }, | ||
"devDependencies": { | ||
"@apollo/client": "^3.4.16", | ||
"@apollo/client": "^3.7.0", | ||
"@types/graphql": "^14.5.0", | ||
@@ -43,0 +43,0 @@ "@types/jest": "^28.1.6", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
339585
2592