File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
packages/gatsby/src/query Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -183,12 +183,22 @@ export async function queryRunner(
183
183
.digest(`base64`)
184
184
185
185
const resultHashCache = getResultHashCache()
186
+
187
+ let resultHashCacheKey = queryJob.id
188
+ if (queryJob.queryType === `static`) {
189
+ // For static queries we use hash for a file path we output results to.
190
+ // With automatic sort and aggregation graphql codemod it is possible
191
+ // to have same result, but different query text hashes which would skip
192
+ // writing out file to disk if we don't check query hash as well
193
+ resultHashCacheKey += `-${queryJob.hash}`
194
+ }
195
+
186
196
if (
187
- resultHash !== (await resultHashCache.get(queryJob.id )) ||
197
+ resultHash !== (await resultHashCache.get(resultHashCacheKey )) ||
188
198
(queryJob.queryType === `page` &&
189
199
!pageDataExists(path.join(program.directory, `public`), queryJob.id))
190
200
) {
191
- await resultHashCache.set(queryJob.id , resultHash)
201
+ await resultHashCache.set(resultHashCacheKey , resultHash)
192
202
193
203
if (queryJob.queryType === `page` || queryJob.queryType === `slice`) {
194
204
// We need to save this temporarily in cache because
You can’t perform that action at this time.
0 commit comments