vue-wait icon indicating copy to clipboard operation
vue-wait copied to clipboard

Consider v-show instead of v-if for v-wait component

Open anorborg opened this issue 7 years ago • 1 comments

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?

anorborg avatar Jul 04 '18 15:07 anorborg

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

avinograd0v avatar Aug 22 '18 12:08 avinograd0v