summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/project_select_combo_button.js
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-01-29 10:35:53 +0100
committerTim Zallmann <tzallmann@gitlab.com>2019-01-29 12:48:39 +0100
commit40a04bc7e6a8d99e837938ff984e4bf4036dae3b (patch)
treea6d051a749314ccb9559b67dfaff9992fd0a4ae7 /app/assets/javascripts/project_select_combo_button.js
parent2bb0d089ad70bf633071fc79dda0cc745a1c02a3 (diff)
downloadgitlab-ce-40a04bc7e6a8d99e837938ff984e4bf4036dae3b.tar.gz
Wraps Select 2 Import into its own webpack bundle
Wraps all imports for select 2 to deferred imports, especially in the main.js we are actually checking if there is any select 2 element on the page or not.
Diffstat (limited to 'app/assets/javascripts/project_select_combo_button.js')
-rw-r--r--app/assets/javascripts/project_select_combo_button.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/assets/javascripts/project_select_combo_button.js b/app/assets/javascripts/project_select_combo_button.js
index 3dbac3ff942..d3b5f532dc1 100644
--- a/app/assets/javascripts/project_select_combo_button.js
+++ b/app/assets/javascripts/project_select_combo_button.js
@@ -44,9 +44,13 @@ export default class ProjectSelectComboButton {
// eslint-disable-next-line class-methods-use-this
openDropdown(event) {
- $(event.currentTarget)
- .siblings('.project-item-select')
- .select2('open');
+ import(/* webpackChunkName: 'select2' */ 'select2/select2')
+ .then(() => {
+ $(event.currentTarget)
+ .siblings('.project-item-select')
+ .select2('open');
+ })
+ .catch(() => {});
}
selectProject() {