Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Bug: Visualizer breaks silently with a console error (and gets stuck on "Visualizing machine") #363

Open
owaiswiz opened this issue May 20, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@owaiswiz
Copy link

Description

A machine that can be visualized in XState editor, as well as the (legacy?) old visualizer at https://xstate.js.org/viz/, does not work on the new visualizer at: https://stately.ai/viz/27e372fa-0611-4ae1-9d49-ffbe53ecb4d8.

It emits a console error - TypeError: Cannot read properties of undefined (reading 'c') and the visualizer just gets stuck at the loading screen for "Visualizing machine".

Here's a minimal machine specification extracted from the real application:

import { createMachine, send } from "xstate";
export const videoPlayerMachine =
  createMachine({
    id: "demo",
    initial: "loaded",
    states: {
      loaded: {
        initial: "seeked",
        states: {
          seeked: {
            initial: "paused",
            states: {
              paused: {},
            },
          },
          seeking: {
            on: {
              SEEKED: {
                target: "seeked",
              },
            },
            after: {
              "750": {
                target: "seeked",
              },
            },
          },
        },
        on: {
          PROGRESS: {},
          SEEK: {
            target: "loaded.seeking",
          },
        },
      },
    },
  });

Expected result

This should have worked with the new visualizer as it works on the old one as well as on the editor.

Actual result

It does not and it emits a console error - TypeError: Cannot read properties of undefined (reading 'c') and the visualizer just gets stuck at the loading screen for "Visualizing machine".

Note
If you remove PROGRESS: {}, it starts working. Or if you remove SEEK: {....}, it starts working. Or if you remove the on: {...} or after: {...} block in loaded.seeking, it starts working

Reproduction

https://stately.ai/viz/7437af7f-2072-4f88-8df6-2b7bfb1d6d04

Additional context

No response

@owaiswiz owaiswiz added the bug Something isn't working label May 20, 2022
@owaiswiz owaiswiz changed the title Bug: Visualizer breaks silently with a console error (and stuck on visualizing machine) Bug: Visualizer breaks silently with a console error (and gets stuck on "Visualizing machine") May 20, 2022
@owaiswiz
Copy link
Author

Didn't realize https://github.com/statelyai/xstate-viz existed before creating this. That seems a more appropriate place for this issue. Feel free to move.

@Andarist Andarist transferred this issue from statelyai/xstate May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant