使用 jsonGraphEnvelope 使 Falcor jsonGraph 片段无效
Invalidate Falcor jsonGraph fragment using jsonGraphEnvelope
我试图在调用 CREATE 后通过 falcor-router 的响应使我的 jsonGraph 对象的一部分无效。返回 pathValues, similar to :
的列表时,我可以成功地这样做
{
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 数组的普通格式)?或者这可能是一个错误?
我试图在调用 CREATE 后通过 falcor-router 的响应使我的 jsonGraph 对象的一部分无效。返回 pathValues, similar to
{
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 数组的普通格式)?或者这可能是一个错误?