Home / Function/ addNodeToTree() — supabase Function Reference

addNodeToTree() — supabase Function Reference

Architecture documentation for the addNodeToTree() function in ExplainVisualizer.parser.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  a7bd362f_7510_af20_72c2_e65f3cc2830a["addNodeToTree()"]
  ac30de94_dc70_4332_43a2_049c7d7d4364["parseExplainOutput()"]
  ac30de94_dc70_4332_43a2_049c7d7d4364 -->|calls| a7bd362f_7510_af20_72c2_e65f3cc2830a
  style a7bd362f_7510_af20_72c2_e65f3cc2830a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/studio/components/interfaces/ExplainVisualizer/ExplainVisualizer.parser.ts lines 200–218

function addNodeToTree(
  node: ExplainNode,
  indent: number,
  root: ExplainNode[],
  stack: { node: ExplainNode; indent: number }[]
) {
  // Remove nodes from stack that are at the same or deeper indentation
  while (stack.length > 0 && stack[stack.length - 1].indent >= indent) {
    stack.pop()
  }

  if (stack.length === 0) {
    root.push(node)
  } else {
    stack[stack.length - 1].node.children.push(node)
  }

  stack.push({ node, indent })
}

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free