Skip to content

Commit

Permalink
Merge pull request #42 from etclabscore/fix/allow-xstate-inspect-prod
Browse files Browse the repository at this point in the history
fix: allow xstate inspect
  • Loading branch information
shanejonas authored Sep 30, 2020
2 parents d077275 + 96a05a7 commit a0365dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/containers/MyApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const configuredAppMachine = appMachine.withConfig({
}, { cards: [], formData: null, error: null, result: null, createData: null });

const MyApp = () => {
const [state, send]: [any, any, any] =
const [state, send, service]: [any, any, any] =
useMachine<IContext, any>(configuredAppMachine, { devTools: true });
const [infoDialogOpen, setInfoDialogOpen] = useState<boolean>(false);
const [onboardingSchema, setOnboardingSchema] = useState();
Expand All @@ -78,6 +78,12 @@ const MyApp = () => {
delete formData.domain;
}

useEffect(() => {
if (window.location.search.includes("?inspect")) {
window.__xstate__.register(service);
}
}, [service]);

useEffect(() => {
if (jsonrpcServer) {
jsonrpcServer.stop();
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./xstate-setup";
import ReactDOM from "react-dom";
import React from "react";
import "./xstate-setup";
import MyApp from "./containers/MyApp";
import "./index.css";

Expand Down
File renamed without changes.

0 comments on commit a0365dd

Please sign in to comment.