static-html.ts — astro Source File
Architecture documentation for static-html.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2a7964ea_d3cc_e8b0_70ad_dba51558e0b3["static-html.ts"] 0fef379e_25c0_6f95_11fd_6d0f7db42b7e["preact"] 2a7964ea_d3cc_e8b0_70ad_dba51558e0b3 --> 0fef379e_25c0_6f95_11fd_6d0f7db42b7e style 2a7964ea_d3cc_e8b0_70ad_dba51558e0b3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { h } from 'preact';
type Props = {
value: string;
name?: string;
hydrate?: boolean;
};
/**
* Astro passes `children` as a string of HTML, so we need
* a wrapper `div` to render that content as VNodes.
*
* As a bonus, we can signal to Preact that this subtree is
* entirely static and will never change via `shouldComponentUpdate`.
*/
const StaticHtml = ({ value, name, hydrate = true }: Props) => {
if (!value) return null;
const tagName = hydrate ? 'astro-slot' : 'astro-static-slot';
return h(tagName, { name, dangerouslySetInnerHTML: { __html: value } });
};
/**
* This tells Preact to opt-out of re-rendering this subtree,
* In addition to being a performance optimization,
* this also allows other frameworks to attach to `children`.
*
* See https://preactjs.com/guide/v8/external-dom-mutations
*/
StaticHtml.shouldComponentUpdate = () => false;
export default StaticHtml;
Domain
Subdomains
Functions
Types
Dependencies
- preact
Source
Frequently Asked Questions
What does static-html.ts do?
static-html.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in static-html.ts?
static-html.ts defines 1 function(s): StaticHtml.
What does static-html.ts depend on?
static-html.ts imports 1 module(s): preact.
Where is static-html.ts in the architecture?
static-html.ts is located at packages/integrations/preact/src/static-html.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/integrations/preact/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free