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

export separate ModifierUtility type #7133

Merged
merged 10 commits into from
Nov 23, 2022
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
[@aaronadamsCA](https://github.com/aaronadamsCA) in [#9323](https://github.com/apollographql/apollo-client/pull/9323)
- docs: displays the error correctly<br/>
[@ctesniere](https://github.com/ctesniere) in [#10275](https://github.com/apollographql/apollo-client/pull/10275)
- Export a `ModifierDetails` type for the `details` parameter of a `Modifier` function. <br />
[@KeithGillette](https://github.com/KeithGillette) in [#7133](https://github.com/apollographql/apollo-client/pull/7133)

## Apollo Client 3.7.1 (2022-10-20)

Expand Down
6 changes: 4 additions & 2 deletions src/cache/core/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export type ToReferenceFunction = (

export type CanReadFunction = (value: StoreValue) => boolean;

export type Modifier<T> = (value: T, details: {
export type ModifierDetails = {
DELETE: any;
INVALIDATE: any;
fieldName: string;
Expand All @@ -86,7 +86,9 @@ export type Modifier<T> = (value: T, details: {
isReference: typeof isReference;
toReference: ToReferenceFunction;
storage: StorageType;
}) => T;
}

export type Modifier<T> = (value: T, details: ModifierDetails) => T;

export type Modifiers = {
[fieldName: string]: Modifier<any>;
Expand Down
1 change: 1 addition & 0 deletions src/cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
MissingTree,
Modifier,
Modifiers,
ModifierDetails,
MissingFieldError,
ReadFieldOptions
} from './core/types/common';
Expand Down