Home / Function/ flattenNavItems() — supabase Function Reference

flattenNavItems() — supabase Function Reference

Architecture documentation for the flattenNavItems() function in get-next-page.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  aede3fb6_ba0d_36b2_0688_210bdb8ec683["flattenNavItems()"]
  9cb78d4b_2172_d6ab_70f8_56230d9462ce["getNextPage()"]
  9cb78d4b_2172_d6ab_70f8_56230d9462ce -->|calls| aede3fb6_ba0d_36b2_0688_210bdb8ec683
  style aede3fb6_ba0d_36b2_0688_210bdb8ec683 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/learn/lib/get-next-page.ts lines 9–23

function flattenNavItems(items: SidebarNavItem[]): SidebarNavItem[] {
  const result: SidebarNavItem[] = []

  for (const item of items) {
    if (item.items && item.items.length > 0) {
      // Recursively process children first
      result.push(...flattenNavItems(item.items))
    } else if (item.href) {
      // Only add items with href (leaf nodes)
      result.push(item)
    }
  }

  return result
}

Subdomains

Called By

Frequently Asked Questions

What does flattenNavItems() do?
flattenNavItems() is a function in the supabase codebase.
What calls flattenNavItems()?
flattenNavItems() is called by 1 function(s): getNextPage.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free