Skip to content

Commit

Permalink
fix(gatsby): Use xstate predictableActionArguments & update to 4.34 (
Browse files Browse the repository at this point in the history
…gatsbyjs#36342)

* update version and fix types

* yolo add option

* Work around removal of meta.state

* Refactor `meta.state` access in `gatsby-source-filesystem` (gatsbyjs#36355)

Co-authored-by: Lennart <lekoarts@gmail.com>

* fix ts-ignore

* Upgrade XState to the latest 4.33.3 (gatsbyjs#36451)

* update to latest xstate

* Use `pendingQueryRuns` available on the event (gatsbyjs#36393)

* Revert "Use `pendingQueryRuns` available on the event (gatsbyjs#36393)"

This reverts commit 9460dd3.

Co-authored-by: tyhopp <hopp.ty.c@gmail.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Co-authored-by: Ty Hopp <tyhopp@users.noreply.github.com>
  • Loading branch information
4 people committed Nov 17, 2022
1 parent a42f4ca commit 396c6c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mime": "^2.5.2",
"pretty-bytes": "^5.4.1",
"valid-url": "^1.0.9",
"xstate": "4.32.1"
"xstate": "^4.34.0"
},
"devDependencies": {
"@babel/cli": "^7.15.4",
Expand Down
11 changes: 8 additions & 3 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const chokidar = require(`chokidar`)
const fs = require(`fs`)
const path = require(`path`)
const { Machine, interpret } = require(`xstate`)
const { createMachine, interpret, assign } = require(`xstate`)

const { createFileNode } = require(`./create-file-node`)
const { ERROR_MAP } = require(`./error-utils`)
Expand Down Expand Up @@ -61,13 +61,17 @@ const createFSMachine = (
}

const log = expr => (ctx, action, meta) => {
if (meta.state.matches(`BOOTSTRAP.BOOTSTRAPPED`)) {
if (ctx.bootstrapped) {
reporter.info(expr(ctx, action, meta))
}
}

const fsMachine = Machine(
const fsMachine = createMachine(
{
predictableActionArguments: true,
context: {
bootstrapped: false,
},
id: `fs`,
type: `parallel`,
states: {
Expand All @@ -81,6 +85,7 @@ const createFSMachine = (
},
BOOTSTRAPPED: {
type: `final`,
entry: assign({ bootstrapped: true }),
},
},
},
Expand Down

0 comments on commit 396c6c7

Please sign in to comment.