I have reselect selector which gets rerendered every time any collection in redux store is changed, but I want it to change only when ids referenced in input data are changed. Is this possible with current denormalize
function?
The code is:
// TODO: fix rerenders
const mediaSelector = createSelector(
({ media }) => media.byId,
({ documents }) => documents.byId,
({ photos }) => photos.byId,
({ photoSizes }) => photoSizes.byId,
({ files }) => files.locations.byId,
(_, { media }) => media,
(media, documents, photos, photoSizes, fileLocations, data) => {
console.count('Connected Media');
return denormalize(data, schema, {
media,
documents,
photos,
photoSizes,
fileLocations,
});
},
);
const mapState = createStructuredSelector({
media: mediaSelector,
});
const enhance = connect(mapState);
Okay, I solved it with my npm package normalizr-entities
This is like lens for normalizr denormalization