0

我重新选择了每次更改 redux 存储中的任何集合时都会重新呈现的选择器,但我希望它仅在输入数据中引用的 id 更改时才更改。这可能与当前denormalize功能?

代码是:

// 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);
4

1 回答 1

0

好的,我用我的 npm 包 normalizr-entities解决了它

这就像 normalizr 非规范化的镜头

于 2017-09-09T09:11:05.887 回答