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

Skip to content

chore: Add XState inspector back #4268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions site/src/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { inspect } from "@xstate/inspect"
import { createRoot } from "react-dom/client"
import { Interpreter } from "xstate"
import { App } from "./app"
import "./i18n"

// if this is a development build and the developer wants to inspect
// helpful to see realtime changes on the services
if (process.env.NODE_ENV === "development" && process.env.INSPECT_XSTATE === "true") {
// configure the XState inspector to open in a new tab
inspect({
url: "https://stately.ai/viz?inspect",
iframe: false,
})
// configure all XServices to use the inspector
Interpreter.defaultOptions.devTools = true
}

// This is the entry point for the app - where everything start.
// In the future, we'll likely bring in more bootstrapping logic -
// like: https://github.com/coder/m/blob/50898bd4803df7639bd181e484c74ac5d84da474/product/coder/site/pages/_app.tsx#L32
Expand Down
1 change: 1 addition & 0 deletions site/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default defineConfig({
define: {
"process.env": {
NODE_ENV: process.env.NODE_ENV,
INSPECT_XSTATE: process.env.INSPECT_XSTATE,
},
},
server: {
Expand Down