relay-compile - 使用共享模块的__generated__中继查询

时间:2017-06-16 15:55:35

标签: relayjs

我们有一个后端ruby API / graphql引擎,以及在不同应用程序(服务器端和客户端端)中重用的共享UI模块。每个客户端应用程序都会自定义使用并扩展ui模块。

在以下情况中,我们的dummy客户端应用程序(用于测试引擎)使用ui库,该库具有大部分UI小部件,因此中继代码(来自dummy/src/routes.js }):

// @flow
import React from 'react'
import Route, {makeRouteConfig} from 'found'
import AppFrame from '@alienfast/ui/App/AppFrame'
import {graphql} from 'react-relay'

export default makeRouteConfig (
  <Route
    component={AppFrame}
    query={graphql`
      query routes_DummyApp_Query {
        current_user {
          ...AppFrame_currentUser
        }
      }`
    }
  />
)

错误:

Command failed `relay-compiler --src ./src --schema ./schema.json`: 
Invariant Violation: RelayApplyFragmentArgumentTransform: expected `AppFrame_currentUser` to be a fragment, got `undefined`.
    at invariant (/Users/kross/projects/af/spec/dummy/ui/node_modules/fbjs/lib/invariant.js:44:15)
    at transformFragmentSpread (/Users/kross/projects/af/spec/dummy/ui/node_modules/relay-compiler/bin/relay-compiler:4874:26)
    at /Users/kross/projects/af/spec/dummy/ui/node_modules/relay-compiler/bin/relay-compiler:4936:24
    at Array.forEach (native)
    at transformSelections (/Users/kross/projects/af/spec/dummy/ui/node_modules/relay-compiler/bin/relay-compiler:4931:15)
    at transformField (/Users/kross/projects/af/spec/dummy/ui/node_modules/relay-compiler/bin/relay-compiler:4890:23)
    at /Users/kross/projects/af/spec/dummy/ui/node_modules/relay-compiler/bin/relay-compiler:4946:24
    at Array.forEach (native)
    at transformSelections (/Users/kross/projects/af/spec/dummy/ui/node_modules/relay-compiler/bin/relay-compiler:4931:15)
    at transformNode (/Users/kross/projects/af/spec/dummy/ui/node_modules/relay-compiler/bin/relay-compiler:4854:21)

可能相关:

0 个答案:

没有答案