Repository: withastro/astro
File: packages/astro/src/core/render-context.ts (TypeScript)

Code before:
			styles,
			actionResult,
			serverIslandNameMap: manifest.serverIslandNameMap ?? new Map(),
			key: manifest.key,
			trailingSlash: manifest.trailingSlash,
			_metadata: {
				hasHydrationScript: false,
				rendererSpecificHydrationScripts: new Set(),
				hasRenderedHead: false,
				renderedScripts: new Set(),
				hasDirectives: new Set(),
				hasRenderedServerIslandRuntime: false,
				headInTree: false,
				extraHead: [],
				extraStyleHashes: [],
				extraScriptHashes: [],
				propagators: new Set(),
			},
			shouldInjectCspMetaTags: !!manifest.csp,
			cspAlgorithm: manifest.csp?.algorithm ?? 'SHA-256',
			// The following arrays must be cloned, otherwise they become mutable across routes.
			scriptHashes: !!manifest.csp?.scriptHashes ? [...manifest.csp.scriptHashes] : [],
			scriptResources: !!manifest.csp?.scriptResources ? [...manifest.csp.scriptResources] : [],
			styleHashes: !!manifest.csp?.styleHashes ? [...manifest.csp.styleHashes] : [],
			styleResources: !!manifest.csp?.styleResources ? [...manifest.csp.styleResources] : [],
			directives: !!manifest.csp?.directives ? [...manifest.csp.directives] : [],
		};

		return result;
	}

	#astroPagePartial?: Omit<AstroGlobal, 'props' | 'self' | 'slots'>;

	/**
	 * The Astro global is sourced in 3 different phases:
	 * - **Static**: `.generator` and `.glob` is printed by the compiler, instantiated once per process per astro file
	 * - **Page-level**: `.request`, `.cookies`, `.locals` etc. These remain the same for the duration of the request.
	 * - **Component-level**: `.props`, `.slots`, and `.self` are unique to each _use_ of each component.
	 *
	 * The page level partial is used as the prototype of the user-visible `Astro` global object, which is instantiated once per use of a component.
	 */
	createAstro(
		result: SSRResult,
		astroStaticPartial: AstroGlobalPartial,
		props: Record<string, any>,
		slotValues: Record<string, any> | null,
		apiContext: ActionAPIContext,
	): AstroGlobal {
		let astroPagePartial;
		// During rewriting, we must recompute the Astro global, because we need to purge the previous params/props/etc.
		if (this.isRewriting) {

Review comment (suggestion):
```suggestion
			scriptHashes: manifest.csp?.scriptHashes ? [...manifest.csp.scriptHashes] : [],
			scriptResources: manifest.csp?.scriptResources ? [...manifest.csp.scriptResources] : [],
			styleHashes: manifest.csp?.styleHashes ? [...manifest.csp.styleHashes] : [],
			styleResources: manifest.csp?.styleResources ? [...manifest.csp.styleResources] : [],
			directives: manifest.csp?.directives ? [...manifest.csp.directives] : [],
```
This is a conditional so no need to coerce here

Code after:
			styles,
			actionResult,
			serverIslandNameMap: manifest.serverIslandNameMap ?? new Map(),
			key: manifest.key,
			trailingSlash: manifest.trailingSlash,
			_metadata: {
				hasHydrationScript: false,
				rendererSpecificHydrationScripts: new Set(),
				hasRenderedHead: false,
				renderedScripts: new Set(),
				hasDirectives: new Set(),
				hasRenderedServerIslandRuntime: false,
				headInTree: false,
				extraHead: [],
				extraStyleHashes: [],
				extraScriptHashes: [],
				propagators: new Set(),
			},
			shouldInjectCspMetaTags: !!manifest.csp,
			cspAlgorithm: manifest.csp?.algorithm ?? 'SHA-256',
			// The following arrays must be cloned, otherwise they become mutable across routes.
			scriptHashes: manifest.csp?.scriptHashes ? [...manifest.csp.scriptHashes] : [],
			scriptResources: manifest.csp?.scriptResources ? [...manifest.csp.scriptResources] : [],
			styleHashes: manifest.csp?.styleHashes ? [...manifest.csp.styleHashes] : [],
			styleResources: manifest.csp?.styleResources ? [...manifest.csp.styleResources] : [],
			directives: manifest.csp?.directives ? [...manifest.csp.directives] : [],
		};

		return result;
	}

	#astroPagePartial?: Omit<AstroGlobal, 'props' | 'self' | 'slots'>;

	/**
	 * The Astro global is sourced in 3 different phases:
	 * - **Static**: `.generator` and `.glob` is printed by the compiler, instantiated once per process per astro file
	 * - **Page-level**: `.request`, `.cookies`, `.locals` etc. These remain the same for the duration of the request.
	 * - **Component-level**: `.props`, `.slots`, and `.self` are unique to each _use_ of each component.
	 *
	 * The page level partial is used as the prototype of the user-visible `Astro` global object, which is instantiated once per use of a component.
	 */
	createAstro(
		result: SSRResult,
		astroStaticPartial: AstroGlobalPartial,
		props: Record<string, any>,
		slotValues: Record<string, any> | null,
		apiContext: ActionAPIContext,
	): AstroGlobal {
		let astroPagePartial;
		// During rewriting, we must recompute the Astro global, because we need to purge the previous params/props/etc.
		if (this.isRewriting) {