title: Watch/Subscribe if certain action has occurred in store
body: <p>How do you watch or subscribe to an action occurring in a store?</p>
  <p>I tried adding a watch (see below) however this doesn't work.</p>
  <p><code>setShowModal</code> is the action I want to watch/subscribe to in my component)</p>
  <p>Component:</p>
  <pre><code>&lt;script lang=&quot;ts&quot;&gt;
  import { defineComponent } from 'vue'
  import { store } from '@/stores/store'
  
  export default defineComponent({
      data () {
          return {
              showModal: store().showModal
          }
      },
      watch: {
          showModal(oldValue, newValue) {
              if (newValue) {
                  this.getComments()
              }
          }
      },
  </code></pre>
  <p>Store:</p>
  <pre><code>state: () =&gt; {
      return {
        showModal: false
      }
  },
  actions: {
    setShowModal(val: boolean) {
      this.showModal = val
    }
  }
  </code></pre>
  <p>The only way I have gotten the watch to fire (only when value gets changed to false) is if I write my component like this:</p>
  <pre><code>&lt;script lang=&quot;ts&quot;&gt;
  import { defineComponent } from 'vue'
  import {store} from '@/stores/store'
  
  export default defineComponent({
      data () {
          return {
              store: store()
          }
      },
      watch: {
          'store.showModal': function(newValue) {
              if (newValue) {
                  this.getComments()
              }
          }
      },
  </code></pre>