diff --git a/src/components/column/FollwingColumn.tsx b/src/components/column/FollwingColumn.tsx index d23ba54..d26695a 100644 --- a/src/components/column/FollwingColumn.tsx +++ b/src/components/column/FollwingColumn.tsx @@ -48,6 +48,9 @@ const FollowingColumn: Component = (props) => { ], eoseLimit: 20, continuous: loadMore.continuous(), + onEOSE: () => { + console.log('home: eose'); + }, clientEventFilter: (event) => { if (props.column.contentFilter == null) return true; return applyContentFilter(props.column.contentFilter)(event.content); diff --git a/src/nostr/useSubscription.ts b/src/nostr/useSubscription.ts index 38b023c..5372f4a 100644 --- a/src/nostr/useSubscription.ts +++ b/src/nostr/useSubscription.ts @@ -138,12 +138,16 @@ const useSubscription = (propsProvider: () => UseSubscriptionProps | null) => { } }, oneose: () => { + // sometimes `oneose` called twice + if (eose()) return; + if (onEOSE != null) { onEOSE(); } setEose(true); updateEvents(); + storedEvents.splice(0, storedEvents.length); if (!continuous) { sub.close(); @@ -157,20 +161,15 @@ const useSubscription = (propsProvider: () => UseSubscriptionProps | null) => { ); // avoid updating an array too rapidly while this is fetching stored events - let updating = false; const intervalId = setInterval(() => { - if (updating) return; - updating = true; if (eose()) { clearInterval(intervalId); - updating = false; return; } if (pushed) { pushed = false; updateEvents(); } - updating = false; }, 100); onCleanup(() => {