statelyai / rfcs

RFCs for XState and Stately tools
44 stars 5 forks source link

JSON-serialisable action definitions #2

Open mattpocock opened 3 years ago

mattpocock commented 3 years ago

Summary

on: {
  EVENT: {
    actions: [
      assign([
        {
          from: 'event.value',
          to: 'context.value',
        }
      ])
    ]
  }
}

Syntax TBD.

What problem does this solve? It means that assign actions can be constructed as part of the visual builder. This feels really interesting because it allows for visualisation of assignations, stronger analytics and better type definitions. I.e. you could construct typestates out of this information, and also infer some basic information about event type signatures. I feel like we may need to stray into this territory if we're going to turn XState into a fully deployable, no-code solution.

Link to original discord post:

https://discord.com/channels/795785288994652170/840540661442150470/848561574339411968