vue-wait
vue-wait copied to clipboard
Consider v-show instead of v-if for v-wait component
I noticed while I was uisng the v-wait component, my component that I was wrapping was being created twice. First on initial load, then again after my call to my API to load the data. Looking over the source and the vuejs docs I saw this:
https://vuejs.org/v2/guide/conditional.html#v-if-vs-v-show
Which states that:
"...child components inside the conditional block are properly destroyed and re-created during toggles"
I wonder if it would be better for v-wait to use v-show instead? Or add an option?
I think more correct way is using v-if when v-wait first mounts, and then using v-show for future updates
Another way is to add option for v-wait (something like v-once) to trigger conditional render only once for waiter with specific name