title: Access rootState in mutations of different modules
body: <p>I have several <code>vuex</code> modules. For simplicity, I'll explain my problem with an example of what I am facing:</p>
  
  <p>I have 2 <code>vuex</code> modules <strong>firstModule.js</strong> and <strong>secondModule.js</strong></p>
  
  <p><strong>firstModule.js</strong> has a <code>myArray[ ]</code> in its state:</p>
  
  <pre><code>//firstModule
  
  const state = {
      myArray: [//has some items]
  } 
  </code></pre>
  
  <p>In <strong>secondModule.js</strong> I have an action which fetches some data asynchronously from an external API.</p>
  
  <p>This action commits a mutation which should search whether the fetched data is present in <strong>firstModule's</strong> <code>myArray[ ]</code></p>
  
  <ul>
  <li><p>if the fetched data is present in <strong>firstModule's</strong> <code>myArray[ ]</code>, then add it to <strong>secondModule's</strong> <code>newArray[ ]</code></p>
  
  <pre><code>const state = {
      newArray: []
  }
  
  const mutations = {
      addToNewArray: (state, payload) =&gt; {
          function findIyem(value){
              return value === payload.data;
          };    
  
          var item = payload.rootData.myArray.find(findItem);
          state.newArray.push(payload.data);
      }
  }
  
  const actions = {
      fetchData: ({commit, rootState}) =&gt; {
          // fetches some data from external API
          var fetched data = data // data is which I received from fetching
  
          commit('addToAnotherArray', {data: data, rootData: rootState.firstModule.myArray}
      }
  }
  </code></pre></li>
  </ul>
  
  <p><strong>But, here's the problem:</strong></p>
  
  <ul>
  <li><p>according to <a href="https://vuex.vuejs.org/en/modules.html" rel="noreferrer">docs</a> mutations in modules does not get access to <strong>rootState</strong>, only actions and getters get the access to <strong>rootState</strong></p></li>
  <li><p>without access to rootAtate in mutations, how can I perform the logic as I performed above?</p></li>
  <li><p>Do I have to access the <strong>rootState</strong> in the actions and pass it to the committed mutation as a payload as I have done above?</p></li>
  </ul>