From 0df21e0d494e061a7a4d74c18809e65f88ffe02f Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Thu, 17 Oct 2024 14:40:10 -0400 Subject: [PATCH] Fix findNodeRefsById --- lib/components/Reftracker.bs | 30 +++++++++++++----------------- lib/components/Reftracker.xml | 1 + lib/source/reftrackerLib.bs | 18 ++++++++++++++---- test-app/components/MainScene.bs | 6 ++++-- 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/lib/components/Reftracker.bs b/lib/components/Reftracker.bs index b85fded..95ffda7 100644 --- a/lib/components/Reftracker.bs +++ b/lib/components/Reftracker.bs @@ -38,26 +38,22 @@ function discover(_ = invalid) end function) end function -interface GetNodesByIdOptions - id as string -end interface - '@public -function getNodesById(options as GetNodesByIdOptions) +function findNodeRefsById(options as reftracker.FindNodeRefsByIdOptions) id = options.id results = [] - ' for each node in m.allNodes - ' if node.id <> id - ' continue for - ' end if - ' reftrackerId = reftracker.internal.getReftrackerId(node) - ' 'build a list of keypaths for this node - ' results.push({ - ' id: id, - ' node: node, - ' keypaths: m.keypathsByNodeReftrackerId[reftrackerId], - ' }) - ' end for + for each node in m.allNodes + if node.id <> id + continue for + end if + reftrackerId = reftracker.internal.getReftrackerId(node) + 'build a list of keypaths for this node + results.push({ + id: id, + node: node, + keypaths: m.keypathsByNodeReftrackerId[reftrackerId], + }) + end for return results end function diff --git a/lib/components/Reftracker.xml b/lib/components/Reftracker.xml index fb02dde..fd7c228 100644 --- a/lib/components/Reftracker.xml +++ b/lib/components/Reftracker.xml @@ -2,6 +2,7 @@ +