Home / Function/ regenerate() — astro Function Reference

regenerate() — astro Function Reference

Architecture documentation for the regenerate() function in runtime.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e8e68a78_d5fe_8e2a_3ab9_01e62691a6d5["regenerate()"]
  91969197_292d_3b15_21c6_0e876968e961["AstroSession"]
  e8e68a78_d5fe_8e2a_3ab9_01e62691a6d5 -->|defined in| 91969197_292d_3b15_21c6_0e876968e961
  style e8e68a78_d5fe_8e2a_3ab9_01e62691a6d5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/session/runtime.ts lines 231–254

	async regenerate() {
		let data = new Map();
		try {
			data = await this.#ensureData();
		} catch (err) {
			// Log the error but continue with empty data
			console.error('Failed to load session data during regeneration:', err);
		}

		// Store the old session ID for cleanup
		const oldSessionId = this.#sessionID;

		// Create new session
		this.#sessionID = crypto.randomUUID();
		this.#data = data;
		await this.#setCookie();

		// Clean up old session asynchronously
		if (oldSessionId && this.#storage) {
			this.#storage.removeItem(oldSessionId).catch((err) => {
				console.error('Failed to remove old session data:', err);
			});
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does regenerate() do?
regenerate() is a function in the astro codebase, defined in packages/astro/src/core/session/runtime.ts.
Where is regenerate() defined?
regenerate() is defined in packages/astro/src/core/session/runtime.ts at line 231.

Analyze Your Own Codebase

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

Try Supermodel Free