Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With-apollo: use reduxRootKey #980

Closed
sedubois opened this issue Feb 3, 2017 · 5 comments
Closed

With-apollo: use reduxRootKey #980

sedubois opened this issue Feb 3, 2017 · 5 comments

Comments

@sedubois
Copy link
Contributor

sedubois commented Feb 3, 2017

@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
    }
  };
@sedubois
Copy link
Contributor Author

sedubois commented Feb 3, 2017

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

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

@adamsoffer
Copy link
Contributor

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

@adamsoffer
Copy link
Contributor

@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.

@timneutkens
Copy link
Member

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

@sedubois
Copy link
Contributor Author

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

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants