From 0a5ae19905c6cdf74593a39e89ea89e94c205baa Mon Sep 17 00:00:00 2001 From: buttercat1791 Date: Tue, 8 Apr 2025 08:32:19 -0500 Subject: [PATCH] Remove a redundant lazy object instantiation --- src/lib/data_structures/publication_tree.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/data_structures/publication_tree.ts b/src/lib/data_structures/publication_tree.ts index e7e0e41..7f6c968 100644 --- a/src/lib/data_structures/publication_tree.ts +++ b/src/lib/data_structures/publication_tree.ts @@ -89,8 +89,9 @@ export class PublicationTree implements AsyncIterable { parent: parentNode, children: [], }; - parentNode.children!.push(new Lazy(() => Promise.resolve(node))); - this.#nodes.set(address, new Lazy(() => Promise.resolve(node))); + const lazyNode = new Lazy(() => Promise.resolve(node)); + parentNode.children!.push(lazyNode); + this.#nodes.set(address, lazyNode); this.#events.set(address, event); }