From 397e062a3c7de8896fb814e71bc7b48a6e71a83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 6 Apr 2019 20:33:03 -0400 Subject: [PATCH] fix: clear children before building tree prevents infinite loop on databases that have children array saved in database --- src/categories/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/categories/index.js b/src/categories/index.js index 76a16878d4..b201e8e204 100644 --- a/src/categories/index.js +++ b/src/categories/index.js @@ -395,6 +395,7 @@ Categories.getTree = function (categories, parentCid) { const parents = {}; cids.forEach((cid, index) => { if (cid) { + categories[index].children = undefined; cidToCategory[cid] = categories[index]; parents[cid] = _.clone(categories[index]); }