support-prerendering
Make interactive Blazor components work correctly with prerendering. USE FOR fixing duplicate data loads, UI flicker during prerender-to-interactive handoff, null references during prerender, persisting state across prerender, disabling prerendering, excluding pages from interactive routing, or detecting whether a component is currently prerendering. DO NOT USE for choosing which render mode to use (see create-blazor-project) or general component authoring (see author-component).
npx skills add dotnet/skills --skill support-prerendering --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Support Prerendering ## How Prerendering Works Prerendering is **on by default** for all interactive render modes. The server renders the component as static HTML and ships it to the browser immediately. Then the interactive runtime (Server/WebAssembly) loads and re-renders the component with full interactivity. This means: - `OnInitializedAsync` runs **twice** — once during prerender (static), once when the interactive runtime attaches. - `OnAfterRenderAsync` is **NOT** called during prerender — only after the interactive render. - Internal navigation between interactive pages (interactive routing) **skips prerendering** — prerendering only happens on full page loads. ## Step 1 — Read the Project's AGENTS.md Check the project's `AGENTS.md` for the **Interactivity Mode** and **Interactivity Scope**: | Mode | Prerendering applies? | |------|----------------------| | None (Static SSR) | No — there's no interactive handoff | | Server | Yes | | WebAssembly | Yes | | Auto | Yes | If the mode is `None`, this skill doesn't apply. ## Persist State Across Prerender → Interactive The most common prerendering problem: data loaded in `OnInitializedAsync` during prerender is thrown away and r
- How Prerendering Works
- Step 1 — Read the Project's AGENTS.md
- Persist State Across Prerender → Interactive
- Recommended: [PersistentState] attribute
- Multiple instances of the same component
- Advanced: PersistentComponentState service
- Disable Prerendering
- On a component definition
- On a component instance
- On the entire app
- Exclude Pages from Interactive Routing
- Detect Prerender vs Interactive at Runtime
- Client Services Fail During Prerender
- Don'ts
What does the support-prerendering skill do?
Make interactive Blazor components work correctly with prerendering. USE FOR fixing duplicate data loads, UI flicker during prerender-to-interactive handoff, null references during prerender, persisting state across prerender, disabling prerendering, excluding pages from interactive routing, or detecting whether a component is currently prerendering. DO NOT USE for choosing which render mode to use (see create-blazor-project) or general component authoring (see author-component).
How do I install it?
Run `npx skills add dotnet/skills --skill support-prerendering --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.