瀏覽代碼

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++){