Skip to content

Commit 3df6afb

Browse files
authored
Update mixin-filtering.js
1 parent 89e4fe0 commit 3df6afb

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/components/table/helpers/mixin-filtering.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,22 @@ export default {
122122
deep: true,
123123
handler(newCriteria, oldCriteria) {
124124
newCriteria = this.filterSanitize(newCriteria)
125-
oldCriteria = this.filterSanitize(oldCriteria)
126-
const timeout = this.computedFilterDebounce
127-
clearTimeout(this.$_filterTimer)
128-
this.$_filterTimer = null
129-
if (timeout && timeout > 0) {
130-
// If we have a debounce time, delay the update of `localFilter`
131-
this.$_filterTimer = setTimeout(() => {
125+
// We can't compare newCriteria and oldCriteria, as they
126+
// could point to the same object reference. But `localFilter`
127+
// will be a deep clone if the filter is an object.
128+
if (newCriteria !== this.localFilter) {
129+
const timeout = this.computedFilterDebounce
130+
clearTimeout(this.$_filterTimer)
131+
this.$_filterTimer = null
132+
if (timeout && timeout > 0) {
133+
// If we have a debounce time, delay the update of `localFilter`
134+
this.$_filterTimer = setTimeout(() => {
135+
this.localFilter = newCriteria
136+
}, timeout)
137+
} else {
138+
// Otherwise, immediately update `localFilter` with `newFilter` value
132139
this.localFilter = newCriteria
133-
}, timeout)
134-
} else {
135-
// Otherwise, immediately update `localFilter` with `newFilter` value
136-
this.localFilter = newCriteria
140+
}
137141
}
138142
}
139143
},

0 commit comments

Comments
 (0)