Commit b4ccf32f authored by Clement Ho's avatar Clement Ho

Merge branch 'winh-eslint-promise/no-nesting-groups_select.js' into 'master'

Remove nested Promise from groups select

See merge request gitlab-org/gitlab!17685
parents def26df0 5b7b49cc
...@@ -4,9 +4,7 @@ import Api from './api'; ...@@ -4,9 +4,7 @@ import Api from './api';
import { normalizeHeaders } from './lib/utils/common_utils'; import { normalizeHeaders } from './lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
export default function groupsSelect() { const groupsSelect = () => {
import(/* webpackChunkName: 'select2' */ 'select2/select2')
.then(() => {
// Needs to be accessible in rspec // Needs to be accessible in rspec
window.GROUP_SELECT_PER_PAGE = 20; window.GROUP_SELECT_PER_PAGE = 20;
$('.ajax-groups-select').each(function setAjaxGroupsSelect2() { $('.ajax-groups-select').each(function setAjaxGroupsSelect2() {
...@@ -94,6 +92,9 @@ export default function groupsSelect() { ...@@ -94,6 +92,9 @@ export default function groupsSelect() {
dropdown.style.height = `${Math.floor(dropdown.scrollHeight)}px`; dropdown.style.height = `${Math.floor(dropdown.scrollHeight)}px`;
}); });
}); });
}) };
export default () =>
import(/* webpackChunkName: 'select2' */ 'select2/select2')
.then(groupsSelect)
.catch(() => {}); .catch(() => {});
}
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