Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions serverlessworkflow/sdk/state_machine_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ def definitions(self):

def parallel_state_details(self):
if isinstance(self.state, ParallelState):
if self.state.name not in self.state_machine.states.keys():
self.state_machine.add_states(self.state.name)
if self.is_first_state:
self.state_machine._initial = self.state.name

state_name = self.state.name
branches = self.state.branches
if branches:
Expand Down Expand Up @@ -208,8 +213,8 @@ def data_based_switch_state_details(self): ...
def operation_state_details(self):
if self.state.name not in self.state_machine.states.keys():
self.state_machine.add_states(self.state.name)
if self.is_first_state:
self.state_machine._initial = self.state.name
if self.is_first_state:
self.state_machine._initial = self.state.name

if isinstance(self.state, OperationState):
self.generate_actions_info(
Expand Down Expand Up @@ -264,11 +269,11 @@ def get_subflow_state(
)

# Generate the state machine for the subflow
for index, state in enumerate(sf.states):
for state in sf.states:
StateMachineGenerator(
state=state,
state_machine=new_machine,
is_first_state=index == 0,
is_first_state=sf.start == state.name,
get_actions=self.get_actions,
subflows=self.subflows,
).generate()
Expand Down
4 changes: 2 additions & 2 deletions serverlessworkflow/sdk/state_machine_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def __init__(
auto_transitions=False,
title=title,
)
for index, state in enumerate(workflow.states):
for state in workflow.states:
StateMachineGenerator(
state=state,
state_machine=self.machine,
is_first_state=index == 0,
is_first_state=workflow.start == state.name,
get_actions=self.get_actions,
subflows=subflows,
).generate()
Expand Down