【发布时间】:2017-02-10 20:43:07
【问题描述】:
在进行 CREATE 调用后,我试图通过来自 falcor-router 的响应使我的 jsonGraph 对象的一部分无效。返回pathValues的列表时我可以成功这样做,类似于this earlier SE question:
{
route: 'foldersById[{keys:ids}].folders.createSubFolder',
call(callPath, args, refPaths, thisPaths) {
return createNewFolderSomehow(...)
.subscribe(folder => {
const folderPathValue = {
path: ['foldersById', folder.parentId, 'folders', folder.parentSubFolderCount -1],
value: $ref(['foldersById', folder.id])
};
const folderCollectionLengthPathValue = {
path: ['folderList', 'length'],
invalidated: true
};
return [folderPathValue, folderCollectionLengthPathValue];
});
})
}
但是,当返回等效的 (afaik) jsonGraphEnvelope 时,无效的路径将从响应中删除:
{
route: 'foldersById[{keys:ids}].folders.createSubFolder',
call(callPath, args, refPaths, thisPaths) {
return createNewFolderSomehow(...)
.subscribe(folder => {
const newFolderPath = ['foldersById', folder.parentId, 'folders', folder.parentSubFolderCount -1];
return {
jsonGraph: R.assocPath(folderPath, $ref(['foldersById', folder.id]), {})
paths: [newFolderPath],
invalidated: [['folderList', 'length']]
};
});
})
}
我是否误解了 jsonGraphEnvelope 的工作原理(假设它是一种等同于 PathValues 数组的速记格式)?或者这可能是一个错误?
【问题讨论】:
标签: falcor falcor-router