gpbl/denormalizr

Denormalizing a list of ids

Closed this issue · 1 comments

So in the examples you mentioned that we can denormalize using 4 different overloads/types for the input parameters as follow:

  • Denormalize a single object
  • Denormalize a list of objects
  • Denormalize by passing the id
  • Denormalize by passing a list of ids

Well. Actually when I try normalizing by passing the id, it works like this:

Case A:
const denormalized = denormalize(1, normalized.entities, articleSchema);

Case B:
But when I pass a list of the same id, it don't, like this:

const denormalized = denormalize([1], normalized.entities, articleListSchema);

I checked the test files and I noticed you use to loop on it manually like this:

Case C:
const denormalized = [1].map(id => denormalize(id, normalized.entities, articleListSchema));

So am I missing to have Case B working without using loop like in Case C. Thanks in advance!

gpbl commented

This should have been fixed upgrading to last normalizr and to denormalizr v0.5.0. Please reopen if not, thanks 👍