title: Can't access specific state property in Vuex store
body: <p>My store's state object has 3 properties: <code>user_id</code>, <code>favorites</code>, and <code>posted_states</code></p>
  <p>This is my state object:</p>
  <pre class="lang-js prettyprint-override"><code>state: {
          favorites: [],
          user_id: null,
          posted_states: []
    
        },
  </code></pre>
  <p>I have an action that queries my database, and sets the <code>user_id</code> property to the returned value.
  The problem is, in another action, when I try to access the <code>user_id</code> property, it always returns null. Something weird I've noticed is, if I try to log the actual <code>state</code> variable, it shows the 3 properties I mentioned, and the <code>user_id</code> property correctly shows the id, and is not null.</p>
  <p><a href="https://i.stack.imgur.com/WSB0a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WSB0a.png" alt="Output of console.log" /></a></p>
  <p><a href="https://i.stack.imgur.com/7S8nE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7S8nE.png" alt="Code for above screenshot" /></a></p>
  <p>As you can see, accessing the state directly always returns null. Even weirder, if I try to access <code>state.user_id</code> from a different action, it returns the correct <code>user_id</code> and is not null.</p>
  <p>This is the action where I get the <code>user_id</code>:</p>
  <pre class="lang-js prettyprint-override"><code>get_current_user_id ({commit, state, dispatch})
          {
            Nova.request().get('/nova-vendor/favorites-tool/get_current_user_id')
            .then((response) =&gt; {
                // handle success
                if (response.data) {
                  commit('set_user_id', response.data)
                }
    
            })
  </code></pre>
  <p>This is the mutation where I set the <code>user_id</code></p>
  <pre class="lang-js prettyprint-override"><code>set_user_id(state, payload) {
            state.user_id = payload
          },
  </code></pre>
  <p>I don't think the issue is with the mutation, or the action itself honestly. I have also tried skipping the mutation entirely and setting it directly, which did not work. I have tried using a getter instead of accessing it directly, and also tried separating my component into a parent-child where the parent dispatches the action to set the user_id and the child dispatches the action that needs the user_id, under the assumption that this would eliminate a race condition if it even exists (however, I don't believe this is a race condition either.)</p>