From bb76a8c6aa0ff5d76e962894f2710e70e5823086 Mon Sep 17 00:00:00 2001 From: Vlad Date: Wed, 31 Jan 2018 17:53:50 -0500 Subject: [PATCH] Cleans up DOM elements manually added by Select2 and not tracked by React --- assets/js/src/form/fields/selection.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/js/src/form/fields/selection.jsx b/assets/js/src/form/fields/selection.jsx index 09cd19d928..b7c9f1b9af 100644 --- a/assets/js/src/form/fields/selection.jsx +++ b/assets/js/src/form/fields/selection.jsx @@ -57,7 +57,7 @@ define([ }, destroySelect2: function () { if (this.isSelect2Initialized()) { - jQuery(`#${this.refs.select.id}`).select2('destroy'); + jQuery(`#${this.refs.select.id}`).select2('destroy').find('option:not(.default)').remove(); this.state.select2 = false; } }, @@ -206,7 +206,7 @@ define([ // For single selects only, in order for the placeholder value to appear, // we must have a blank