* Called either directly via `WritableResource.set` or via `.value.set()`.
(value: T)
| 367 | * Called either directly via `WritableResource.set` or via `.value.set()`. |
| 368 | */ |
| 369 | override set(value: T): void { |
| 370 | if (this.destroyed) { |
| 371 | return; |
| 372 | } |
| 373 | |
| 374 | const error = untracked(this.error); |
| 375 | const state = untracked(this.state); |
| 376 | |
| 377 | if (!error) { |
| 378 | const current = untracked(this.value); |
| 379 | if ( |
| 380 | state.status === 'local' && |
| 381 | (this.equal ? this.equal(current, value) : current === value) |
| 382 | ) { |
| 383 | return; |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | // Enter Local state with the user-defined value. |
| 388 | this.state.set({ |
| 389 | extRequest: state.extRequest, |
| 390 | status: 'local', |
| 391 | previousStatus: 'local', |
| 392 | stream: signal( |
| 393 | {value}, |
| 394 | ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined, |
| 395 | ), |
| 396 | }); |
| 397 | |
| 398 | // We're departing from whatever state the resource was in previously, so cancel any in-progress |
| 399 | // loading operations. |
| 400 | this.abortInProgressLoad(); |
| 401 | } |
| 402 | |
| 403 | override reload(): boolean { |
| 404 | // We don't want to restart in-progress loads. |
nothing calls this directly
no test coverage detected