Skip to content

Commit

Permalink
Remove the internal getInitialConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Nov 10, 2023
1 parent 10d9539 commit 4b66906
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
3 changes: 1 addition & 2 deletions packages/core/src/StateMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { StateNode } from './StateNode.ts';
import {
getConfiguration,
getStateNodeByPath,
getInitialConfiguration,
getStateNodes,
isInFinalState,
isStateId,
Expand Down Expand Up @@ -398,7 +397,7 @@ export class StateMachine<
{
context:
typeof context !== 'function' && context ? context : ({} as TContext),
configuration: getInitialConfiguration(this.root),
configuration: [this.root],
children: {},
status: 'active'
},
Expand Down
25 changes: 0 additions & 25 deletions packages/core/src/stateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1795,28 +1795,3 @@ export function stateValuesEqual(
aKeys.every((key) => stateValuesEqual(a[key], b[key]))
);
}

export function getInitialConfiguration(
rootNode: AnyStateNode
): AnyStateNode[] {
const configuration: AnyStateNode[] = [];
const initialTransition = rootNode.initial;

const statesToEnter = new Set<AnyStateNode>();
const statesForDefaultEntry = new Set<AnyStateNode>([rootNode]);

computeEntrySet(
[initialTransition],
{},
statesForDefaultEntry,
statesToEnter
);

for (const stateNodeToEnter of [...statesToEnter].sort(
(a, b) => a.order - b.order
)) {
configuration.push(stateNodeToEnter);
}

return configuration;
}

0 comments on commit 4b66906

Please sign in to comment.