matiastucci/vue-input-tag

Remove tag button not reactive

xon52 opened this issue · 9 comments

xon52 commented

First of all, great work on this.
I have been struggling to get this to react to the remove call. It does remove items, and will update as soon as I try and enter a new item (or refresh); but immediately after pressing remove the list displayed includes the removed items.
My array is a computed value, which may be the issue; but as it's from a Vuex getter, I don't want to be storing it locally.

My code: http://imgur.com/a/SBvaM

xon52 commented

OK, I thought I fixed it with a recompile, but I didn't.
When I thought it was working it was because my array I gave to the tags property was empty, and so it appears it made its own new array which was no longer linked to the array I put it. At least that's all I can think of.
Again, it all works, but doesn't update immediately. It may be more of a Vue issue...

EvanZ commented

I can't get this component to work at all. Not sure what I'm doing wrong.

OneX commented

You can use https://vuejs.org/v2/api/#vm-forceUpdate to force re-render, but not sure is it best practice.

Not sure is it good to use prop value of tags for data manipulation. I think vue suggests using 'data' for reactive values.

OneX commented

I tested it and this is actually cause of your problem

I @OneX thanks for your feedback. You are right about the wrong usage of props (mutating them). We are working in a new approach (#27) using events regarding mutations and make it compliance with Vue.

OneX commented

@ianaya89 I created fork with solution already.

Nice, great work. I think is pretty similar to what we did. We are going to review it and merge as soon as possible.

Thanks for your contribution 🍻👌

Any idea when this will be resolved?

#33 should fix it. Thanks for reporting it!