Home / Function/ init_render_context() — svelte Function Reference

init_render_context() — svelte Function Reference

Architecture documentation for the init_render_context() function in render-context.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  eda2c9d4_ed45_87f9_a50b_04caf82c0540["init_render_context()"]
  006232e6_7197_38b5_bd13_0b28c51c2ac8["render-context.js"]
  eda2c9d4_ed45_87f9_a50b_04caf82c0540 -->|defined in| 006232e6_7197_38b5_bd13_0b28c51c2ac8
  ec1e5dc3_f338_7d6e_42e9_7a43e9c5c274["render()"]
  ec1e5dc3_f338_7d6e_42e9_7a43e9c5c274 -->|calls| eda2c9d4_ed45_87f9_a50b_04caf82c0540
  style eda2c9d4_ed45_87f9_a50b_04caf82c0540 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/server/render-context.js lines 66–79

export function init_render_context() {
	// It's important the right side of this assignment can run a maximum of one time
	// otherwise it's possible for a very, very well-timed race condition to assign to `als`
	// at the beginning of a render, and then another render to assign to it again, which causes
	// the first render's second half to use a new instance of `als` which doesn't have its
	// context anymore.
	// @ts-ignore -- we don't include node types in the production build
	als_import ??= import('node:async_hooks')
		.then((hooks) => {
			als = new hooks.AsyncLocalStorage();
		})
		.then(noop, noop);
	return als_import;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does init_render_context() do?
init_render_context() is a function in the svelte codebase, defined in packages/svelte/src/internal/server/render-context.js.
Where is init_render_context() defined?
init_render_context() is defined in packages/svelte/src/internal/server/render-context.js at line 66.
What calls init_render_context()?
init_render_context() is called by 1 function(s): render.

Analyze Your Own Codebase

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

Try Supermodel Free