(
snapshot: Snapshot<unknown>,
_actorScope: ActorScope<
MachineSnapshot<
TContext,
TEvent,
TChildren,
TStateValue,
TTag,
TOutput,
TMeta,
TStateSchema
>,
TEvent,
AnyActorSystem,
TEmitted
>
)
| 525 | } |
| 526 | |
| 527 | public restoreSnapshot( |
| 528 | snapshot: Snapshot<unknown>, |
| 529 | _actorScope: ActorScope< |
| 530 | MachineSnapshot< |
| 531 | TContext, |
| 532 | TEvent, |
| 533 | TChildren, |
| 534 | TStateValue, |
| 535 | TTag, |
| 536 | TOutput, |
| 537 | TMeta, |
| 538 | TStateSchema |
| 539 | >, |
| 540 | TEvent, |
| 541 | AnyActorSystem, |
| 542 | TEmitted |
| 543 | > |
| 544 | ): MachineSnapshot< |
| 545 | TContext, |
| 546 | TEvent, |
| 547 | TChildren, |
| 548 | TStateValue, |
| 549 | TTag, |
| 550 | TOutput, |
| 551 | TMeta, |
| 552 | TStateSchema |
| 553 | > { |
| 554 | const children: Record<string, AnyActorRef> = {}; |
| 555 | const snapshotChildren: Record< |
| 556 | string, |
| 557 | { |
| 558 | src: string | AnyActorLogic; |
| 559 | snapshot: Snapshot<unknown>; |
| 560 | syncSnapshot?: boolean; |
| 561 | systemId?: string; |
| 562 | } |
| 563 | > = (snapshot as any).children; |
| 564 | |
| 565 | Object.keys(snapshotChildren).forEach((actorId) => { |
| 566 | const actorData = snapshotChildren[actorId]; |
| 567 | const childState = actorData.snapshot; |
| 568 | const src = actorData.src; |
| 569 | |
| 570 | const logic = |
| 571 | typeof src === 'string' ? resolveReferencedActor(this, src) : src; |
| 572 | |
| 573 | if (!logic) { |
| 574 | return; |
| 575 | } |
| 576 | |
| 577 | const actorRef = createActor(logic, { |
| 578 | id: actorId, |
| 579 | parent: _actorScope.self, |
| 580 | syncSnapshot: actorData.syncSnapshot, |
| 581 | snapshot: childState, |
| 582 | src, |
| 583 | systemId: actorData.systemId |
| 584 | }); |
no test coverage detected