Skip to content

Add removeMany({ where }) and selectByIdsΒ #5524

Closed

Description

@markerikson

Part of #5493.

Two common entity adapter operations need hand-written loops today: removing every entity that matches some fields, and selecting a list of entities by ID. We'll add both:

postsAdapter.removeMany(state, { where: { authorId: 5 } })

const selectPostsByIds = postsSelectors.selectByIds
selectPostsByIds(state, ids)
  • where takes a Partial<T> match object. Function predicates aren't supported, so a later indexed adapter can answer the same call faster without an API change.
  • selectByIds returns entities in the order of ids and is memoized on the ids reference.

Related: #799

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ws-entity

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions