(persistedState?: Snapshot<unknown>)
| 259 | } |
| 260 | |
| 261 | private _initState(persistedState?: Snapshot<unknown>) { |
| 262 | try { |
| 263 | this._snapshot = persistedState |
| 264 | ? this.logic.restoreSnapshot |
| 265 | ? this.logic.restoreSnapshot(persistedState, this._actorScope) |
| 266 | : persistedState |
| 267 | : this.logic.getInitialSnapshot(this._actorScope, this.options?.input); |
| 268 | } catch (err) { |
| 269 | // if we get here then it means that we assign a value to this._snapshot that is not of the correct type |
| 270 | // we can't get the true `TSnapshot & { status: 'error'; }`, it's impossible |
| 271 | // so right now this is a lie of sorts |
| 272 | this._snapshot = { |
| 273 | status: 'error', |
| 274 | output: undefined, |
| 275 | error: err |
| 276 | } as any; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | // array of functions to defer |
| 281 | private _deferred: Array<() => void> = []; |
no test coverage detected