Преглед на файлове

Bug fix: new transaction sidebar would duplicate ingredients when closed and opened.

Lee Morgan преди 4 години
родител
ревизия
98c46f8549
променени са 1 файла, в които са добавени 7 реда и са изтрити 2 реда
  1. 7 2
      views/dashboardPage/js/sidebars/newTransaction.js

+ 7 - 2
views/dashboardPage/js/sidebars/newTransaction.js

@@ -5,8 +5,13 @@ let newTransaction = {
 
         let recipeList = document.getElementById("newTransAvailable");
         recipeList.children[0].onkeyup = ()=>{this.searchRecipes()};
-        while(recipeList.children.length > 0){
-            recipeList.removeChild(recipeList.firstChild);
+        while(recipeList.children.length > 1){
+            recipeList.removeChild(recipeList.lastChild);
+        }
+
+        let transAdded = document.getElementById("newTransactionRecipes");
+        while(transAdded.children.length > 0){
+            transAdded.removeChild(transAdded.firstChild);
         }
 
         for(let i = 0; i < merchant.recipes.length; i++){