2016-09-27 13 views
1

良い人よ、こんにちは!isomorphic-relay-router:コンポーネントにデータを渡すことができません

私はいくつかの問題を抱えています。何らかの理由で、データがサイドバーコンポーネントに渡されません。データは私の<script id="preloadedData">ノードで利用可能ですが、それは

client.js行くべきところに渡さなっていない:

match({ routes, history: browserHistory }, (error, redirectLocation, renderProps) => { 
    if (error) throw error; 
    IsomorphicRouter.prepareInitialRender(environment, renderProps).then((props) => { 
     ReactDOM.render(
     <Router {...props} />, 
     root 
     ); 
    }); 
}); 

routes.js

[{ 
    path: '/', 
    component: App, 
    indexRoute: { 
     getComponents: (nextState, cb) => { 
     Promise.all([ 
      System.import('./Home/Hero'), 
      System.import('./Home'), 
      System.import('../components/Sidebar') 
     ]) 
      .then(modules => cb(null, { 
      hero: modules[0].default, 
      content: modules[1].default, 
      sidebar: modules[2].default 
      })) 
      .catch((e) => { throw e; }); 
     }, 
     queries: { 
      sidebar: { 
       joke:() => Relay.QL`query Joke { randomJoke }`, 
       quote:() => Relay.QL`query Quote { randomQuote }` 
      } 
     } 
    } 
}]; 

をApp.js - 通常のステートレスコンポーネント(リレーラッパーなし)

<div className={s.root}> 
    {hero} 
    <main> 
    <Header /> 
    {content} 
    {sidebar} 
    </main> 
    <Footer /> 
</div> 

Sidebar.js

... 

Relay.createContainer(Sidebar, { 
fragments: { 
    joke:() => Relay.QL` 
    fragment on Joke { 
     text 
    } 
    `, 
    quote:() => Relay.QL` 
    fragment on Quote { 
     text, 
     author, 
     sourceUrl 
    } 
    ` 
} 
}); 

サイドバーの小道具:また、次のエラーが表示され

{"history":{},"location":{"pathname":"/","search":"","hash":"","state":null,"action":"POP","key":"aelohd","query":{},"$searchBase":{"search":"","searchBase":""}},"params":{},"route":{"queries":{"sidebar":{}}},"routeParams":{},"routes":[{"path":"/","indexRoute":{"queries":{"sidebar":{}}},"childRoutes":[{"path":"/register","queries":{"content":{}}},{"path":"/publications","queries":{"content":{}}}]},{"queries":{"sidebar":{}}}],"children":null,"relay":{"pendingVariables":null,"route":{"name":"_aggregated___route_1_sidebar_joke___route_1_sidebar_quote","queries":{},"params":{}},"variables":{}}} 

RelayContainer: Expected prop 'joke' to be supplied to 'Sidebar', but got 'undefined'. Pass an explicit 'null' if this is intentional.quoteについて同じ)

ノーを有します何が間違っているのか、アイデアあなたの助けが必要です、お願いします!

答えて

0

問題は、isomorphic-relay-routerの不正なリレークエリの使用とバグの組み合わせです。link to the issue

関連する問題