From fb7e2539e6d150036cc9d1ea0c4cb7cfbadcccbc Mon Sep 17 00:00:00 2001 From: buttercat1791 Date: Sat, 10 May 2025 00:01:52 -0500 Subject: [PATCH] Fix the tree traversal algorithm The loader's `next()` method now correctly indicates when it has reached the root node in the tree. From this, the publication component can known when to stop loading and hide the "Load More" button. --- src/lib/components/Publication.svelte | 9 ------ src/lib/data_structures/publication_tree.ts | 32 +++++++-------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/lib/components/Publication.svelte b/src/lib/components/Publication.svelte index adc1489..d8651c5 100644 --- a/src/lib/components/Publication.svelte +++ b/src/lib/components/Publication.svelte @@ -43,11 +43,8 @@ for (let i = 0; i < count; i++) { const iterResult = await publicationTree.next(); const { done, value } = iterResult; - - console.debug('Iterator result:', iterResult, 'done type:', typeof done); if (done) { - console.debug('Done condition met, setting isDone to true'); isDone = true; break; } @@ -97,10 +94,6 @@ return () => observer?.unobserve(lastElementRef!); }); - $effect(() => { - console.debug('isDone changed to:', isDone); - }); - // #endregion // #region ToC @@ -191,7 +184,6 @@ - {#if showTocButton && !showToc} @@ -239,7 +231,6 @@ /> {/if} {/each} -
{#if isLoading}