FE-Driver / vue-beauty

Beautiful UI components build with vue and ant design
https://fe-driver.github.io/vue-beauty
MIT License
2.11k stars 248 forks source link

BUG: Table setTimeout in rowSelectionChange is causing the access violation error #262

Open KrishnaPG opened 6 years ago

KrishnaPG commented 6 years ago

The setTimeout in the Table rowSelectionChange is causing error when the table data become empty https://github.com/FE-Driver/vue-beauty/blob/63edb069219925fff35194ab838271a597a4b8b1/vb/components/data-table/data-table.vue#L692

image

Scenario: In a table cell place a delete button. This delete button when clicked, removes the data of that row from the table data. Now, when the delete button is clicked, clickRow method is getting called, which in turn calling rowSelectionChange. The setTimeout inside it causing the rest of the code to get executed after the data become empty, thus making the this.current[index].vb_dt_checked invalid.

image

This happens in every browser. The problem is, between the time rowSelectionChange called first and the code inside setTimeout gets executed the currentData becomes changed / empty. Many rows may have been added or deleted in between.

In my opinion, the rowSelectionChange should get called only when the specific checkbox column is clicked or get executed immediately.