Skip to content

Something like akita array utils? #270

Answered by NetanelBasal
maxpowel asked this question in Q&A
Discussion options

You must be logged in to vote

Elf has no array methods since I don't want to maintain it. There are libraries on the web that do the same thing.

According to your example, if the entities that are changed are the comments, you should switch the stream to this:

 posts$ = store.pipe(
    selectAllEntities({ ref: commentsEntitiesRef }),
    withLatestFrom(store.pipe(selectEntities()),
    map(([comments, posts]) => {
      return posts.map(s => {
           return {
              ...s, 
              comments: s.comments.map( commentId => {
                return comments[commentId]
              })
           }
       })
      })
    );

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@micobarac
Comment options

Answer selected by maxpowel
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants