Closed otakustay closed 6 years ago
如果我理解正确的话,当tableName为空时,selectEntities是要强制
{
usersByID: {
123: {...},
456: {...}
},
postsByName: {
foo: {...},
bar: {...}
}
}
这种格式的,对吧?然后每个key作为要更新的table?这种强制的话需要验证判断么?比如如果没有按照这种格式的话,我只返回了对象:
{
123: {...},
456: {...}
}
我理解,现在的withTableUpdate,selectEntities应该就是返回的这种单一的entity。这样更新的话,会把123,456作为tableName来更新的吧
还有就是,如果tableName给出了的话,selectEntities是否应该也要返回与tableName相对应的key?比如:上面的例子,selectEntities返回那样一个对象,tableNames需要是['usersById', 'postsByName'] ?
这种格式的,对吧
是的,必须这种格式。如果变成下面的形式,就会产生出123这样的实体表,这是符合预期的
如果tableName给出了的话,selectEntities是否应该也要返回与tableName相对应的key
当tableName
给了的时候,保持和现在版本一致的逻辑,selectEntiteis
返回的对象中就是123、456这些
Fixed via #7
This requires to change current
withTableUpdate(tableName, selectEntities)
towithTableUpdate(selectEntities, [tableName])
By this change of design, we allow
selectEntities
to return multiple table patches whentableName
is not provided, in this caseselectEntities
should return an object like:By the time an object with multiple table patches are returned, multiple
UPDATE_ENTITY_TABLE
actions are dispatched (or we just dispatch oneUPDATE_MULTIPLE_ENTITY_TABLES
action, we can discuss it)This involves a breaking change of API so we need to publish version
0.6.0