From 4a484c0b2d5ee0efc8a12e5e556702aac3fd7a3a Mon Sep 17 00:00:00 2001 From: Michael Small Date: Sun, 4 Jan 2026 13:24:37 -0600 Subject: [PATCH 1/7] chore: add TODO to mention error handling of with resouce/entityResource --- docs/docs/with-entity-resources.md | 6 ++++-- docs/docs/with-resource.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/docs/with-entity-resources.md b/docs/docs/with-entity-resources.md index 57d54e88..3b7222c6 100644 --- a/docs/docs/with-entity-resources.md +++ b/docs/docs/with-entity-resources.md @@ -1,6 +1,8 @@ + + --- -title: withEntityResources() ---- + +## title: withEntityResources() ```typescript import { withEntityResources } from '@angular-architects/ngrx-toolkit'; diff --git a/docs/docs/with-resource.md b/docs/docs/with-resource.md index 869ed59e..1f8af579 100644 --- a/docs/docs/with-resource.md +++ b/docs/docs/with-resource.md @@ -1,6 +1,8 @@ + + --- -title: withResource() ---- + +## title: withResource() ```typescript import { withResource } from '@angular-architects/ngrx-toolkit'; From 00e2d1482a7b27e8298a345a0c56538bd0a80ce2 Mon Sep 17 00:00:00 2001 From: Michael Small Date: Sun, 4 Jan 2026 13:53:16 -0600 Subject: [PATCH 2/7] chore: describe choice/opttions for `withResource` error handling --- docs/docs/with-entity-resources.md | 8 ++++--- docs/docs/with-resource.md | 35 ++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/docs/docs/with-entity-resources.md b/docs/docs/with-entity-resources.md index 3b7222c6..0d98d1c2 100644 --- a/docs/docs/with-entity-resources.md +++ b/docs/docs/with-entity-resources.md @@ -1,8 +1,6 @@ - - --- - ## title: withEntityResources() +--- ```typescript import { withEntityResources } from '@angular-architects/ngrx-toolkit'; @@ -88,6 +86,10 @@ This exposes per-resource members with the resource name as a prefix: - **Resource members**: `todosValue()`, `todosStatus()`, `todosError()`, `todosIsLoading()`; `projectsValue()`, ... - **Entity members**: `todosIds()`, `todosEntityMap()`, `todosEntities()`; `projectsIds()`, `projectsEntityMap()`, `projectsEntities()` +## Error Handling + + + ## Component Usage ```typescript diff --git a/docs/docs/with-resource.md b/docs/docs/with-resource.md index 1f8af579..98b7e5a3 100644 --- a/docs/docs/with-resource.md +++ b/docs/docs/with-resource.md @@ -1,8 +1,6 @@ - - --- - -## title: withResource() +title: withResource() +--- ```typescript import { withResource } from '@angular-architects/ngrx-toolkit'; @@ -85,6 +83,35 @@ With named resources, each resource gets prefixed properties: - **Single resource:** use when your store works with just one data source. - **Named resources:** use when your store is larger and manages multiple entities or async operations. +## Error Handling + +The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withResource` to handle error handling with a particular strategy. +To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. + +```ts +withResource( + () => ({ + id: resource({ + loader: () => Promise.resolve(1), + defaultValue: 0, + }), + }), + // Other values: 'native' and 'previous value' + { errorHandling: 'undefined value' }, // default if not specified +), +``` + +Options: + +1. `'undfined value'` (default). In the event of an error, the resource's value will be `undefined` +1. `'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown. +1. `'native'`. No special handling is provided, inline with default error behavior. + + + + +Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://google.com). + ## Component Usage ```typescript From f8152f42468483dfca7676f8c1f2fe02fdad3150 Mon Sep 17 00:00:00 2001 From: Michael Small Date: Tue, 6 Jan 2026 19:37:51 -0600 Subject: [PATCH 3/7] docs: apply error copy to `withEntityResource` --- docs/docs/with-entity-resources.md | 26 +++++++++++++++++++++++++- docs/docs/with-resource.md | 3 +-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/docs/with-entity-resources.md b/docs/docs/with-entity-resources.md index 0d98d1c2..7d32c5f5 100644 --- a/docs/docs/with-entity-resources.md +++ b/docs/docs/with-entity-resources.md @@ -88,7 +88,31 @@ This exposes per-resource members with the resource name as a prefix: ## Error Handling - +The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withEntityResource` to handle error handling with a particular strategy. +To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. + +```ts +withEntityResource( + () => ({ + id: resource({ + loader: () => Promise.resolve(1), + defaultValue: 0, + }), + }), + // Other values: 'native' and 'previous value' + { errorHandling: 'undefined value' }, // default if not specified +), +``` + +Options: + +1. `'undfined value'` (default). In the event of an error, the resource's value will be `undefined` +1. `'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown. +1. `'native'`. No special handling is provided, inline with default error behavior. + + + +Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://google.com). ## Component Usage diff --git a/docs/docs/with-resource.md b/docs/docs/with-resource.md index 98b7e5a3..f9d5a1d5 100644 --- a/docs/docs/with-resource.md +++ b/docs/docs/with-resource.md @@ -107,8 +107,7 @@ Options: 1. `'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown. 1. `'native'`. No special handling is provided, inline with default error behavior. - - + Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://google.com). From 9ece2755b7b3f185b7cf09e7ffe6cddf8c635fca Mon Sep 17 00:00:00 2001 From: Michael Small Date: Tue, 6 Jan 2026 19:42:05 -0600 Subject: [PATCH 4/7] docs: flesh out resource error problem description --- docs/docs/with-entity-resources.md | 3 ++- docs/docs/with-resource.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/docs/with-entity-resources.md b/docs/docs/with-entity-resources.md index 7d32c5f5..c1d30969 100644 --- a/docs/docs/with-entity-resources.md +++ b/docs/docs/with-entity-resources.md @@ -88,7 +88,8 @@ This exposes per-resource members with the resource name as a prefix: ## Error Handling -The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withEntityResource` to handle error handling with a particular strategy. +The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withEntityResource` to approach error handling +with a particular strategy unique to the intersection of resources and the Signal Store. To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. ```ts diff --git a/docs/docs/with-resource.md b/docs/docs/with-resource.md index f9d5a1d5..70b70af0 100644 --- a/docs/docs/with-resource.md +++ b/docs/docs/with-resource.md @@ -85,7 +85,8 @@ With named resources, each resource gets prefixed properties: ## Error Handling -The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withResource` to handle error handling with a particular strategy. +The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withResource` to approach error handling +with a particular strategy unique to the intersection of resources and the Signal Store. To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. ```ts From 452c78778bee2cc9adc4e385e7b4ed6c2264cc50 Mon Sep 17 00:00:00 2001 From: Michael Small Date: Wed, 14 Jan 2026 21:35:25 -0600 Subject: [PATCH 5/7] docs: link to JSDoc for resource error handling --- docs/docs/with-entity-resources.md | 6 +++--- docs/docs/with-resource.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/with-entity-resources.md b/docs/docs/with-entity-resources.md index c1d30969..0dbc1185 100644 --- a/docs/docs/with-entity-resources.md +++ b/docs/docs/with-entity-resources.md @@ -88,6 +88,8 @@ This exposes per-resource members with the resource name as a prefix: ## Error Handling +Starting in NgRx Toolkit v20.6.0, error handling now has more resilient options. + The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withEntityResource` to approach error handling with a particular strategy unique to the intersection of resources and the Signal Store. To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. @@ -111,9 +113,7 @@ Options: 1. `'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown. 1. `'native'`. No special handling is provided, inline with default error behavior. - - -Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://google.com). +Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://github.com/angular-architects/ngrx-toolkit/blob/main/libs/ngrx-toolkit/src/lib/with-resource.ts#L402). ## Component Usage diff --git a/docs/docs/with-resource.md b/docs/docs/with-resource.md index 70b70af0..6f0022c6 100644 --- a/docs/docs/with-resource.md +++ b/docs/docs/with-resource.md @@ -85,6 +85,8 @@ With named resources, each resource gets prefixed properties: ## Error Handling +Starting in NgRx Toolkit v20.6.0, error handling now has more resilient options. + The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withResource` to approach error handling with a particular strategy unique to the intersection of resources and the Signal Store. To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. @@ -108,9 +110,7 @@ Options: 1. `'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown. 1. `'native'`. No special handling is provided, inline with default error behavior. - - -Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://google.com). +Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://github.com/angular-architects/ngrx-toolkit/blob/main/libs/ngrx-toolkit/src/lib/with-resource.ts#L402). ## Component Usage From 88ff856e4546ba6fe332d3612d297aaa5a60eb9b Mon Sep 17 00:00:00 2001 From: Michael Small Date: Wed, 14 Jan 2026 21:37:55 -0600 Subject: [PATCH 6/7] docs: fix misplaced `##` on page title --- docs/docs/with-entity-resources.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/with-entity-resources.md b/docs/docs/with-entity-resources.md index 0dbc1185..37f22519 100644 --- a/docs/docs/with-entity-resources.md +++ b/docs/docs/with-entity-resources.md @@ -1,5 +1,5 @@ --- -## title: withEntityResources() +title: withEntityResources() --- ```typescript From 964a75ff4ab6b1f3995b2738ef3622575fba4fe7 Mon Sep 17 00:00:00 2001 From: Michael Small Date: Thu, 15 Jan 2026 20:37:07 -0600 Subject: [PATCH 7/7] docs: feedback for `with(Entity)Resource` --- docs/docs/with-entity-resources.md | 27 +++------------------------ docs/docs/with-resource.md | 11 +++++------ 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/docs/docs/with-entity-resources.md b/docs/docs/with-entity-resources.md index 37f22519..a6eb3003 100644 --- a/docs/docs/with-entity-resources.md +++ b/docs/docs/with-entity-resources.md @@ -88,32 +88,11 @@ This exposes per-resource members with the resource name as a prefix: ## Error Handling -Starting in NgRx Toolkit v20.6.0, error handling now has more resilient options. +Starting in NgRx Toolkit v20.6.0, error state handling for `withResource` and `withEntityResources` was enhanced. -The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withEntityResource` to approach error handling -with a particular strategy unique to the intersection of resources and the Signal Store. -To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. +In the event of an error in a resource declared in `withEntityResource`, the resource's value will be `undefined`. -```ts -withEntityResource( - () => ({ - id: resource({ - loader: () => Promise.resolve(1), - defaultValue: 0, - }), - }), - // Other values: 'native' and 'previous value' - { errorHandling: 'undefined value' }, // default if not specified -), -``` - -Options: - -1. `'undfined value'` (default). In the event of an error, the resource's value will be `undefined` -1. `'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown. -1. `'native'`. No special handling is provided, inline with default error behavior. - -Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://github.com/angular-architects/ngrx-toolkit/blob/main/libs/ngrx-toolkit/src/lib/with-resource.ts#L402). +For further details, check out the error handling section of [`withResource`](./with-resource.md#error-handling). ## Component Usage diff --git a/docs/docs/with-resource.md b/docs/docs/with-resource.md index 6f0022c6..e023cea6 100644 --- a/docs/docs/with-resource.md +++ b/docs/docs/with-resource.md @@ -85,10 +85,9 @@ With named resources, each resource gets prefixed properties: ## Error Handling -Starting in NgRx Toolkit v20.6.0, error handling now has more resilient options. +The error throwing behavior of the native `resource` causes a deadlock in the error case. +That's why `withResource` (as of NgRx Toolkit v20.6.0) comes with a different error handling strategy, which doesn't throw. -The behavior of Angular's resources' error handling and the NgRx SignalStore's `getState/patchState` required `withResource` to approach error handling -with a particular strategy unique to the intersection of resources and the Signal Store. To prevent resource failures from blocking the store, the Toolkit provides some strategies to handle errors. ```ts @@ -106,11 +105,11 @@ withResource( Options: -1. `'undfined value'` (default). In the event of an error, the resource's value will be `undefined` -1. `'previous value'`. Provided the resource had a previous value, that previous value will be returned. If not, an error is thrown. +1. `'undefined value'` (default). In the event of an error, the resource's value will be `undefined` +1. `'previous value'`. The resource's previous value will be returned. 1. `'native'`. No special handling is provided, inline with default error behavior. -Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done and what a more longterm solution may be with some framework enhancements, check out the [JSDoc for the error handling strategy](https://github.com/angular-architects/ngrx-toolkit/blob/main/libs/ngrx-toolkit/src/lib/with-resource.ts#L402). +Under the hood, `'previous value'` and `'undefined value'` proxy the value. For a detailed explanation for why this is done, check out the [JSDoc for the error handling strategy](https://github.com/angular-architects/ngrx-toolkit/blob/main/libs/ngrx-toolkit/src/lib/with-resource.ts#L402). ## Component Usage