Skip to content

Commit

Permalink
add VITE_XSTATE_DEBUG env
Browse files Browse the repository at this point in the history
  • Loading branch information
the-illarionov committed Nov 18, 2024
1 parent 93a3f0b commit 9f4bbf5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .ci/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
NODE_IMAGE="node:20"
NGINX_IMAGE="nginx:1.27"
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v1.48.2-jammy"
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v1.48.2-jammy"

VITE_XSTATE_DEBUG=0
4 changes: 3 additions & 1 deletion .dev/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ PREVIEW_PORT="8000"

NODE_IMAGE="node:20"
NGINX_IMAGE="nginx:1.27"
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v1.48.2-jammy"
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v1.48.2-jammy"

VITE_XSTATE_DEBUG=1
8 changes: 8 additions & 0 deletions frontend/env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
readonly VITE_XSTATE_DEBUG: '1' | '0'
}

interface ImportMeta {
readonly env: ImportMetaEnv
}
2 changes: 1 addition & 1 deletion frontend/src/machines/MachineApp/MachineApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const machineOptions: any = {
systemId: 'machineApp',
}

if (import.meta.env.DEV)
if (import.meta.env.DEV && import.meta.env.VITE_XSTATE_DEBUG === '1')
machineOptions.inspect = createBrowserInspector().inspect

const machineApp = useMachine(MachineApp, machineOptions)
Expand Down

0 comments on commit 9f4bbf5

Please sign in to comment.