【问题标题】:Invalidate Falcor jsonGraph fragment using jsonGraphEnvelope使用 jsonGraphEnvelope 使 Falcor jsonGraph 片段无效
【发布时间】: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


    【解决方案1】:

    在我看来是个错误。

    在负责将从路由返回的部分 JSONGraph 信封合并到 JSONGraph 信封响应中的代码部分中似乎没有处理失效(请参阅here),而它们是在路径值合并中处理的(请参阅here)。

    我在GitHub 上找不到任何关于此的问题,所以我邀请您打开一个。

    【讨论】:

    • 已将 issue 发布到 github。感谢您链接到相关代码——可能会分叉并尝试在本地修补。
    猜你喜欢
    • 2019-02-27
    • 2016-10-18
    • 1970-01-01
    • 1970-01-01
    • 2014-10-19
    • 1970-01-01
    • 2015-12-24
    • 2015-12-08
    • 1970-01-01
    相关资源
    最近更新 更多