import undoable from 'redux-undo-immutable';
import { fromJS } from 'immutable';
import { findPathByNodeId } from '../utils/vertTreeUtils';

const defaultState = fromJS([
  {
    value: undefined,
    children: [],
    _id: 1000
  }
]);

const verticalTreeData = (
  state = defaultState,
  action
) => {
  let path = findPathByNodeId(action.nodeId, state);
  switch (action.type) {
    case 'UPDATE_VERT_STRUCTURE':
      return action.newState;
    case 'HIGHLIGHT_NODE':
      path.push('highlighted');
      return state.setIn(path, true);
    case 'UNHIGHLIGHT_NODE':
      path.push('highlighted');
      return state.setIn(path, false);
    case 'RESET_TO_DEFAULT':
      return defaultState;
    default:
      return state;
  }
};

const undoableVerticalTreeData = undoable(
  verticalTreeData,
  { limit: 20 }
);

export default {
  verticalTreeData: undoableVerticalTreeData,
  testableVerticalTreeData: verticalTreeData
};

import undoable from 'redux-undo-immutable';
import { fromJS } from 'immutable';
import { findPathByNodeId } from '../utils/vertTreeUtils';

const verticalTreeData = (
  state = fromJS([{ value: 1, children: [{ value: 2, children: [], _id: 2000 }], _id: 1000 }]),
  action
) => {
  let path = findPathByNodeId(action.nodeId, state);
  switch (action.type) {
    case 'UPDATE_VERT_STRUCTURE':
      return action.newState;
    case 'HIGHLIGHT_NODE':
      path.push('highlighted');
      return state.setIn(path, true);
    case 'UNHIGHLIGHT_NODE':
      path.push('highlighted');
      return state.setIn(path, false);
    default:
      return state;
  }
};

const undoableVerticalTreeData = undoable(verticalTreeData, {
  limit: 12
});

export default {
  verticalTreeData: undoableVerticalTreeData,
  testableVerticalTreeData: verticalTreeData
};

--- 
+++ 
@@ -2,16 +2,8 @@
 import { fromJS } from 'immutable';
 import { findPathByNodeId } from '../utils/vertTreeUtils';
 
-const defaultState = fromJS([
-  {
-    value: undefined,
-    children: [],
-    _id: 1000
-  }
-]);
-
 const verticalTreeData = (
-  state = defaultState,
+  state = fromJS([{ value: 1, children: [{ value: 2, children: [], _id: 2000 }], _id: 1000 }]),
   action
 ) => {
   let path = findPathByNodeId(action.nodeId, state);
@@ -24,17 +16,14 @@
     case 'UNHIGHLIGHT_NODE':
       path.push('highlighted');
       return state.setIn(path, false);
-    case 'RESET_TO_DEFAULT':
-      return defaultState;
     default:
       return state;
   }
 };
 
-const undoableVerticalTreeData = undoable(
-  verticalTreeData,
-  { limit: 20 }
-);
+const undoableVerticalTreeData = undoable(verticalTreeData, {
+  limit: 12
+});
 
 export default {
   verticalTreeData: undoableVerticalTreeData,
Use empty tree as default
