diff --git a/percy/render/recipe.py b/percy/render/recipe.py index 9e2a8fc..4cf9b78 100644 --- a/percy/render/recipe.py +++ b/percy/render/recipe.py @@ -774,14 +774,17 @@ def _patch(self, operation): match_lines[i] = m match_lines = dict(sorted(match_lines.items(), reverse=True)) - # remove elements and find insert position new_range = deepcopy(range) insert_index = 0 index_set = False - for i, m in match_lines.items(): - new_range.pop(i) - insert_index = i - index_set = True + # remove elements + if op == "remove": + for i, m in match_lines.items(): + new_range.pop(i) + insert_index = i + index_set = True + + # Find insert position range = new_range if not index_set: for i, e in reversed(list(enumerate(range))):