apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.38k stars 2.66k forks source link

Issues implementing into React Boilerplate #898

Closed scf4 closed 7 years ago

scf4 commented 7 years ago

I followed the Apollo client docs and got this:

ApolloClient.js:163 Uncaught Error: Existing store does not use apolloReducer. Please make sure the store is properly configured and "reduxRootSelector" is correctly specified.(…)

Full diff here: https://github.com/scf4/react-boilerplate-graphql-test/commit/726e8c247c3bdb595882c91caa170b7dbdf29a8c

stubailo commented 7 years ago

That's surprising - what does the redux dev tools say about the initial store state?

Here's where the error is thrown: https://github.com/apollostack/apollo-client/blob/992a13deb82b43a82e7392aae21ef349a2b98a5d/src/ApolloClient.ts#L421

scf4 commented 7 years ago

I guess there's no store it can connect to. I must be missing something very simple, surely?

I'm heading to bed but will take a look tomorrow. Thanks!

stubailo commented 7 years ago

Oh, for redux dev tools to work you have to do something like this: https://github.com/zalmoxisus/redux-devtools-extension#12-advanced-store-setup

Kinda surprised the react boilerplate doesn't do it by default.

stubailo commented 7 years ago

Weird, looks like they do have it: https://github.com/mxstbr/react-boilerplate/blob/3fdad6a888b68e2c538dfcd52f4594fea7b9e4d4/app/store.js#L26

Perhaps the store is actually being initialized in the wrong place somehow?

sedubois commented 7 years ago

NB: this is the same issue as https://github.com/apollostack/react-apollo/issues/267

blasterpistol commented 7 years ago

https://github.com/mxstbr/react-boilerplate/issues/1041#issuecomment-260126495

scf4 commented 7 years ago

Solved it. I think the main issue was missing the client in this line in app.js:

const store = configureStore(initialState, apolloClient, browserHistory);

It was very simple to implement otherwise. Thanks to @denisNeustroev