Skip to content

Commit 9460dd3

Browse files
authored
Use pendingQueryRuns available on the event (#36393)
1 parent ce74ec5 commit 9460dd3

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

packages/gatsby/src/services/calculate-dirty-queries.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import { IGroupedQueryIds } from "./"
33
import { IQueryRunningContext } from "../state-machines/query-running/types"
44
import { assertStore } from "../utils/assert-store"
55

6-
export async function calculateDirtyQueries({
7-
store,
8-
websocketManager,
9-
currentlyHandledPendingQueryRuns,
10-
}: Partial<IQueryRunningContext>): Promise<{
6+
export async function calculateDirtyQueries(
7+
{ store, websocketManager }: Partial<IQueryRunningContext>,
8+
{
9+
pendingQueryRuns: currentlyHandledPendingQueryRuns,
10+
}: {
11+
pendingQueryRuns?: Set<string>
12+
} = {}
13+
): Promise<{
1114
queryIds: IGroupedQueryIds
1215
}> {
1316
assertStore(store)

packages/gatsby/src/state-machines/query-running/actions.ts

-6
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,10 @@ export const trackRequestedQueryRun = assign<
4242
},
4343
})
4444

45-
export const clearCurrentlyHandledPendingQueryRuns =
46-
assign<IQueryRunningContext>({
47-
currentlyHandledPendingQueryRuns: undefined,
48-
})
49-
5045
export const queryActions: ActionFunctionMap<IQueryRunningContext, any> = {
5146
assignDirtyQueries,
5247
flushPageData,
5348
markSourceFilesDirty,
5449
markSourceFilesClean,
5550
trackRequestedQueryRun,
56-
clearCurrentlyHandledPendingQueryRuns,
5751
}

packages/gatsby/src/state-machines/query-running/index.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,15 @@ export const queryStates: MachineConfig<IQueryRunningContext, any, any> = {
6262
},
6363
},
6464
calculatingDirtyQueries: {
65-
entry: assign<IQueryRunningContext>(({ pendingQueryRuns }) => {
66-
return {
67-
pendingQueryRuns: new Set(),
68-
currentlyHandledPendingQueryRuns: pendingQueryRuns,
69-
}
65+
entry: assign({
66+
pendingQueryRuns: new Set(),
7067
}),
7168
invoke: {
7269
id: `calculating-dirty-queries`,
7370
src: `calculateDirtyQueries`,
7471
onDone: {
7572
target: `runningStaticQueries`,
76-
actions: [
77-
`assignDirtyQueries`,
78-
`clearCurrentlyHandledPendingQueryRuns`,
79-
],
73+
actions: [`assignDirtyQueries`],
8074
},
8175
},
8276
},

packages/gatsby/src/state-machines/query-running/types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ export interface IQueryRunningContext {
2323
websocketManager?: WebsocketManager
2424
filesDirty?: boolean
2525
pendingQueryRuns?: Set<string>
26-
currentlyHandledPendingQueryRuns?: Set<string>
2726
}

0 commit comments

Comments
 (0)