简体   繁体   English

使用jsonGraphEnvelope使Falcor jsonGraph片段无效

[英]Invalidate Falcor jsonGraph fragment using jsonGraphEnvelope

I'm trying to invalidate a part of my jsonGraph object via the response from the falcor-router after making a CREATE call. 我试图在进行CREATE调用后,通过falcor-router的响应使jsonGraph对象的一部分无效。 I can successfully do so when returning a list of pathValues , similar to this earlier SE question : 当返回pathValues列表时,我可以成功完成此操作,类似于此先前的SE问题

{
  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];
      });
  })
}

However, when returning the equivalent (afaik) jsonGraphEnvelope , the invalidated path is dropped from the response: 但是,当返回等效的(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']]
        };
      });
  })
}

Am I misunderstanding how a jsonGraphEnvelope works (had assumed it was a longhand format equivalent to an array of PathValues)? 我是否误解了jsonGraphEnvelope的工作原理(假设它是与PathValues数组等效的长格式)? Or is this likely a bug? 还是这可能是一个错误?

Looks like a bug to me. 对我来说似乎是个虫子。

Invalidations don't seem to be handled in the part of the code responsible for merging partial JSONGraph envelopes returned from routes into the JSONGraph envelope response (see here ), while they are handled in the path-value merge (see here ). 在将路径返回的部分JSONGraph信封合并到JSONGraph信封响应(请参见此处 )中的代码部分中,似乎并没有处理无效,而在路径值合并(请参见此处 )中处理了无效部分。

I can't find any issue about this on GitHub so I invite you to open one. 我在GitHub上找不到任何与此相关的问题,因此我邀请您打开一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM