Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix duplicated content bug in ajax-select2

dominik-zeglen2f42ee3cedbd
diff --git a/saleor/static/dashboard/js/components/modal.js b/saleor/static/dashboard/js/components/modal.js
index 6b20726f9f..7c281e6726 100644
--- a/saleor/static/dashboard/js/components/modal.js
+++ b/saleor/static/dashboard/js/components/modal.js
@@ -17,7 +17,7 @@ $('body').on('click', '.modal-trigger-custom', (e) => {
url: target.dataset.href,
method: 'GET',
success: (response) => {
- let $modal = $(target.getAttribute('href'));
+ const $modal = $(target.getAttribute('href'));
$modal
.html(response)
.modal('open');
diff --git a/saleor/static/dashboard/js/components/selects.js b/saleor/static/dashboard/js/components/selects.js
index cd839ee51e..08b3a265c1 100644
--- a/saleor/static/dashboard/js/components/selects.js
+++ b/saleor/static/dashboard/js/components/selects.js
@@ -9,7 +9,7 @@ function initSelects() {
$('select:not(.browser-default):not(.enable-ajax-select2):not([multiple])').material_select();
$('select[multiple]:not(.browser-default):not(.enable-ajax-select2)').select2({width: '100%'});
- $('select.enable-ajax-select2').each((i, select) => {
+ $('select.enable-ajax-select2:not(.select2-enabled)').each((i, select) => {
const $select = $(select);
const initial = $select.data('initial');
@@ -30,6 +30,7 @@ function initSelects() {
width: '100%',
minimumInputLength: 2
});
+ $select.addClass('select2-enabled')
});
}