Skip to content

Commit

Permalink
perf: adiciona debounce em sort no componente de sortable table
Browse files Browse the repository at this point in the history
  • Loading branch information
brenodouglas committed Feb 11, 2022
1 parent 640f466 commit 4b9b276
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/SortedTable/SortedTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<script>
import Tooltip from '@components/Tooltip/Tooltip';
import IconQuestion from '@img/icon/icon-question.svg';
import debounce from 'lodash/debounce';
export default {
name: 'SortedTable',
Expand Down Expand Up @@ -137,9 +138,13 @@ export default {
if (!sortable || !key) return;
this.activeItem = key;
this.$emit('sort', key);
this.emitSort();
},
emitSort: debounce(function sortDebounce() {
this.$emit('sort', this.activeItem);
}, 300),
isActiveAsc(key) {
return this.activeItem === key && this.orderBy.toLowerCase() === 'asc';
},
Expand Down

0 comments on commit 4b9b276

Please sign in to comment.