medihack / redux-pouchdb-plus

Synchronize Redux store with PouchDB to have a persistent store.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RemoteDB live replication not working

brancooo1 opened this issue · comments

First of all thank you for the great work!

I've been using redux-pouchdb without any problems, but the reinit() was required so I switched to your library. The app is working, the changes are replicating to the server CouchDB. Changes comes to the client device, but the store is not updated by your library. Is this a known issue, or am I doing something wrong?

Thank you for advices!

export default function configureStore() {
  const localDB = new PouchDB('test');
  const remoteDB = new PouchDB('http://192.168.0.87:5984/test');
  const sync = PouchDB.sync(localDB, remoteDB, {live: true, retry: true})
     .on('change', function (info) {
          alert('change');
      })
  
  const applyMiddlewares = applyMiddleware(
    ReduxThunk
  );
  
  const createStoreWithMiddleware = compose(
    persistentStore({db: localDB}),
    applyMiddlewares
  )(createStore);
  
  const store = createStoreWithMiddleware(reducers, {});

  return store;
}

something tells me, it can be in reducers:

export default combineReducers({
  app: AppReducer,

  places: persistentReducer(PlaceReducer, {name: 'Place'}),
  categories: persistentReducer(CategoryReducer, {name: 'Category'}),
  items: persistentReducer(ItemReducer, {name: 'Item'}),
  customers: persistentReducer(CustomerReducer, {name: 'Customer'}),
  orders: persistentReducer(OrderReducer, {name: 'Order'}),
});

This warning is thrown 5 times (for every reducer)
screenshot_20180408-191533

Adding import 'babel-polyfill' to the library or to the index.js of the app solves the issue.

I think you should add the dependency, if you use the Symbol

@brancooo1 What Symbol do you mean exactly? When I search through the code I don't see any Symbol mentioned :-/