Managing granular per-entity loading states in SignalStore collections #287
-
|
When working with entity stores, I frequently encounter a specific UI/UX challenge:
The Problem:Currently, these actions share the same "request status" as the rest of the store. If I trigger a "Delete" action on one row, the entire store reflects a loading state. I cannot distinguish which specific entity is being processed, resulting in a UI where either every row shows a spinner or none do. Considered Alternatives:I’ve thought about providing a separate single-entity SignalStore for every row. However, it's not possible (or I missed something) to implement with components like My Current (Non-Ideal) Workaround:Before switching to ngrx-toolkit, I implemented a custom <td mat-cell *matCellDef="let row">
<button mat-icon-button (click)="store.delete(row.id)">
@let (store.deleteLoading() && store.withPayload('delete', row.id)) {
<mat-icon>pending</mat-icon>
} @else {
<mat-icon>delete</mat-icon>
}
</button>
</td>Question:How do you address granular, per-row feedback? Is there a pattern for tracking "active" entity IDs during side effects without bloating the global state? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
I don't work with entities myself, so perhaps my perspective here is missing some essentials. To clarify, when you say "I load a collection and manage global feedback using setLoading / setLoaded.", are you talking about using that from
|
Beta Was this translation helpful? Give feedback.
Hey @Tiime-LcsGa, I don't think that
withCallStateworks for those fine-granular updates. Have you ever though about extending the entity itself with such a callstate property?So you would have something like this: