|
@@ -138,7 +138,7 @@ export function findRootNode(tree, targetId, idKey = 'id') {
|
|
|
const path = [];
|
|
|
|
|
|
function traverse(node) {
|
|
|
- if (node[idKey] === targetId) return true;
|
|
|
+ if (node[idKey] == targetId) return true;
|
|
|
if (node.children) {
|
|
|
for (const child of node.children) {
|
|
|
if (traverse(child)) {
|
|
@@ -161,7 +161,7 @@ export function findRootNode(tree, targetId, idKey = 'id') {
|
|
|
|
|
|
export function findTreeNode(tree, targetId, childrenKey = 'children', idKey = 'id') {
|
|
|
for (const node of tree) {
|
|
|
- if (node[idKey] === targetId) return node;
|
|
|
+ if (node[idKey] == targetId) return node;
|
|
|
if (node[childrenKey]?.length) {
|
|
|
const found = findTreeNode(node[childrenKey], targetId, childrenKey, idKey);
|
|
|
if (found) return found;
|