FIX: Don't bind events in `defaultState`
This commit is contained in:
parent
afe6f46b03
commit
be1cce503c
|
@ -62,6 +62,8 @@ const SiteHeaderComponent = MountWidget.extend(Docking, {
|
|||
|
||||
this.dispatch('notifications:changed', 'user-notifications');
|
||||
this.dispatch('header:keyboard-trigger', 'header');
|
||||
this.dispatch('header:keyboard-trigger', 'header');
|
||||
this.dispatch('search-autocomplete:after-complete', 'search-term');
|
||||
|
||||
this.appEvents.on('dom:clean', () => {
|
||||
// For performance, only trigger a re-render if any menu panels are visible
|
||||
|
|
|
@ -5,16 +5,16 @@ import { createWidget } from 'discourse/widgets/widget';
|
|||
createWidget('search-term', {
|
||||
tagName: 'input',
|
||||
buildId: () => 'search-term',
|
||||
buildKey: (attrs) => `search-term-${attrs.id}`,
|
||||
buildKey: () => `search-term`,
|
||||
|
||||
defaultState() {
|
||||
this.appEvents.on("search-autocomplete:after-complete", () => {
|
||||
this.state.afterAutocomplete = true;
|
||||
});
|
||||
|
||||
return { afterAutocomplete: false };
|
||||
},
|
||||
|
||||
searchAutocompleteAfterComplete() {
|
||||
this.state.afterAutocomplete = true;
|
||||
},
|
||||
|
||||
buildAttributes(attrs) {
|
||||
return { type: 'text',
|
||||
value: attrs.value || '',
|
||||
|
|
Loading…
Reference in New Issue