redux-pouchdb-plus icon indicating copy to clipboard operation
redux-pouchdb-plus copied to clipboard

RemoteDB live replication not working

Open brancooo1 opened this issue 6 years ago • 2 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

brancooo1 avatar Apr 08 '18 14:04 brancooo1

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 avatar Apr 16 '18 10:04 brancooo1

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

medihack avatar Jun 15 '18 13:06 medihack