From e3317f35cd5b1755c8879ebc61a71a4db4218e62 Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Fri, 7 Dec 2018 20:07:33 -0400 Subject: [PATCH 1/2] fix(table): Emit v-model update (input) event only when computedItems changes (closes #2231) Rather than updating the v-model on every render, emit only when the displayed row data changes. Closes #2231 --- src/components/table/table.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/table/table.js b/src/components/table/table.js index 5568e21d9d5..ae558354f3c 100644 --- a/src/components/table/table.js +++ b/src/components/table/table.js @@ -750,6 +750,10 @@ export default { this.$emit('update:busy', newVal) } }, + // Watch for changes on computedItems and update the v-model + computedItems(newVal, OldVal) { + this.$emit('input', newVal) + }, // Watch for changes to the filter criteria and filtered items vs localItems). // And set visual state and emit events as required filteredCheck ({ filteredItems, localItems, localFilter }) { @@ -1034,8 +1038,6 @@ export default { // Grab the current page of data (which may be past filtered items limit) items = items.slice((currentPage - 1) * perPage, currentPage * perPage) } - // update the v-model view - this.$emit('input', items) // Return the items to display in the table return items }, From 15cd46a8d42ba578e196246cb10b61e01709231f Mon Sep 17 00:00:00 2001 From: Troy Morehouse Date: Fri, 7 Dec 2018 20:10:24 -0400 Subject: [PATCH 2/2] lint --- src/components/table/table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/table/table.js b/src/components/table/table.js index ae558354f3c..0b8b21cec98 100644 --- a/src/components/table/table.js +++ b/src/components/table/table.js @@ -751,7 +751,7 @@ export default { } }, // Watch for changes on computedItems and update the v-model - computedItems(newVal, OldVal) { + computedItems (newVal, OldVal) { this.$emit('input', newVal) }, // Watch for changes to the filter criteria and filtered items vs localItems).