Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef892b4

Browse files
authored
RemoveaddTypename option fromInMemoryCache andMockedProvider (#12379)
1 parent9ed45c5 commitef892b4

File tree

38 files changed

+383
-470
lines changed

38 files changed

+383
-470
lines changed

‎.api-reports/api-report-cache.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export abstract class ApolloCache<TSerialized> implements DataProxy {
8282
// @public (undocumented)
8383
exporttypeApolloReducerConfig= {
8484
dataIdFromObject?:KeyFieldsFunction;
85-
addTypename?:boolean;
8685
};
8786

8887
// @public

‎.api-reports/api-report-core.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ export interface ApolloQueryResult<T> {
274274
// @public (undocumented)
275275
exporttypeApolloReducerConfig= {
276276
dataIdFromObject?:KeyFieldsFunction;
277-
addTypename?:boolean;
278277
};
279278

280279
// @public

‎.api-reports/api-report-testing.api.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,10 @@ interface MockedSubscriptionResult {
10761076

10771077
// @public (undocumented)
10781078
exportclassMockLinkextendsApolloLink {
1079-
constructor(mockedResponses:ReadonlyArray<MockedResponse<any,any>>,addTypename?:Boolean,options?:MockLinkOptions);
1079+
constructor(mockedResponses:ReadonlyArray<MockedResponse<any,any>>,options?:MockLinkOptions);
10801080
// (undocumented)
10811081
addMockedResponse(mockedResponse:MockedResponse):void;
10821082
// (undocumented)
1083-
addTypename:Boolean;
1084-
// (undocumented)
10851083
operation:Operation;
10861084
// (undocumented)
10871085
request(operation:Operation):Observable<FetchResult>|null;
@@ -1101,7 +1099,7 @@ export function mockObservableLink(): MockSubscriptionLink;
11011099
// Warning: (ae-forgotten-export) The symbol "MockApolloLink" needs to be exported by the entry point index.d.ts
11021100
//
11031101
// @public (undocumented)
1104-
exportfunction mockSingleLink(...mockedResponses:Array<any>):MockApolloLink;
1102+
exportfunction mockSingleLink(...mockedResponses:Array<MockedResponse<any,any>>):MockApolloLink;
11051103

11061104
// @public (undocumented)
11071105
exportclassMockSubscriptionLinkextendsApolloLink {

‎.api-reports/api-report-testing_core.api.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,10 @@ interface MockedSubscriptionResult {
10761076

10771077
// @public (undocumented)
10781078
exportclassMockLinkextendsApolloLink {
1079-
constructor(mockedResponses:ReadonlyArray<MockedResponse<any,any>>,addTypename?:Boolean,options?:MockLinkOptions);
1079+
constructor(mockedResponses:ReadonlyArray<MockedResponse<any,any>>,options?:MockLinkOptions);
10801080
// (undocumented)
10811081
addMockedResponse(mockedResponse:MockedResponse):void;
10821082
// (undocumented)
1083-
addTypename:Boolean;
1084-
// (undocumented)
10851083
operation:Operation;
10861084
// (undocumented)
10871085
request(operation:Operation):Observable<FetchResult>|null;
@@ -1101,7 +1099,7 @@ export function mockObservableLink(): MockSubscriptionLink;
11011099
// Warning: (ae-forgotten-export) The symbol "MockApolloLink" needs to be exported by the entry point index.d.ts
11021100
//
11031101
// @public (undocumented)
1104-
exportfunction mockSingleLink(...mockedResponses:Array<any>):MockApolloLink;
1102+
exportfunction mockSingleLink(...mockedResponses:Array<MockedResponse<any,any>>):MockApolloLink;
11051103

11061104
// @public (undocumented)
11071105
exportclassMockSubscriptionLinkextendsApolloLink {

‎.api-reports/api-report-testing_react.api.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,15 +1041,11 @@ export class MockedProvider extends React_2.Component<MockedProviderProps, Mocke
10411041
// (undocumented)
10421042
componentWillUnmount():void;
10431043
// (undocumented)
1044-
static defaultProps:MockedProviderProps;
1045-
// (undocumented)
10461044
render():React_2.JSX.Element|null;
10471045
}
10481046

10491047
// @public (undocumented)
10501048
exportinterfaceMockedProviderProps<TSerializedCache= {}> {
1051-
// (undocumented)
1052-
addTypename?:boolean;
10531049
// (undocumented)
10541050
cache?:ApolloCache<TSerializedCache>;
10551051
// (undocumented)

‎.api-reports/api-report-utilities.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ interface ApolloQueryResult<T> {
334334
// @public (undocumented)
335335
type ApolloReducerConfig = {
336336
dataIdFromObject?: KeyFieldsFunction;
337-
addTypename?: boolean;
338337
};
339338

340339
// @public (undocumented)

‎.api-reports/api-report.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ export interface ApolloQueryResult<T> {
274274
// @public (undocumented)
275275
export type ApolloReducerConfig = {
276276
dataIdFromObject?: KeyFieldsFunction;
277-
addTypename?: boolean;
278277
};
279278

280279
// @public

‎.changeset/calm-frogs-remain.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@apollo/client":major
3+
---
4+
5+
Removes the`addTypename` option from`InMemoryCache` and`MockedProvider`.`__typename` is now always added to the outgoing query document when using`InMemoryCache` and cannot be disabled.
6+
7+
If you are using`<MockedProvider />` with`addTypename={false}`, ensure that your mocked responses include a`__typename` field. This will ensure cache normalization kicks in and behaves more like production.

‎.size-limits.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"dist/apollo-client.min.cjs":34321,
3-
"import { ApolloClient, InMemoryCache, HttpLink } from\"dist/index.js\" (production)":39583
2+
"dist/apollo-client.min.cjs":34276,
3+
"import { ApolloClient, InMemoryCache, HttpLink } from\"dist/index.js\" (production)":39535
44
}

‎src/__tests__/ApolloClient.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,6 @@ describe("ApolloClient", () => {
11781178
returnresult.__typename+result.id;
11791179
}
11801180
},
1181-
addTypename:true,
11821181
}),
11831182
});
11841183
}
@@ -1612,9 +1611,7 @@ describe("ApolloClient", () => {
16121611
it("will not use a default id getter if __typename is not present",()=>{
16131612
constclient=newApolloClient({
16141613
link:ApolloLink.empty(),
1615-
cache:newInMemoryCache({
1616-
addTypename:false,
1617-
}),
1614+
cache:newInMemoryCache(),
16181615
});
16191616

16201617
client.writeQuery({
@@ -1832,9 +1829,7 @@ describe("ApolloClient", () => {
18321829
it("will not use a default id getter if id is present and __typename is not present",()=>{
18331830
constclient=newApolloClient({
18341831
link:ApolloLink.empty(),
1835-
cache:newInMemoryCache({
1836-
addTypename:false,
1837-
}),
1832+
cache:newInMemoryCache(),
18381833
});
18391834

18401835
client.writeQuery({
@@ -1881,9 +1876,7 @@ describe("ApolloClient", () => {
18811876
it("will not use a default id getter if _id is present but __typename is not present",()=>{
18821877
constclient=newApolloClient({
18831878
link:ApolloLink.empty(),
1884-
cache:newInMemoryCache({
1885-
addTypename:false,
1886-
}),
1879+
cache:newInMemoryCache(),
18871880
});
18881881

18891882
client.writeQuery({
@@ -1930,9 +1923,7 @@ describe("ApolloClient", () => {
19301923
it("will not use a default id getter if either _id or id is present when __typename is not also present",()=>{
19311924
constclient=newApolloClient({
19321925
link:ApolloLink.empty(),
1933-
cache:newInMemoryCache({
1934-
addTypename:false,
1935-
}),
1926+
cache:newInMemoryCache(),
19361927
});
19371928

19381929
client.writeQuery({

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp