Home / Function/ next() — vue Function Reference

next() — vue Function Reference

Architecture documentation for the next() function in render-context.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  c25d0df8_742c_b09a_17fa_f3481184c969["next()"]
  dcfd08ce_7436_881d_bd01_8b4c09f7fb5c["RenderContext"]
  c25d0df8_742c_b09a_17fa_f3481184c969 -->|defined in| dcfd08ce_7436_881d_bd01_8b4c09f7fb5c
  3b5f9da3_66f1_f97c_0fd0_c444c70ce9d5["renderAsyncComponent()"]
  3b5f9da3_66f1_f97c_0fd0_c444c70ce9d5 -->|calls| c25d0df8_742c_b09a_17fa_f3481184c969
  style c25d0df8_742c_b09a_17fa_f3481184c969 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/render-context.ts lines 71–122

  next() {
    // eslint-disable-next-line
    while (true) {
      const lastState = this.renderStates[this.renderStates.length - 1]
      if (isUndef(lastState)) {
        return this.done()
      }
      /* eslint-disable no-case-declarations */
      switch (lastState.type) {
        case 'Element':
        case 'Fragment':
          const { children, total } = lastState
          const rendered = lastState.rendered++
          if (rendered < total) {
            return this.renderNode(children[rendered], false, this)
          } else {
            this.renderStates.pop()
            if (lastState.type === 'Element') {
              return this.write(lastState.endTag, this.next)
            }
          }
          break
        case 'Component':
          this.renderStates.pop()
          this.activeInstance = lastState.prevActive
          break
        case 'ComponentWithCache':
          this.renderStates.pop()
          const { buffer, bufferIndex, componentBuffer, key } = lastState
          const result = {
            html: buffer[bufferIndex],
            components: componentBuffer[bufferIndex]
          }
          this.cache.set(key, result)
          if (bufferIndex === 0) {
            // this is a top-level cached component,
            // exit caching mode.
            //@ts-expect-error
            this.write.caching = false
          } else {
            // parent component is also being cached,
            // merge self into parent's result
            buffer[bufferIndex - 1] += result.html
            const prev = componentBuffer[bufferIndex - 1]
            result.components.forEach(c => prev.add(c))
          }
          buffer.length = bufferIndex
          componentBuffer.length = bufferIndex
          break
      }
    }
  }

Subdomains

Frequently Asked Questions

What does next() do?
next() is a function in the vue codebase, defined in packages/server-renderer/src/render-context.ts.
Where is next() defined?
next() is defined in packages/server-renderer/src/render-context.ts at line 71.
What calls next()?
next() is called by 1 function(s): renderAsyncComponent.

Analyze Your Own Codebase

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

Try Supermodel Free