statelyai / xstate-viz

Visualizer for XState machines
https://stately.ai/viz
MIT License
434 stars 102 forks source link

Visualizer side bar too big #412

Closed pckilgore closed 1 year ago

pckilgore commented 1 year ago

Description

The inspector side bar is unusably large and cannot be hidden.

Expected Result

Able to view state machines without nearly half the screen on a laptop being dead space.

Actual Result

Too much sidebar:

image

Reproduction

See above.

pckilgore commented 1 year ago

381

pckilgore commented 1 year ago

The workaround in that issue doesn't seem to work.

pckilgore commented 1 year ago

Ahh, the url not the iframe src, oops.

function Test(){
  const frameRef = React.useRef<HTMLIFrameElement>(null);
  useMachine(testMachine, { devTools: true });

  React.useLayoutEffect(() => {
    const inspector = inspect({
      url: 'https://stately.ai/viz/embed?mode=viz&inspect',
      iframe: frameRef.current,
    });
    return () => inspector?.disconnect();
  }, []);

  return <iframe ref={frameRef} style={{ height: '100%', width: '100%' }} />;
}