From 087f252b185fd7ec74d3b97157db84374acd90d5 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Wed, 1 May 2019 19:17:59 -0400 Subject: [PATCH] When removing a tag, remove it from _indexedKeys too (re: d026f2f / #5927) So that if the user decides to put it back, it will be sorted to the end and not inserted back at its original position in the middle --- modules/ui/raw_tag_editor.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/ui/raw_tag_editor.js b/modules/ui/raw_tag_editor.js index 3a3eae676..72c48745f 100644 --- a/modules/ui/raw_tag_editor.js +++ b/modules/ui/raw_tag_editor.js @@ -361,7 +361,12 @@ export function uiRawTagEditor(context) { if (d.key === '') { // removing the blank row _showBlank = false; content(wrap); + } else { + // remove from indexedKeys too, so that if the user puts it back, + // it will be sorted to the end and not back to its original position + _indexedKeys = _indexedKeys.filter(function(row) { return row.key !== d.key; }); + _pendingChange = _pendingChange || {}; _pendingChange[d.key] = undefined; scheduleChange();