Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e49ef68

Browse files
chore: Add XState inspector back (#4268)
1 parent 1755e97 commit e49ef68

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

site/src/Main.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
import { inspect } from "@xstate/inspect"
12
import { createRoot } from "react-dom/client"
3+
import { Interpreter } from "xstate"
24
import { App } from "./app"
35
import "./i18n"
46

7+
// if this is a development build and the developer wants to inspect
8+
// helpful to see realtime changes on the services
9+
if (process.env.NODE_ENV === "development" && process.env.INSPECT_XSTATE === "true") {
10+
// configure the XState inspector to open in a new tab
11+
inspect({
12+
url: "https://stately.ai/viz?inspect",
13+
iframe: false,
14+
})
15+
// configure all XServices to use the inspector
16+
Interpreter.defaultOptions.devTools = true
17+
}
18+
519
// This is the entry point for the app - where everything start.
620
// In the future, we'll likely bring in more bootstrapping logic -
721
// like: https://github.com/coder/m/blob/50898bd4803df7639bd181e484c74ac5d84da474/product/coder/site/pages/_app.tsx#L32

site/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default defineConfig({
1313
define: {
1414
"process.env": {
1515
NODE_ENV: process.env.NODE_ENV,
16+
INSPECT_XSTATE: process.env.INSPECT_XSTATE,
1617
},
1718
},
1819
server: {

0 commit comments

Comments
 (0)