import { KEYBINDING_UPDATE } from 'core/actions/types';
import { defaultCommands } from './defaults';

export default function keyboardConfigReducer(
  state = defaultCommands,
  action,
) {
  if (action.type !== KEYBINDING_UPDATE) {
    return state;
  }
  const { command, keyBinding } = action.payload;
  return Object.assign(
    {},
    state,
    { [command]: keyBinding },
  )
}

@@ -223,20 +223,43 @@
 G_UPDATE
+ %7C%7C !(command in state)
 ) %7B%0A
-
     retu
@@ -322,16 +322,97 @@
 ayload;%0A
+  const newCommand = Object.assign(%7B%7D, state%5Bcommand%5D, %7B command: keyBinding %7D);%0A
   return
@@ -467,24 +467,25 @@
 d%5D: 
-keyBinding
+newCommand
  %7D,%0A  )
+;
 %0A%7D%0A

Update keyboard reducer to handle new state schema