Commit fdaec9b7 authored by Tim Zallmann's avatar Tim Zallmann

Bundle Splitting for global search

parent a873622c
...@@ -31,7 +31,6 @@ import initLogoAnimation from './logo'; ...@@ -31,7 +31,6 @@ import initLogoAnimation from './logo';
import initFrequentItemDropdowns from './frequent_items'; import initFrequentItemDropdowns from './frequent_items';
import initBreadcrumbs from './breadcrumb'; import initBreadcrumbs from './breadcrumb';
import initUsagePingConsent from './usage_ping_consent'; import initUsagePingConsent from './usage_ping_consent';
import initSearchAutocomplete from './search_autocomplete';
import GlFieldErrors from './gl_field_errors'; import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers'; import initUserPopovers from './user_popovers';
import initBroadcastNotifications from './broadcast_notification'; import initBroadcastNotifications from './broadcast_notification';
...@@ -112,7 +111,18 @@ function deferredInitialisation() { ...@@ -112,7 +111,18 @@ function deferredInitialisation() {
initPersistentUserCallouts(); initPersistentUserCallouts();
initDefaultTrackers(); initDefaultTrackers();
if (document.querySelector('.search')) initSearchAutocomplete(); document.querySelector('#search').addEventListener(
'focus',
() => {
import(/* webpackChunkName: 'globalSearch' */ './search_autocomplete')
.then(({ default: initSearchAutocomplete }) => {
const searchDropdown = initSearchAutocomplete();
searchDropdown.onSearchInputFocus();
})
.catch(() => {});
},
{ once: true },
);
addSelectOnFocusBehaviour('.js-select-on-focus'); addSelectOnFocusBehaviour('.js-select-on-focus');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment