diff options
Diffstat (limited to 'app/assets/javascripts/header_search/init.js')
-rw-r--r-- | app/assets/javascripts/header_search/init.js | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/app/assets/javascripts/header_search/init.js b/app/assets/javascripts/header_search/init.js index 4e9404007ec..64502d13ee2 100644 --- a/app/assets/javascripts/header_search/init.js +++ b/app/assets/javascripts/header_search/init.js @@ -2,29 +2,18 @@ import * as Sentry from '@sentry/browser'; import { HEADER_INIT_EVENTS } from './constants'; async function eventHandler(callback = () => {}) { - if (this.newHeaderSearchFeatureFlag) { - const { initHeaderSearchApp } = await import( - /* webpackChunkName: 'globalSearch' */ '~/header_search' - ).catch((error) => Sentry.captureException(error)); - - // In case the user started searching before we bootstrapped, - // let's pass the search along. - const initialSearchValue = this.searchInputBox.value; - initHeaderSearchApp(initialSearchValue); - - // this is new #search input element. We need to re-find it. - // And re-focus in it. - document.querySelector('#search').focus(); - callback(); - return; - } - - const { default: initSearchAutocomplete } = await import( - /* webpackChunkName: 'globalSearch' */ '../search_autocomplete' + const { initHeaderSearchApp } = await import( + /* webpackChunkName: 'globalSearch' */ '~/header_search' ).catch((error) => Sentry.captureException(error)); - const searchDropdown = initSearchAutocomplete(); - searchDropdown.onSearchInputFocus(); + // In case the user started searching before we bootstrapped, + // let's pass the search along. + const initialSearchValue = this.searchInputBox.value; + initHeaderSearchApp(initialSearchValue); + + // this is new #search input element. We need to re-find it. + // And re-focus in it. + document.querySelector('#search').focus(); callback(); } @@ -40,10 +29,7 @@ function initHeaderSearch() { HEADER_INIT_EVENTS.forEach((eventType) => { searchInputBox?.addEventListener( eventType, - eventHandler.bind( - { searchInputBox, newHeaderSearchFeatureFlag: gon?.features?.newHeaderSearch }, - cleanEventListeners, - ), + eventHandler.bind({ searchInputBox }, cleanEventListeners), { once: true }, ); }); |