Skip to content

Commit

Permalink
Merge pull request #28 from Aluriak/patch27
Browse files Browse the repository at this point in the history
fix #27: tag initial not properly handled
  • Loading branch information
davidkpiano committed Feb 24, 2021
2 parents 4e38fb3 + 4af4a3e commit f767b5f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion xstate/scxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,19 @@ def convert_state(element: ET.Element, parent: ET.Element):

_, _, tag = element.tag.rpartition("}")

initial_state_key = element.attrib.get(
"initial",
convert_state(state_els[0], parent=element).get("key") if state_els else None,
)

result = {
"type": "parallel" if tag == "parallel" else None,
"id": f"{id}",
"key": id,
"exit": onexit,
"entry": onentry,
"states": states,
"initial": state_els[0].attrib.get("id") if state_els else None,
"initial": initial_state_key,
}

if len(transitions) > 0:
Expand Down

0 comments on commit f767b5f

Please sign in to comment.