title: 'error during evaluation' for computed property
body: <p>I have an issue where a computed property only sometimes works. Sometimes it has the value/error <code>templateComponent:"(error during evaluation)"</code></p>
  
  <p>What could be causing this issue? If someone can point me in the correct direction I can investigate further but I dont know where to start.</p>
  
  <p>The problem computed property:</p>
  
  <pre><code>// Error in the below computed property
  templateComponent() {
    let template = 'default' // assign default template
  
    if (!_.isNull(this.wp.template) &amp;&amp; this.wp.template.length)
      template = this.wp.template.replace('.php','').toLowerCase()
  
    return template
  }
  </code></pre>
  
  <p>Page.vue</p>
  
  <pre><code>&lt;template&gt;
      &lt;div v-if="wp"&gt;
        &lt;component :is="templateComponent" v-bind:wp="wp"&gt;&lt;/component&gt;
      &lt;/div&gt;
      &lt;p v-else&gt;Loading...&lt;/p&gt;
  &lt;/template&gt;
  
  &lt;script type="text/javascript"&gt;
  
  import { mapGetters } from 'vuex'
  import * as Templates from './templates'
  
  // Map template components
  let templateCmps = {}
  _.each(Templates, cmp =&gt; {
      templateCmps[cmp.name] = cmp
  })
  
  export default {
  
    props: ["slug"],
  
    components: {
      ...templateCmps
  
      // Example of templateCmps is below
      // 'default': Templates.Default,
      // 'agency': Templates.Agency,
      // 'home': Templates.Home,
    },
  
    computed: {
      ...mapGetters(['pageBySlug']),
  
      wp() {
        return this.pageBySlug(this.slug);
      },
  
      // Error in the below computed property
      templateComponent() {
        let template = 'default' // assign default template
  
        if (!_.isNull(this.wp.template) &amp;&amp; this.wp.template.length)
          template = this.wp.template.replace('.php','').toLowerCase()
  
        return template
      }
    },
  
    created() {
      // Get page title, content, etc. via rest request
      this.$store.dispatch('getPageBySlug', { slug: this.slug })
    }
  }
  &lt;/script&gt;
  </code></pre>