-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gatsby): Defer node mutation during querying (#25479)
* Move bootstrap into machine * Add parent span and query extraction * Add rebuildSchemaWithSitePage * Use values from context * Remove logs * Add redirectListener * Changes from review * Log child state transitions * Add state machine for query running * Changes from review * Changes from review * Switch to reporter * Use assertStore * Remove unused action * Remove unusued config * Remove unusued config * Add gql runner reset * Handle node mutation queuing and batching in state machine * Use new pagedata utils * Use develop queue * New xstate syntax * Work-around xstate bug * Track first run * Track first run * Disable --quiet in e2e * Don't defer node mutation if we're outside the state machine * Re-quieten e2e * Listen for query file changes * Lint * Handle webhook * Changes from review * Fix typings * Changes from review * Typefix * feat(gatsby): Move final parts into develop state machine (#25716) * Move remaining parts into state machine * Move top level state machine into state machines dir * Add machine ids * Add missing imports * Resolve api promises * Remove unused action * Move logging into helper * Changes from review * Manually save db * Add comments * Remove first run from query running * Refactor into separate data layer machines * Fix condition Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
- Loading branch information
Showing
33 changed files
with
1,080 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
import { calcInitialDirtyQueryIds, groupQueryIds } from "../query" | ||
import { | ||
calcInitialDirtyQueryIds, | ||
calcDirtyQueryIds, | ||
groupQueryIds, | ||
} from "../query" | ||
import { IGroupedQueryIds } from "./" | ||
import { IQueryRunningContext } from "../state-machines/query-running/types" | ||
import { assertStore } from "../utils/assert-store" | ||
|
||
export async function calculateDirtyQueries({ | ||
store, | ||
firstRun, | ||
}: Partial<IQueryRunningContext>): Promise<{ | ||
queryIds: IGroupedQueryIds | ||
}> { | ||
assertStore(store) | ||
|
||
const state = store.getState() | ||
// TODO: Check filesDirty from context | ||
|
||
const queryIds = calcInitialDirtyQueryIds(state) | ||
const queryIds = firstRun | ||
? calcInitialDirtyQueryIds(state) | ||
: calcDirtyQueryIds(state) | ||
return { queryIds: groupQueryIds(queryIds) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.