feat: add withEntityResources
for managing entity state and resources
#243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds
withEntityResources()
to integrate Angular Resources that return arrays with NgRx Entities in SignalStore. It composes resource handling with entity helpers, keeps entity state linked to the resource value via linked signals, and supports both unnamed and named collections.withEntityResources()
libs/ngrx-toolkit
withEntityResources
- Resources & Entities together #236Motivation
Many resources represent collections. Previously, wiring
withResource
results intowithEntities
required boilerplate and manual sync. This feature removes redundancy by linking entity state to the resource value directly.Design Overview
withResource()
; derivesids
,entityMap
, andentities
from the resource’svalue
.id
compatible withEntityId
).Usage
Unnamed
Named
Entity Updaters
Implementation Notes
libs/ngrx-toolkit/src/lib/with-entity-resources.ts
with unit tests.libs/ngrx-toolkit/src/index.ts
.docs/docs/with-entity-resources.md
and sidebar updated.apps/demo/src/app/todo-entity-resource/*
with an E2E test.Tests & Demo
libs/ngrx-toolkit/src/lib/with-entity-resources.spec.ts
apps/demo/src/app/todo-entity-resource/*
apps/demo/e2e/todo-entity-resource.spec.ts
Documentation
withEntityResources()
usage, inputs, and examples.docs/docs/extensions.md
anddocs/sidebars.ts
.Breaking Changes
Checklist