Skip to content

Commit

Permalink
Use searchState (#171)
Browse files Browse the repository at this point in the history
* npm audit fix

* Replace search with searchState
  • Loading branch information
imorland authored Apr 6, 2022
1 parent fbb9797 commit 134bf8b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions js/src/forum/search/RecipientSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export default class RecipientSearch extends Search {
}

view() {
if (typeof this.state.getValue() === 'undefined') {
this.state.setValue('');
if (typeof this.searchState.getValue() === 'undefined') {
this.searchState.setValue('');
}

const loading = this.state.getValue() && this.state.getValue().length >= 3;
const loading = this.searchState.getValue() && this.searchState.getValue().length >= 3;

if (!this.sources) {
this.sources = this.sourceItems().toArray();
Expand Down Expand Up @@ -94,16 +94,16 @@ export default class RecipientSearch extends Search {
<input
id={`byobu-addrecipient-search-input-${this.inputUuid}`}
className={classList('RecipientsInput', 'FormControl', {
open: !!this.state.getValue(),
focused: !!this.state.getValue(),
active: !!this.state.getValue(),
open: !!this.searchState.getValue(),
focused: !!this.searchState.getValue(),
active: !!this.searchState.getValue(),
loading: !!this.loadingSources,
})}
oncreate={(vnode) => vnode.dom.focus()}
type="search"
placeholder={extractText(app.translator.trans('fof-byobu.forum.input.search_recipients'))}
value={this.state.getValue()}
oninput={(e) => this.state.setValue(e.target.value)}
value={this.searchState.getValue()}
oninput={(e) => this.searchState.setValue(e.target.value)}
onfocus={() => (this.hasFocus = true)}
onblur={() => (this.hasFocus = false)}
/>
Expand All @@ -114,7 +114,7 @@ export default class RecipientSearch extends Search {
>
{!this.doSearch
? LoadingIndicator.component({ size: 'tiny', className: 'Button Button--icon Button--link' })
: this.sources.map((source) => source.view(this.state.getValue()))}
: this.sources.map((source) => source.view(this.searchState.getValue()))}
</ul>
</div>
</div>
Expand Down Expand Up @@ -163,7 +163,7 @@ export default class RecipientSearch extends Search {

this.attrs.selected().add(value, recipient);

this.state.clear();
this.searchState.clear();
}

/**
Expand Down

0 comments on commit 134bf8b

Please sign in to comment.