export default function persistState(sessionId, deserializer = null) {
  if (!sessionId) {
    return next => (...args) => next(...args);
  }

  function deserializeState(fullState) {
    if (!fullState || typeof deserializer !== 'function') {
      return fullState;
    }
    return {
      ...fullState,
      committedState: deserializer(fullState.committedState),
      computedStates: fullState.computedStates.map((computedState) => {
        return {
          ...computedState,
          state: deserializer(computedState.state)
        };
      })
    };
  }

  return next => (reducer, initialState) => {
    const key = `redux-dev-session-${sessionId}`;

    let finalInitialState;
    try {
      finalInitialState = deserializeState(JSON.parse(localStorage.getItem(key))) || initialState;
      next(reducer, initialState);
    } catch (e) {
      console.warn('Could not read debug session from localStorage:', e);
      try {
        localStorage.removeItem(key);
      } finally {
        finalInitialState = undefined;
      }
    }

    const store = next(reducer, finalInitialState);

    return {
      ...store,
      dispatch(action) {
        store.dispatch(action);

        try {
          localStorage.setItem(key, JSON.stringify(store.getState()));
        } catch (e) {
          console.warn('Could not write debug session from localStorage:', e);
        }

        return action;
      }
    };
  };
}

@@ -41,17 +41,49 @@
 sionId, 
-d
+stateDeserializer = null, actionD
 eseriali
@@ -238,17 +238,22 @@
  typeof 
-d
+stateD
 eseriali
@@ -355,25 +355,30 @@
 ittedState: 
-d
+stateD
 eserializer(
@@ -538,17 +538,22 @@
  state: 
-d
+stateD
 eseriali
@@ -609,16 +609,315 @@
 %7D;%0A  %7D%0A%0A
+  function deserializeActions(fullState) %7B%0A    if (!fullState %7C%7C typeof actionDeserializer !== 'function') %7B%0A      return fullState;%0A    %7D%0A    return %7B%0A      ...fullState,%0A      stagedActions: fullState.stagedActions.map((action) =%3E %7B%0A        return actionDeserializer(action);%0A      %7D)%0A    %7D;%0A  %7D%0A%0A
   return
@@ -1068,16 +1068,35 @@
 State = 
+deserializeActions(
 deserial
@@ -1142,16 +1142,17 @@
 m(key)))
+)
  %7C%7C init

add actionDeserializer callback to persistState