Home / Function/ fetchPartialsContent() — supabase Function Reference

fetchPartialsContent() — supabase Function Reference

Architecture documentation for the fetchPartialsContent() function in Partial.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  e4dca78c_a009_9457_9893_c32a01231d09["fetchPartialsContent()"]
  e170640f_c973_07c3_1dca_4410298488e1["partialsRemark()"]
  e170640f_c973_07c3_1dca_4410298488e1 -->|calls| e4dca78c_a009_9457_9893_c32a01231d09
  070accdd_f25d_7bc5_e9b5_9ffd9a406977["toFilePath()"]
  e4dca78c_a009_9457_9893_c32a01231d09 -->|calls| 070accdd_f25d_7bc5_e9b5_9ffd9a406977
  fd8b0bf3_f6b1_8cf9_1a51_2735ab221d01["getVariables()"]
  e4dca78c_a009_9457_9893_c32a01231d09 -->|calls| fd8b0bf3_f6b1_8cf9_1a51_2735ab221d01
  790ab825_fd72_cafc_9ee2_d8f5b37c7cf2["getAttributeValue()"]
  e4dca78c_a009_9457_9893_c32a01231d09 -->|calls| 790ab825_fd72_cafc_9ee2_d8f5b37c7cf2
  style e4dca78c_a009_9457_9893_c32a01231d09 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/directives/Partial.ts lines 160–193

async function fetchPartialsContent(tree: Root) {
  // INVARIANT: These must be pushed to in the same order because the index is // used to keep track of the relationship.
  const partialNodes = [] as [
    Parent,
    MdxJsxFlowElement,
    undefined | Record<string, string>,
    string,
  ][]
  const pendingFetches = [] as Promise<string>[]

  visitParents(tree, 'mdxJsxFlowElement', (node: MdxJsxFlowElement, ancestors) => {
    if (node.name !== '$Partial') return

    const parent = ancestors[ancestors.length - 1]
    const filePath = toFilePath(node)
    const variables = getVariables(node)
    const fetchTask = readFile(filePath, 'utf-8')
    const partialPath = getAttributeValue(node, 'path') as string

    partialNodes.push([parent, node, variables, partialPath])
    pendingFetches.push(fetchTask)
  })

  const resolvedContent = await Promise.all(pendingFetches)

  const nodeContentMap = new Map<
    MdxJsxFlowElement,
    [Parent, string, undefined | Record<string, string>, string]
  >()
  partialNodes.forEach(([parent, node, variables, partialPath], index) => {
    nodeContentMap.set(node, [parent, resolvedContent[index], variables, partialPath])
  })
  return nodeContentMap
}

Subdomains

Called By

Frequently Asked Questions

What does fetchPartialsContent() do?
fetchPartialsContent() is a function in the supabase codebase.
What does fetchPartialsContent() call?
fetchPartialsContent() calls 3 function(s): getAttributeValue, getVariables, toFilePath.
What calls fetchPartialsContent()?
fetchPartialsContent() is called by 1 function(s): partialsRemark.

Analyze Your Own Codebase

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

Try Supermodel Free