React-apollo: How to make the reducer works with ImmutableJs

Created on 22 Aug 2016  路  4Comments  路  Source: apollographql/react-apollo

Not quite understand http://docs.apollostack.com/apollo-client/react.html#usage-with-immutable
I follow the guideline but not works
const store = createStore(combineReducers({ counter }), initialState);
There is no reducer defined when create the store, how apollo client reducer works?
I have this error
Error: Existing store does not use apolloReducer for apollo

import { combineReducers } from 'redux-immutablejs';
import client from './client';

const reducer = combineReducers({
    apollo: client.reducer(),
  });
export default reducer;
question

Most helpful comment

There's actually a PR for that here: https://github.com/apollostack/apollo-client/pull/631

All 4 comments

@raymondsze currently ImmutableJs only works for a store outside of apollo-client. The docs need to be more clear but essentially, if you have an ImmutableJs redux store, you can seperate it and not have apollo-client use that store (it will create its own store)

closing this for now as its been more than two weeks without a response. Feel free to open again!

@jbaxleyiii why was this closed if there is no solution ... ? using a second store is just a workaround.

This could be an easy fix. All you need to do is to abstract the method used to get data from the state, e.g. such as this one:

https://github.com/apollostack/react-apollo/blob/4042b7e7366c51f05e185d8b298f3019f3adc178/src/graphql.tsx#L216

There's actually a PR for that here: https://github.com/apollostack/apollo-client/pull/631

Was this page helpful?
0 / 5 - 0 ratings