Request status grouping #349
-
Setup: some requests combineLatest([
selectIsRequestPending('get-todo-1203'),
selectIsRequestPending('get-todo-205'),
selectIsRequestPending('get-todo-34'),
...]).pipe(map([a, b, c, ...]) => a || b || c || ...) However it's possible to combine as such only having request keys beforehead. Now imagine every So for the second option you don't know or care for what stands for isAnyTodoLoading$ = store.pipe(
select((st) => st.requestsStatus),
map(
(x) =>
Object.entries(x).filter(
(e) =>
e[1].value === 'pending' &&
e[0].startsWith('get-todo-')
).length > 0
)
); Doesn't look clean and all so I thought I could miss something related within Elf itself. Did I? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The groupKey isn't related to this. Your way is valid. You can abstract it into a reusable operator. |
Beta Was this translation helpful? Give feedback.
The groupKey isn't related to this. Your way is valid. You can abstract it into a reusable operator.