Next.js: With-apollo: use reduxRootKey

Created on 3 Feb 2017  路  5Comments  路  Source: vercel/next.js

@ads1018 the Apollo doc is a bit confusing (https://github.com/apollographql/react-docs/issues/123) but I think apollo shouldn't be hard-coded, instead should use something along the lines of:

  const initialState = {
    ...state,
    [client.reduxRootKey]: {
      data: client.store.getState()[client.reduxRootKey].data
    }
  };

All 5 comments

Or actually can be simplified to (https://github.com/apollographql/react-docs/pull/141/files#diff-e65085a675fc082c408f1708267d9b28R138):

  const initialState = {
    ...state,
    [client.reduxRootKey]: client.getInitialState(),
  };

@sedubois Good spot. Makes sense to me. I'll make a pull request.

@sedubois The Apollo Client release candidate deprecated reduxRootKey so I changed the key back to apollo in the example. There might be repercussions that I'm not aware of by doing this though. If you know of a better way let me know.

Lets close this and re-open if there are any issues with that @ads1018

Okay, thankfully Apollo should be stabilizing now 馃槃 I'll update my app when I find some time and report any findings

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

pie6k picture pie6k  路  3Comments

kenji4569 picture kenji4569  路  3Comments

jesselee34 picture jesselee34  路  3Comments

knipferrc picture knipferrc  路  3Comments