perf: Optimize array traversal for empty memory-graph documents (#770)

This commit is contained in:
Vedant Mahajan 2026-03-08 09:04:25 +05:30 committed by GitHub
parent d0d90e9359
commit 9f7f415dd5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -446,7 +446,7 @@ export const MemoryGraph = ({
/>
{!isLoading &&
nodes.filter((n) => n.type === "document").length === 0 &&
!nodes.some((n) => n.type === "document") &&
children}
<div

View file

@ -741,7 +741,7 @@ export const MemoryGraph = ({
{/* Show welcome screen when no memories exist */}
{!isLoading &&
(!data || nodes.filter((n) => n.type === "document").length === 0) && (
(!data || !nodes.some((n) => n.type === "document")) && (
<>{children}</>
)}

View file

@ -410,7 +410,7 @@ export const MemoryGraph = ({
{/* Show welcome screen when no memories exist */}
{!isLoading &&
(!data || nodes.filter((n) => n.type === "document").length === 0) && (
(!data || !nodes.some((n) => n.type === "document")) && (
<>{children}</>
)}