Question: Is there any reason that matching an empty list should be done using a case/match instead of if/else, other than style? For example:

```
val a: List

def compute: Int = 
  if (a.isEmpty) 0
  else a.sum

```

versus

```
def compute: Int = 
  a match {
    case Nil => 0
    case _ => a.sum // This is bad. For sake of illustration only.
  }

```

Answer: 
Using `v-if`, re-renders components every time the `this.mode` changes. Vue stores them in virtual DOM, but re-renders them if you use `v-if`.

If you have access to code for these components, consider using `prop` for `v-show` and watching it, in optional combination with `emit`so you can communicate between parent and child components, and set flag if you need it in child and in parent component if child component loads animation initially, to avoid loading it all over again. 

This would be one of the child components: 

```
<template>
    <div v-show="mode === 'themode'">

    </div>
</template>
<script>

    export default {
        props: {
            mode: {
                type: Boolean,
                required: true,
                twoWay: true
            },
        },
        data()  {
            return {
                animationLoaded : false,
            }
        },
        mounted(){

        },
         watch: {
           'mode' : function(){
            if(this.mode === 'mode' && this.animationLoaded === false){
                //load animation and set flag to true, to avoid loading it again. 
                this.animationLoaded = true; 
                this.$root.$emit('component-name:animation-loaded');
            }
          }
        },

```

...

And putting child in parent component: 

```
  <child-component :mode.sync="mode"></child-component>

```
I had a similar problem, I only wanted something in my `mounted` to run on page load, but when I navigated away (using vue router) and back again, the `mounted` would run each time, re-running that code. Solution: I put a `window.addEventListener('load', () => {})` in the `created` function, which runs that code instead.

The `created` function runs early on in the vue bootstrapping process, whereas the `window.load` event is the last event in the page load queue. As vue runs as a single page app, the `window.load` event will only fire once, and only after all the javascript (including vue) has got itself up and running (in a sense). I can route around my environment back and forth knowing that the initial build scripts would only be run when the page is actually re-loaded.

I have a feeling there is a more vue-tiful way of doing this, or I am otherwise missing something that vue-terans would chastise me for, but at this point vue has slapped me on the wrist far too many times for me to bother trying anymore. Hacky workarounds it is!