# HG changeset patch # User Mads Kiilerich # Date 2019-04-30 19:05:16 # Node ID 6b7a0cd02857443f4e1b5307b80a6746db9fd77a # Parent fa2f02020cc8afab6bb11901bd89cd3d8fe2a5c3 files: avoid duplicated "Select changeset" select2 controls on file source pages (Issue #343) Sometimes, when reusing cached data, the DOM part of select2 activation would be reused, but not the actual activation. Repeated select2 activation would thus give duplicated DOM entries. Select2 doeesn't seem to have a good way to unload or redo, so instead just try to remove the old DOM parts. diff --git a/kallithea/templates/files/files.html b/kallithea/templates/files/files.html --- a/kallithea/templates/files/files.html +++ b/kallithea/templates/files/files.html @@ -163,6 +163,7 @@ var post_load_state = function(state) { // history select field var cache = {}; + $('#diff1').prev('.select2-container').remove(); // Hack to handle repeated JS initialization on reused DOM $("#diff1").select2({ placeholder: _TM['Select changeset'], dropdownAutoWidth: true,