patch: the context doesn't hold anymore values (context.get() undefined) 😱

This commit is contained in:
xavcz 2017-02-07 12:50:08 +01:00
parent 867d14e3d0
commit 7f73f5a722

View file

@ -36,12 +36,15 @@ Meteor.startup(() => {
const options = {
historyHook(req, res, newHistory) {
req.history = newHistory;
const context = renderContext.get();
context.history = req.history;
// patch: renderContext doesn't get the values assigned from req
// const context = renderContext.get();
// context.history = req.history;
return req.history;
},
wrapperHook(req, res, appGenerator) {
const { apolloClient, store } = renderContext.get();
// patch: renderContext doesn't get the values assigned from req
// const { apolloClient, store } = renderContext.get();
const { apolloClient, store } = req;
const app = appGenerator();
return <ApolloProvider store={store} client={apolloClient}>{app}</ApolloProvider>;
},
@ -49,8 +52,10 @@ Meteor.startup(() => {
return Promise.await(getDataFromTree(app));
},
dehydrateHook(req, res) {
const context = renderContext.get();
return context.apolloClient.store.getState();
// patch: renderContext doesn't get the values assigned from req
// const context = renderContext.get();
// return context.apolloClient.store.getState();
return req.apolloClient.store.getState();
},
postRender(req, res) {
// req.css = styleSheet.sheet ? styleSheet.rules().map(rule => rule.cssText).join('\n') : '';