Skip to content

Commit 67c5ed1

Browse files
evanyeungmeta-codesync[bot]
authored andcommitted
Fix schema cache not invalidated on base project schema changes
Reviewed By: tyao1 Differential Revision: D95480527 fbshipit-source-id: 526f039aa2fe10954dc0a44232c856d4a83a96df
1 parent 4df3da0 commit 67c5ed1

3 files changed

Lines changed: 4 additions & 204 deletions

File tree

compiler/crates/relay-compiler/src/build_project/build_schema.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ pub fn build_schema(
3737
) -> DiagnosticsResult<Arc<SDLSchema>> {
3838
if let Some(schema) = compiler_state.schema_cache.get(&project_config.name)
3939
&& !compiler_state.project_has_pending_schema_changes(project_config.name)
40+
&& !project_config
41+
.base
42+
.is_some_and(|base| compiler_state.project_has_pending_schema_changes(base))
4043
{
4144
return Ok(schema.clone());
4245
}

compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/incremental_base_project_extension_change.expected

Lines changed: 1 addition & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
==================================== INPUT ====================================
2-
// expected-to-throw
3-
42
# Incremental extension change in a base project.
53
#
64
# The base project declares schemaExtensions. The derived project inherits
@@ -52,206 +50,7 @@ extend type User { greeting: String }
5250

5351
//-++ extensions/extensions.graphql
5452
extend type User { greeting: Int }
55-
==================================== ERROR ====================================
56-
INCREMENTAL COMPILATION BUG DETECTED!
57-
58-
Incremental and full results differ!
59-
60-
Incremental:
61-
//-++ base_src/__generated__/baseQuery.graphql.ts
62-
/**
63-
* <auto-generated> SignedSource<<727797988d2f882d29c10e160c1d6b42>>
64-
* @lightSyntaxTransform
65-
* @nogrep
66-
*/
67-
68-
/* tslint:disable */
69-
/* eslint-disable */
70-
// @ts-nocheck
71-
72-
import { ConcreteRequest } from 'relay-runtime';
73-
export type baseQuery$variables = Record<PropertyKey, never>;
74-
export type baseQuery$data = {
75-
readonly me: {
76-
readonly greeting: number | null | undefined;
77-
readonly name: string | null | undefined;
78-
} | null | undefined;
79-
};
80-
export type baseQuery = {
81-
response: baseQuery$data;
82-
variables: baseQuery$variables;
83-
};
84-
85-
const node: ConcreteRequest = (function(){
86-
var v0 = [
87-
{
88-
"alias": null,
89-
"args": null,
90-
"concreteType": "User",
91-
"kind": "LinkedField",
92-
"name": "me",
93-
"plural": false,
94-
"selections": [
95-
{
96-
"alias": null,
97-
"args": null,
98-
"kind": "ScalarField",
99-
"name": "name",
100-
"storageKey": null
101-
},
102-
{
103-
"kind": "ClientExtension",
104-
"selections": [
105-
{
106-
"alias": null,
107-
"args": null,
108-
"kind": "ScalarField",
109-
"name": "greeting",
110-
"storageKey": null
111-
}
112-
]
113-
}
114-
],
115-
"storageKey": null
116-
}
117-
];
118-
return {
119-
"fragment": {
120-
"argumentDefinitions": [],
121-
"kind": "Fragment",
122-
"metadata": null,
123-
"name": "baseQuery",
124-
"selections": (v0/*:: as any*/),
125-
"type": "Query",
126-
"abstractKey": null
127-
},
128-
"kind": "Request",
129-
"operation": {
130-
"argumentDefinitions": [],
131-
"kind": "Operation",
132-
"name": "baseQuery",
133-
"selections": (v0/*:: as any*/)
134-
},
135-
"params": {
136-
"cacheID": "d5cea3113e4596144322cb752d654634",
137-
"id": null,
138-
"metadata": {},
139-
"name": "baseQuery",
140-
"operationKind": "query",
141-
"text": "query baseQuery {\n me {\n name\n }\n}\n"
142-
}
143-
};
144-
})();
145-
146-
(node as any).hash = "ecd4d927c59e2991af88dbaaf9dc1b8f";
147-
148-
export default node;
149-
150-
//-++ derived_src/__generated__/derivedQuery.graphql.ts
151-
/**
152-
* <auto-generated> SignedSource<<572f18ffaf2c398899f3731a7844e457>>
153-
* @lightSyntaxTransform
154-
* @nogrep
155-
*/
156-
157-
/* tslint:disable */
158-
/* eslint-disable */
159-
// @ts-nocheck
160-
161-
import { ConcreteRequest } from 'relay-runtime';
162-
export type derivedQuery$variables = Record<PropertyKey, never>;
163-
export type derivedQuery$data = {
164-
readonly me: {
165-
readonly greeting: string | null | undefined;
166-
readonly name: string | null | undefined;
167-
} | null | undefined;
168-
};
169-
export type derivedQuery = {
170-
response: derivedQuery$data;
171-
variables: derivedQuery$variables;
172-
};
173-
174-
const node: ConcreteRequest = (function(){
175-
var v0 = [
176-
{
177-
"alias": null,
178-
"args": null,
179-
"concreteType": "User",
180-
"kind": "LinkedField",
181-
"name": "me",
182-
"plural": false,
183-
"selections": [
184-
{
185-
"alias": null,
186-
"args": null,
187-
"kind": "ScalarField",
188-
"name": "name",
189-
"storageKey": null
190-
},
191-
{
192-
"kind": "ClientExtension",
193-
"selections": [
194-
{
195-
"alias": null,
196-
"args": null,
197-
"kind": "ScalarField",
198-
"name": "greeting",
199-
"storageKey": null
200-
}
201-
]
202-
}
203-
],
204-
"storageKey": null
205-
}
206-
];
207-
return {
208-
"fragment": {
209-
"argumentDefinitions": [],
210-
"kind": "Fragment",
211-
"metadata": null,
212-
"name": "derivedQuery",
213-
"selections": (v0/*:: as any*/),
214-
"type": "Query",
215-
"abstractKey": null
216-
},
217-
"kind": "Request",
218-
"operation": {
219-
"argumentDefinitions": [],
220-
"kind": "Operation",
221-
"name": "derivedQuery",
222-
"selections": (v0/*:: as any*/)
223-
},
224-
"params": {
225-
"cacheID": "90badf053dbd4901c413786a75ea0a0e",
226-
"id": null,
227-
"metadata": {},
228-
"name": "derivedQuery",
229-
"operationKind": "query",
230-
"text": "query derivedQuery {\n me {\n name\n }\n}\n"
231-
}
232-
};
233-
})();
234-
235-
(node as any).hash = "28b08d763d5e75fd97b936b19b19f5bb";
236-
237-
export default node;
238-
239-
240-
241-
Artifact Map:
242-
Project: base_project
243-
Type: Mapping
244-
- Source: ExecutableDefinition: baseQuery
245-
Path: base_src/__generated__/baseQuery.graphql.ts
246-
247-
Project: derived_project
248-
Type: Mapping
249-
- Source: ExecutableDefinition: derivedQuery
250-
Path: derived_src/__generated__/derivedQuery.graphql.ts
251-
252-
253-
254-
Full:
53+
==================================== OUTPUT ===================================
25554
//-++ base_src/__generated__/baseQuery.graphql.ts
25655
/**
25756
* <auto-generated> SignedSource<<727797988d2f882d29c10e160c1d6b42>>

compiler/crates/relay-compiler/tests/relay_compiler_integration/fixtures/incremental_base_project_extension_change.input

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// expected-to-throw
2-
31
# Incremental extension change in a base project.
42
#
53
# The base project declares schemaExtensions. The derived project inherits

0 commit comments

Comments
 (0)