所以我正在使用normalizr按摩一些我认为合适的数据。但是,我的应用程序不需要通过normalizr传递的某些实体。有没有办法使用流程策略或类似的东西抛弃实体?谢谢!
const testSchema = new schema.Entity('things', {}, {
idAttribute: thing => `${thing.id}`,
processStrategy: (value, parent, key) => {
if(!obj.mapping[value.fields.id]){
// If we get in here, this entity is not needed as
// there is no mapping available.
// How can i throw this entity out?
}
return {
...value.fields,
prop: obj.mapping[value.fields.id].mapped_thing,
prop2: obj.mapping[value.fields.id].mapped_thing2,
prop3: obj.mapping[value.fields.id].mapped_thing3
}
}
});
这样的事情可能吗?或者有更好的方法来删除实体吗?