* The initial state _before_ evaluating any microsteps. This "pre-initial" * state is provided to initial actions executed in the initial state. * * @internal
(
actorScope: AnyActorScope,
initEvent: any,
internalQueue: AnyEventObject[]
)
| 365 | * @internal |
| 366 | */ |
| 367 | _getPreInitialState( |
| 368 | actorScope: AnyActorScope, |
| 369 | initEvent: any, |
| 370 | internalQueue: AnyEventObject[] |
| 371 | ): MachineSnapshot< |
| 372 | TContext, |
| 373 | TEvent, |
| 374 | TChildren, |
| 375 | TStateValue, |
| 376 | TTag, |
| 377 | TOutput, |
| 378 | TMeta, |
| 379 | TStateSchema |
| 380 | > { |
| 381 | const { context } = this.config; |
| 382 | |
| 383 | const preInitial = createMachineSnapshot( |
| 384 | { |
| 385 | context: |
| 386 | typeof context !== 'function' && context ? context : ({} as TContext), |
| 387 | _nodes: [this.root], |
| 388 | children: {}, |
| 389 | status: 'active' |
| 390 | }, |
| 391 | this |
| 392 | ); |
| 393 | |
| 394 | if (typeof context === 'function') { |
| 395 | const assignment = ({ spawn, event, self }: any) => |
| 396 | context({ spawn, input: event.input, self }); |
| 397 | return resolveActionsAndContext( |
| 398 | preInitial, |
| 399 | initEvent, |
| 400 | actorScope, |
| 401 | [assign(assignment)], |
| 402 | internalQueue, |
| 403 | undefined |
| 404 | ) as SnapshotFrom<this>; |
| 405 | } |
| 406 | |
| 407 | return preInitial as SnapshotFrom<this>; |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * Returns the initial `State` instance, with reference to `self` as an |
no test coverage detected