Skip to content

Commit

Permalink
Use DeferredInput on OnlineModView
Browse files Browse the repository at this point in the history
While triggering the filtering function was debounced, using an inline
input still triggered update for the whole component when its value
changed.
  • Loading branch information
anttimaki committed Feb 1, 2024
1 parent f74fd67 commit 5f6fd87
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/views/OnlineModView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<div class="no-padding-left card-header-title">
<div class="input-group input-group--flex margin-right">
<label for="thunderstore-search-filter">Search</label>
<input
v-model="thunderstoreSearchFilter"
<DeferredInput
@changed="(value) => thunderstoreSearchFilter = value"
id="thunderstore-search-filter"
class="input"
type="text"
Expand Down Expand Up @@ -79,12 +79,13 @@ import ManifestV2 from '../../model/ManifestV2';
import ThunderstoreMod from '../../model/ThunderstoreMod';
import OnlineModListProvider from '../../providers/components/loaders/OnlineModListProvider';
import ArrayUtils from '../../utils/ArrayUtils';
import debounce from 'lodash.debounce';
import SearchUtils from '../../utils/SearchUtils';
import PaginationButtons from "../navigation/PaginationButtons.vue";
import { DeferredInput } from "../all";
@Component({
components: {
DeferredInput,
OnlineModList: OnlineModListProvider.provider,
PaginationButtons,
}
Expand Down Expand Up @@ -129,8 +130,6 @@ export default class OnlineModView extends Vue {
}
@Watch("thunderstoreSearchFilter")
onThunderstoreFilterUpdate = debounce(this.performThunderstoreFilterUpdate, 150);
performThunderstoreFilterUpdate() {
this.pageNumber = 1;
this.filterThunderstoreModList();
Expand Down

0 comments on commit 5f6fd87

Please sign in to comment.