Skip to content

conditional transitions break the visualisation #200

Description

@bonduell

if i try to use transitions like { name : 'goto', from: 'A' to: newState => newState) - visualisation doesn't work as expected.

a little fix can improve this ->

dotcfg.transitions = function(config, options) {
let init = config.init,
transitions = config.options.transitions || [], // easier to visualize using the ORIGINAL transition declarations rather than our run-time mapping
output = [];

if (options.init && init.active) {
    dotcfg.transition(init.name, init.from, init.to, init.dot, config, options, output)
}

transitions.forEach(transition => {
    let to = typeof (transition.to) === 'function' ? transition.to() : transition.to;
    to && dotcfg.transition(transition.name, transition.from, to, transition.dot, config, options, output);
})

return output;

}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions