Skip to content

a way to change sortComparer in entityAdapter? #1356

Answered by markerikson
kuk941025 asked this question in Q&A
Discussion options

You must be logged in to vote

Not possible at the moment, sorry.

createEntityAdapter creates a closure, and there's currently no way to change the sorting behavior after creation.

You could in theory create more than one adapter with different sorting methods, and switch which one you're using:

if (someCondition) {
  sortByNameAdapter.upsertOne(state, action)
} else {
  sortByDateAdapter.upsertOne(state, action)
}

Replies: 1 comment

Comment options

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