richardanaya / voir

A simple router for lit-html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

actions of mutation functions overwriting each other

didamaran opened this issue · comments

it seems that having different mutation handlers is just a way to group actions for easier code reading, as it is not possible to dispatch an action to a specific handler - am I right?

so in this scenario:

function someMutations(state,action){
    switch(action.type){
        case "increment":
          state.first_counter += 1
          return;
    }
  }

  function someOtherMutations(state,action){
    switch(action.type){
        case "increment":
          state.second_counter += 1
          return;
    }
  }


dispatch('increment') would always increment state.first_counter, and never state.second_counter

besides that, really great work!