Skip to content

Commit

Permalink
Use DeferredInput on LocalModList
Browse files Browse the repository at this point in the history
Since the regular input component was inlined within LocalModList and
used v-model, each keypress caused it's value to update, and thus
forced rerendering for the whole component, which is forbiddingly slow
if the profile contains lots of mods.

DeferredInput stays responsive while user is typing, and triggers
updating the parent component only when user has stopped typing.
  • Loading branch information
anttimaki committed Feb 1, 2024
1 parent 68e6969 commit f74fd67
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/views/LocalModList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@

<div class="input-group input-group--flex margin-right">
<label for="local-search" class="non-selectable">Search</label>
<input id="local-search" v-model='searchQuery' class="input margin-right" type="text" placeholder="Search for an installed mod"/>
<DeferredInput
@changed="(value) => searchQuery = value"
id="local-search"
class="input margin-right"
type="text"
placeholder="Search for an installed mod"
/>
</div>

<div class="input-group margin-right">
Expand Down Expand Up @@ -122,6 +128,7 @@ import AssociatedModsModal from './LocalModList/AssociatedModsModal.vue';
import DisableModModal from './LocalModList/DisableModModal.vue';
import UninstallModModal from './LocalModList/UninstallModModal.vue';
import LocalModCard from './LocalModList/LocalModCard.vue';
import { DeferredInput } from '../all';
@Component({
components: {
Expand All @@ -130,6 +137,7 @@ import LocalModCard from './LocalModList/LocalModCard.vue';
DisableModModal,
UninstallModModal,
LocalModCard,
DeferredInput,
}
})
export default class LocalModList extends Vue {
Expand Down

0 comments on commit f74fd67

Please sign in to comment.