import './index.css';
import * as storage from 'redux-storage'
import App from './components';
import React from 'react';
import ReactDOM from 'react-dom';
import createEngine from 'redux-storage-engine-indexed-db';
import filter from 'redux-storage-decorator-filter';
import rootReducer from './reducers/';
import thunk from 'redux-thunk';
import { ActionTypes } from './config/constants';
import { Provider } from 'react-redux';
import { applyMiddleware, createStore } from 'redux';

const reducer = storage.reducer(rootReducer);
const engine = filter(createEngine('tickets'), [
  ['tickets', 'nested'],
  ['tickets', 'flattened'],
]);

const store = createStore(
  reducer,
  window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
  applyMiddleware(
    thunk,
    storage.createMiddleware(engine, [], [ActionTypes.TICKETS_UPDATE]),
  ),
);

const load = storage.createLoader(engine);
load(store);

 ReactDOM.render(
   <Provider store={store}>
     <App />
   </Provider>,
  document.getElementById('root')
);

@@ -628,24 +628,156 @@
 ned'%5D,%0A%5D);%0A%0A
+// Actions that trigger an IndexedDB update%0Aconst engineActions = %5B%0A  ActionTypes.TICKETS_REMOVE,%0A  ActionTypes.TICKETS_UPDATE,%0A%5D;%0A%0A
 const store 
@@ -957,36 +957,21 @@
 %5B%5D, 
-%5BActionTypes.TICKETS_UPDATE%5D
+engineActions
 ),%0A 

Update IndexedDB on TICKETS_REMOVE