xstate-viz icon indicating copy to clipboard operation
xstate-viz copied to clipboard

"after" animation kicks only once

Open MichalBryxi opened this issue 3 years ago • 1 comments

Description

Assume following machine:

import { createMachine } from 'xstate';

const machine = createMachine(
  {
    id: 'doorman',
    initial: 'idle',
    states: {
      idle: {
        on: {
          ACTIVE_MEETING: 'working',
        },
      },
      working: {
        type: 'parallel',

        states: {
          ticking: {
            entry: [
              () => {
                console.log("entered a");
              }
            ],
            after: {
              1000: { target: 'ticking' }
            }
          },
        }
      },
    },
  },
);

export default machine;

Expected Result

The animation spinner for "after" should keep spinning over and over after the machine enters the "working" state.

Actual Result

Animation kicks only once.

Reproduction

See above

Additional context

delayed-animation

MichalBryxi avatar Jan 02 '22 21:01 MichalBryxi

I can confirm that this is a bug. It feels like React's key prop could be used here to fix this cheaply but OTOH there is no "clear" key that could be used here to fix it this way.

Andarist avatar Jan 03 '22 12:01 Andarist