* Called either directly via `WritableResource.set` or via `.value.set()`.
(value: T)
| 348 | * Called either directly via `WritableResource.set` or via `.value.set()`. |
| 349 | */ |
| 350 | override set(value: T): void { |
| 351 | if (this.destroyed) { |
| 352 | return; |
| 353 | } |
| 354 | |
| 355 | const error = untracked(this.error); |
| 356 | const state = untracked(this.state); |
| 357 | |
| 358 | if (!error) { |
| 359 | const current = untracked(this.value); |
| 360 | if ( |
| 361 | state.status === 'local' && |
| 362 | (this.equal ? this.equal(current, value) : current === value) |
| 363 | ) { |
| 364 | return; |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | // Enter Local state with the user-defined value. |
| 369 | this.state.set({ |
| 370 | extRequest: state.extRequest, |
| 371 | status: 'local', |
| 372 | previousStatus: 'local', |
| 373 | stream: signal( |
| 374 | {value}, |
| 375 | ngDevMode ? createDebugNameObject(this.debugName, 'stream') : undefined, |
| 376 | ), |
| 377 | }); |
| 378 | |
| 379 | // We're departing from whatever state the resource was in previously, so cancel any in-progress |
| 380 | // loading operations. |
| 381 | this.abortInProgressLoad(); |
| 382 | } |
| 383 | |
| 384 | override reload(): boolean { |
| 385 | // We don't want to restart in-progress loads. |
nothing calls this directly
no test coverage detected