From 61e233e849099602c8925a779e8cfa0a299b8a02 Mon Sep 17 00:00:00 2001 From: Martin Wendt Date: Sat, 29 Jun 2024 16:30:55 +0200 Subject: [PATCH] Ignore sporadic errors when expanding nested persisted nodes Update #1157 --- src/jquery.fancytree.persist.js | 10 +++++++++- src/jquery.fancytree.table.js | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/jquery.fancytree.persist.js b/src/jquery.fancytree.persist.js index b997ef04..c5a35117 100644 --- a/src/jquery.fancytree.persist.js +++ b/src/jquery.fancytree.persist.js @@ -130,7 +130,15 @@ } } else { tree.debug("_loadLazyNodes: " + node + " already loaded."); - node.setExpanded(true, expandOpts); + try { + node.setExpanded(true, expandOpts); + } catch (e) { + // #1157 + tree.warn( + "ext-persist: setExpanded failed for " + node, + e + ); + } } } else { missingKeyList.push(key); diff --git a/src/jquery.fancytree.table.js b/src/jquery.fancytree.table.js index 79b7bdd6..85903158 100644 --- a/src/jquery.fancytree.table.js +++ b/src/jquery.fancytree.table.js @@ -70,7 +70,7 @@ // use the lowest descendant of the preceeding sibling i = $.inArray(node, siblings); prev = siblings[i - 1]; - _assert(prev.tr); + _assert(prev.tr, "prev.tr missing: " + prev); // descend to lowest child (with a tag) while (prev.children && prev.children.length) { last = prev.children[prev.children.length - 1]; @@ -303,7 +303,8 @@ } else { _assert( !prevNode.parent, - "prev. row must have a tr, or be system root" + "prev. row must have a tr, or be system root: " + + prevNode ); // tree.tbody.appendChild(newRow); insertFirstChild(tree.tbody, newRow); // #675