Home / Function/ validatePrerenderEndpointCollision() — astro Function Reference

validatePrerenderEndpointCollision() — astro Function Reference

Architecture documentation for the validatePrerenderEndpointCollision() function in params-and-props.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  30865ff5_73c1_c50a_9d4a_d5524145d666["validatePrerenderEndpointCollision()"]
  2b2f7826_50bd_a387_80cc_9a3b7ef783f7["params-and-props.ts"]
  30865ff5_73c1_c50a_9d4a_d5524145d666 -->|defined in| 2b2f7826_50bd_a387_80cc_9a3b7ef783f7
  8e1831c9_f4fe_7d1f_bf25_5930ce9a67ef["getProps()"]
  8e1831c9_f4fe_7d1f_bf25_5930ce9a67ef -->|calls| 30865ff5_73c1_c50a_9d4a_d5524145d666
  style 30865ff5_73c1_c50a_9d4a_d5524145d666 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/render/params-and-props.ts lines 117–139

function validatePrerenderEndpointCollision(
	route: RouteData,
	mod: ComponentInstance,
	params: Params,
) {
	if (route.type === 'endpoint' && mod.getStaticPaths) {
		const lastSegment = route.segments[route.segments.length - 1];
		const paramValues = Object.values(params);
		const lastParam = paramValues[paramValues.length - 1];
		// Check last segment is solely `[slug]` or `[...slug]` case (dynamic). Make sure it's not
		// `foo[slug].js` by checking segment length === 1. Also check here if that param is undefined.
		if (lastSegment.length === 1 && lastSegment[0].dynamic && lastParam === undefined) {
			throw new AstroError({
				...AstroErrorData.PrerenderDynamicEndpointPathCollide,
				message: AstroErrorData.PrerenderDynamicEndpointPathCollide.message(route.route),
				hint: AstroErrorData.PrerenderDynamicEndpointPathCollide.hint(route.component),
				location: {
					file: route.component,
				},
			});
		}
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does validatePrerenderEndpointCollision() do?
validatePrerenderEndpointCollision() is a function in the astro codebase, defined in packages/astro/src/core/render/params-and-props.ts.
Where is validatePrerenderEndpointCollision() defined?
validatePrerenderEndpointCollision() is defined in packages/astro/src/core/render/params-and-props.ts at line 117.
What calls validatePrerenderEndpointCollision()?
validatePrerenderEndpointCollision() is called by 1 function(s): getProps.

Analyze Your Own Codebase

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

Try Supermodel Free