[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-dotnet-support-prerendering":3,"mdc--y4vxst-key":37,"related-org-dotnet-support-prerendering":1566,"related-repo-dotnet-support-prerendering":1728},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":25,"repoUrl":26,"updatedAt":27,"license":28,"forks":29,"topics":30,"repo":32,"sourceUrl":35,"mdContent":36},"support-prerendering","configure Blazor component 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).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"dotnet",".NET (Microsoft)","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fdotnet.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":17,"slug":18,"type":15},".NET","net",{"name":20,"slug":21,"type":15},"Blazor","blazor",{"name":23,"slug":24,"type":15},"Frontend","frontend",4576,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills","2026-07-12T08:23:07.327316","MIT",332,[31],"agent-skills",{"repoUrl":26,"stars":25,"forks":29,"topics":33,"description":34},[31],"Repository for skills to assist AI coding agents with .NET and C#","https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills\u002Ftree\u002FHEAD\u002Fplugins\u002Fdotnet-blazor\u002Fskills\u002Fsupport-prerendering","---\nlicense: MIT\nname: support-prerendering\ndescription: 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).\n---\n\n# Support Prerendering\n\n## How Prerendering Works\n\nPrerendering 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\u002FWebAssembly) loads and re-renders the component with full interactivity.\n\nThis means:\n- `OnInitializedAsync` runs **twice** — once during prerender (static), once when the interactive runtime attaches.\n- `OnAfterRenderAsync` is **NOT** called during prerender — only after the interactive render.\n- Internal navigation between interactive pages (interactive routing) **skips prerendering** — prerendering only happens on full page loads.\n\n## Step 1 — Read the Project's AGENTS.md\n\nCheck the project's `AGENTS.md` for the **Interactivity Mode** and **Interactivity Scope**:\n\n| Mode | Prerendering applies? |\n|------|----------------------|\n| None (Static SSR) | No — there's no interactive handoff |\n| Server | Yes |\n| WebAssembly | Yes |\n| Auto | Yes |\n\nIf the mode is `None`, this skill doesn't apply.\n\n## Persist State Across Prerender → Interactive\n\nThe most common prerendering problem: data loaded in `OnInitializedAsync` during prerender is thrown away and re-fetched when the interactive runtime attaches. This causes flicker and duplicate API\u002FDB calls.\n\n### Recommended: `[PersistentState]` attribute\n\nAnnotate properties to automatically serialize during prerender and restore on interactive activation:\n\n```razor\n@page \"\u002Fforecasts\"\n@rendermode InteractiveServer\n\n\u003Ch1>Weather\u003C\u002Fh1>\n\n@if (Forecasts is null)\n{\n    \u003Cp>Loading...\u003C\u002Fp>\n}\nelse\n{\n    @foreach (var f in Forecasts)\n    {\n        \u003Cp>@f.Date: @f.TemperatureC°C\u003C\u002Fp>\n    }\n}\n\n@code {\n    [PersistentState]\n    public WeatherForecast[]? Forecasts { get; set; }\n\n    protected override async Task OnInitializedAsync()\n    {\n        Forecasts ??= await ForecastService.GetForecastsAsync();\n    }\n}\n```\n\nThe `??=` pattern is critical — it means \"only fetch if the property wasn't already restored from prerender state.\"\n\n### Multiple instances of the same component\n\nWhen the same component type appears multiple times, use `@key` to disambiguate state:\n\n```razor\n@foreach (var item in items)\n{\n    \u003CItemCard @key=\"item.Id\" \u002F>\n}\n```\n\n### Advanced: `PersistentComponentState` service\n\nFor complex scenarios (dynamic keys, custom serialization), use the imperative API:\n\n```csharp\n@inject PersistentComponentState ApplicationState\n\n@code {\n    private List\u003COrder>? orders;\n\n    protected override async Task OnInitializedAsync()\n    {\n        ApplicationState.RegisterOnPersisting(PersistOrders);\n\n        if (!ApplicationState.TryTakeFromJson\u003CList\u003COrder>>(\"orders\", out var restored))\n        {\n            orders = await OrderService.GetOrdersAsync();\n        }\n        else\n        {\n            orders = restored;\n        }\n    }\n\n    private Task PersistOrders()\n    {\n        ApplicationState.PersistAsJson(\"orders\", orders);\n        return Task.CompletedTask;\n    }\n}\n```\n\n## Disable Prerendering\n\nDisable prerendering when a component depends on browser APIs immediately or when the prerender+interactive double render causes problems you can't solve with `[PersistentState]`.\n\n### On a component definition\n\n```razor\n@rendermode @(new InteractiveServerRenderMode(prerender: false))\n```\n\nReplace `InteractiveServerRenderMode` with `InteractiveWebAssemblyRenderMode` or `InteractiveAutoRenderMode` as needed.\n\n### On a component instance\n\n```razor\n\u003CMyChart @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n```\n\n### On the entire app\n\nIn `App.razor`:\n\n```razor\n\u003CHeadOutlet @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n\u003CRoutes @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n```\n\nNote: A parent's prerendering setting overrides children. If `\u003CRoutes>` disables prerendering, individual pages cannot re-enable it.\n\n## Exclude Pages from Interactive Routing\n\nIn a globally interactive app, some pages may need `HttpContext` (cookies, request headers, response status codes). These pages must render via static SSR, not inside the interactive runtime.\n\nUse `[ExcludeFromInteractiveRouting]`:\n\n```razor\n@page \"\u002Fprivacy\"\n@attribute [ExcludeFromInteractiveRouting]\n\n\u003Ch1>Privacy Policy\u003C\u002Fh1>\n```\n\nThis forces a **full page reload** when navigating to this page, exiting interactive routing. The page renders as static SSR with full `HttpContext` access.\n\nIn `App.razor`, conditionally apply the render mode:\n\n```razor\n\u003C!DOCTYPE html>\n\u003Chtml>\n\u003Chead>\n    \u003CHeadOutlet @rendermode=\"RenderModeForPage\" \u002F>\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003CRoutes @rendermode=\"RenderModeForPage\" \u002F>\n    \u003Cscript src=\"_framework\u002Fblazor.web.js\">\u003C\u002Fscript>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n\n@code {\n    [CascadingParameter]\n    public HttpContext HttpContext { get; set; } = default!;\n\n    private IComponentRenderMode? RenderModeForPage =>\n        HttpContext.AcceptsInteractiveRouting() ? InteractiveServer : null;\n}\n```\n\nReplace `InteractiveServer` with the app's configured render mode.\n\n## Detect Prerender vs Interactive at Runtime\n\nUse `RendererInfo` to guard code that should only run interactively:\n\n```csharp\nprotected override async Task OnInitializedAsync()\n{\n    if (RendererInfo.IsInteractive)\n    {\n        \u002F\u002F Only runs during the interactive render, not during prerender\n        await StartSignalRConnection();\n    }\n}\n```\n\n`RendererInfo` properties:\n- `IsInteractive` — `false` during prerender, `true` after interactive runtime attaches\n- `Name` — `\"Static\"` during prerender, `\"Server\"` or `\"WebAssembly\"` when interactive\n\n## Client Services Fail During Prerender\n\nComponents in the `.Client` project prerender on the server. Services registered only in the client `Program.cs` (e.g., `IWebAssemblyHostEnvironment`) won't be available during prerender.\n\nFix by one of:\n1. **Register a matching service on the server** — both `Program.cs` files provide the service\n2. **Make the service optional** — use constructor injection with a nullable default: `public MyComponent(IMyService? svc = null)`\n3. **Create a service abstraction** — interface in `.Client`, implementations in both projects\n4. **Disable prerendering** for that component\n\n## Don'ts\n\n- Don't call JS interop in `OnInitializedAsync` — JS isn't available during prerender. Use `OnAfterRenderAsync(firstRender)`.\n- Don't assume `OnInitializedAsync` runs once — it runs twice with prerendering. Always use `[PersistentState]` or `??=` guards.\n- Don't use `HttpContext` in interactive components — it's only available during the static prerender, not during the interactive lifetime. Use `[ExcludeFromInteractiveRouting]` for pages that need it.\n- Don't disable prerendering as a first resort — it hurts perceived load time and SEO. Use `[PersistentState]` to preserve state instead.\n",{"data":38,"body":39},{"license":28,"name":4,"description":6},{"type":40,"children":41},"root",[42,50,57,71,76,130,136,163,241,254,260,272,287,292,532,545,551,564,601,615,620,816,822,834,840,854,883,889,903,909,921,944,957,963,976,988,1026,1045,1056,1203,1215,1221,1233,1300,1310,1372,1378,1407,1412,1476,1482,1560],{"type":43,"tag":44,"props":45,"children":46},"element","h1",{"id":4},[47],{"type":48,"value":49},"text","Support Prerendering",{"type":43,"tag":51,"props":52,"children":54},"h2",{"id":53},"how-prerendering-works",[55],{"type":48,"value":56},"How Prerendering Works",{"type":43,"tag":58,"props":59,"children":60},"p",{},[61,63,69],{"type":48,"value":62},"Prerendering is ",{"type":43,"tag":64,"props":65,"children":66},"strong",{},[67],{"type":48,"value":68},"on by default",{"type":48,"value":70}," 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\u002FWebAssembly) loads and re-renders the component with full interactivity.",{"type":43,"tag":58,"props":72,"children":73},{},[74],{"type":48,"value":75},"This means:",{"type":43,"tag":77,"props":78,"children":79},"ul",{},[80,100,118],{"type":43,"tag":81,"props":82,"children":83},"li",{},[84,91,93,98],{"type":43,"tag":85,"props":86,"children":88},"code",{"className":87},[],[89],{"type":48,"value":90},"OnInitializedAsync",{"type":48,"value":92}," runs ",{"type":43,"tag":64,"props":94,"children":95},{},[96],{"type":48,"value":97},"twice",{"type":48,"value":99}," — once during prerender (static), once when the interactive runtime attaches.",{"type":43,"tag":81,"props":101,"children":102},{},[103,109,111,116],{"type":43,"tag":85,"props":104,"children":106},{"className":105},[],[107],{"type":48,"value":108},"OnAfterRenderAsync",{"type":48,"value":110}," is ",{"type":43,"tag":64,"props":112,"children":113},{},[114],{"type":48,"value":115},"NOT",{"type":48,"value":117}," called during prerender — only after the interactive render.",{"type":43,"tag":81,"props":119,"children":120},{},[121,123,128],{"type":48,"value":122},"Internal navigation between interactive pages (interactive routing) ",{"type":43,"tag":64,"props":124,"children":125},{},[126],{"type":48,"value":127},"skips prerendering",{"type":48,"value":129}," — prerendering only happens on full page loads.",{"type":43,"tag":51,"props":131,"children":133},{"id":132},"step-1-read-the-projects-agentsmd",[134],{"type":48,"value":135},"Step 1 — Read the Project's AGENTS.md",{"type":43,"tag":58,"props":137,"children":138},{},[139,141,147,149,154,156,161],{"type":48,"value":140},"Check the project's ",{"type":43,"tag":85,"props":142,"children":144},{"className":143},[],[145],{"type":48,"value":146},"AGENTS.md",{"type":48,"value":148}," for the ",{"type":43,"tag":64,"props":150,"children":151},{},[152],{"type":48,"value":153},"Interactivity Mode",{"type":48,"value":155}," and ",{"type":43,"tag":64,"props":157,"children":158},{},[159],{"type":48,"value":160},"Interactivity Scope",{"type":48,"value":162},":",{"type":43,"tag":164,"props":165,"children":166},"table",{},[167,186],{"type":43,"tag":168,"props":169,"children":170},"thead",{},[171],{"type":43,"tag":172,"props":173,"children":174},"tr",{},[175,181],{"type":43,"tag":176,"props":177,"children":178},"th",{},[179],{"type":48,"value":180},"Mode",{"type":43,"tag":176,"props":182,"children":183},{},[184],{"type":48,"value":185},"Prerendering applies?",{"type":43,"tag":187,"props":188,"children":189},"tbody",{},[190,204,217,229],{"type":43,"tag":172,"props":191,"children":192},{},[193,199],{"type":43,"tag":194,"props":195,"children":196},"td",{},[197],{"type":48,"value":198},"None (Static SSR)",{"type":43,"tag":194,"props":200,"children":201},{},[202],{"type":48,"value":203},"No — there's no interactive handoff",{"type":43,"tag":172,"props":205,"children":206},{},[207,212],{"type":43,"tag":194,"props":208,"children":209},{},[210],{"type":48,"value":211},"Server",{"type":43,"tag":194,"props":213,"children":214},{},[215],{"type":48,"value":216},"Yes",{"type":43,"tag":172,"props":218,"children":219},{},[220,225],{"type":43,"tag":194,"props":221,"children":222},{},[223],{"type":48,"value":224},"WebAssembly",{"type":43,"tag":194,"props":226,"children":227},{},[228],{"type":48,"value":216},{"type":43,"tag":172,"props":230,"children":231},{},[232,237],{"type":43,"tag":194,"props":233,"children":234},{},[235],{"type":48,"value":236},"Auto",{"type":43,"tag":194,"props":238,"children":239},{},[240],{"type":48,"value":216},{"type":43,"tag":58,"props":242,"children":243},{},[244,246,252],{"type":48,"value":245},"If the mode is ",{"type":43,"tag":85,"props":247,"children":249},{"className":248},[],[250],{"type":48,"value":251},"None",{"type":48,"value":253},", this skill doesn't apply.",{"type":43,"tag":51,"props":255,"children":257},{"id":256},"persist-state-across-prerender-interactive",[258],{"type":48,"value":259},"Persist State Across Prerender → Interactive",{"type":43,"tag":58,"props":261,"children":262},{},[263,265,270],{"type":48,"value":264},"The most common prerendering problem: data loaded in ",{"type":43,"tag":85,"props":266,"children":268},{"className":267},[],[269],{"type":48,"value":90},{"type":48,"value":271}," during prerender is thrown away and re-fetched when the interactive runtime attaches. This causes flicker and duplicate API\u002FDB calls.",{"type":43,"tag":273,"props":274,"children":276},"h3",{"id":275},"recommended-persistentstate-attribute",[277,279,285],{"type":48,"value":278},"Recommended: ",{"type":43,"tag":85,"props":280,"children":282},{"className":281},[],[283],{"type":48,"value":284},"[PersistentState]",{"type":48,"value":286}," attribute",{"type":43,"tag":58,"props":288,"children":289},{},[290],{"type":48,"value":291},"Annotate properties to automatically serialize during prerender and restore on interactive activation:",{"type":43,"tag":293,"props":294,"children":299},"pre",{"className":295,"code":296,"language":297,"meta":298,"style":298},"language-razor shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","@page \"\u002Fforecasts\"\n@rendermode InteractiveServer\n\n\u003Ch1>Weather\u003C\u002Fh1>\n\n@if (Forecasts is null)\n{\n    \u003Cp>Loading...\u003C\u002Fp>\n}\nelse\n{\n    @foreach (var f in Forecasts)\n    {\n        \u003Cp>@f.Date: @f.TemperatureC°C\u003C\u002Fp>\n    }\n}\n\n@code {\n    [PersistentState]\n    public WeatherForecast[]? Forecasts { get; set; }\n\n    protected override async Task OnInitializedAsync()\n    {\n        Forecasts ??= await ForecastService.GetForecastsAsync();\n    }\n}\n","razor","",[300],{"type":43,"tag":85,"props":301,"children":302},{"__ignoreMap":298},[303,314,323,333,342,350,359,368,377,386,395,403,412,421,430,439,447,455,464,473,482,490,499,507,516,524],{"type":43,"tag":304,"props":305,"children":308},"span",{"class":306,"line":307},"line",1,[309],{"type":43,"tag":304,"props":310,"children":311},{},[312],{"type":48,"value":313},"@page \"\u002Fforecasts\"\n",{"type":43,"tag":304,"props":315,"children":317},{"class":306,"line":316},2,[318],{"type":43,"tag":304,"props":319,"children":320},{},[321],{"type":48,"value":322},"@rendermode InteractiveServer\n",{"type":43,"tag":304,"props":324,"children":326},{"class":306,"line":325},3,[327],{"type":43,"tag":304,"props":328,"children":330},{"emptyLinePlaceholder":329},true,[331],{"type":48,"value":332},"\n",{"type":43,"tag":304,"props":334,"children":336},{"class":306,"line":335},4,[337],{"type":43,"tag":304,"props":338,"children":339},{},[340],{"type":48,"value":341},"\u003Ch1>Weather\u003C\u002Fh1>\n",{"type":43,"tag":304,"props":343,"children":345},{"class":306,"line":344},5,[346],{"type":43,"tag":304,"props":347,"children":348},{"emptyLinePlaceholder":329},[349],{"type":48,"value":332},{"type":43,"tag":304,"props":351,"children":353},{"class":306,"line":352},6,[354],{"type":43,"tag":304,"props":355,"children":356},{},[357],{"type":48,"value":358},"@if (Forecasts is null)\n",{"type":43,"tag":304,"props":360,"children":362},{"class":306,"line":361},7,[363],{"type":43,"tag":304,"props":364,"children":365},{},[366],{"type":48,"value":367},"{\n",{"type":43,"tag":304,"props":369,"children":371},{"class":306,"line":370},8,[372],{"type":43,"tag":304,"props":373,"children":374},{},[375],{"type":48,"value":376},"    \u003Cp>Loading...\u003C\u002Fp>\n",{"type":43,"tag":304,"props":378,"children":380},{"class":306,"line":379},9,[381],{"type":43,"tag":304,"props":382,"children":383},{},[384],{"type":48,"value":385},"}\n",{"type":43,"tag":304,"props":387,"children":389},{"class":306,"line":388},10,[390],{"type":43,"tag":304,"props":391,"children":392},{},[393],{"type":48,"value":394},"else\n",{"type":43,"tag":304,"props":396,"children":398},{"class":306,"line":397},11,[399],{"type":43,"tag":304,"props":400,"children":401},{},[402],{"type":48,"value":367},{"type":43,"tag":304,"props":404,"children":406},{"class":306,"line":405},12,[407],{"type":43,"tag":304,"props":408,"children":409},{},[410],{"type":48,"value":411},"    @foreach (var f in Forecasts)\n",{"type":43,"tag":304,"props":413,"children":415},{"class":306,"line":414},13,[416],{"type":43,"tag":304,"props":417,"children":418},{},[419],{"type":48,"value":420},"    {\n",{"type":43,"tag":304,"props":422,"children":424},{"class":306,"line":423},14,[425],{"type":43,"tag":304,"props":426,"children":427},{},[428],{"type":48,"value":429},"        \u003Cp>@f.Date: @f.TemperatureC°C\u003C\u002Fp>\n",{"type":43,"tag":304,"props":431,"children":433},{"class":306,"line":432},15,[434],{"type":43,"tag":304,"props":435,"children":436},{},[437],{"type":48,"value":438},"    }\n",{"type":43,"tag":304,"props":440,"children":442},{"class":306,"line":441},16,[443],{"type":43,"tag":304,"props":444,"children":445},{},[446],{"type":48,"value":385},{"type":43,"tag":304,"props":448,"children":450},{"class":306,"line":449},17,[451],{"type":43,"tag":304,"props":452,"children":453},{"emptyLinePlaceholder":329},[454],{"type":48,"value":332},{"type":43,"tag":304,"props":456,"children":458},{"class":306,"line":457},18,[459],{"type":43,"tag":304,"props":460,"children":461},{},[462],{"type":48,"value":463},"@code {\n",{"type":43,"tag":304,"props":465,"children":467},{"class":306,"line":466},19,[468],{"type":43,"tag":304,"props":469,"children":470},{},[471],{"type":48,"value":472},"    [PersistentState]\n",{"type":43,"tag":304,"props":474,"children":476},{"class":306,"line":475},20,[477],{"type":43,"tag":304,"props":478,"children":479},{},[480],{"type":48,"value":481},"    public WeatherForecast[]? Forecasts { get; set; }\n",{"type":43,"tag":304,"props":483,"children":485},{"class":306,"line":484},21,[486],{"type":43,"tag":304,"props":487,"children":488},{"emptyLinePlaceholder":329},[489],{"type":48,"value":332},{"type":43,"tag":304,"props":491,"children":493},{"class":306,"line":492},22,[494],{"type":43,"tag":304,"props":495,"children":496},{},[497],{"type":48,"value":498},"    protected override async Task OnInitializedAsync()\n",{"type":43,"tag":304,"props":500,"children":502},{"class":306,"line":501},23,[503],{"type":43,"tag":304,"props":504,"children":505},{},[506],{"type":48,"value":420},{"type":43,"tag":304,"props":508,"children":510},{"class":306,"line":509},24,[511],{"type":43,"tag":304,"props":512,"children":513},{},[514],{"type":48,"value":515},"        Forecasts ??= await ForecastService.GetForecastsAsync();\n",{"type":43,"tag":304,"props":517,"children":519},{"class":306,"line":518},25,[520],{"type":43,"tag":304,"props":521,"children":522},{},[523],{"type":48,"value":438},{"type":43,"tag":304,"props":525,"children":527},{"class":306,"line":526},26,[528],{"type":43,"tag":304,"props":529,"children":530},{},[531],{"type":48,"value":385},{"type":43,"tag":58,"props":533,"children":534},{},[535,537,543],{"type":48,"value":536},"The ",{"type":43,"tag":85,"props":538,"children":540},{"className":539},[],[541],{"type":48,"value":542},"??=",{"type":48,"value":544}," pattern is critical — it means \"only fetch if the property wasn't already restored from prerender state.\"",{"type":43,"tag":273,"props":546,"children":548},{"id":547},"multiple-instances-of-the-same-component",[549],{"type":48,"value":550},"Multiple instances of the same component",{"type":43,"tag":58,"props":552,"children":553},{},[554,556,562],{"type":48,"value":555},"When the same component type appears multiple times, use ",{"type":43,"tag":85,"props":557,"children":559},{"className":558},[],[560],{"type":48,"value":561},"@key",{"type":48,"value":563}," to disambiguate state:",{"type":43,"tag":293,"props":565,"children":567},{"className":295,"code":566,"language":297,"meta":298,"style":298},"@foreach (var item in items)\n{\n    \u003CItemCard @key=\"item.Id\" \u002F>\n}\n",[568],{"type":43,"tag":85,"props":569,"children":570},{"__ignoreMap":298},[571,579,586,594],{"type":43,"tag":304,"props":572,"children":573},{"class":306,"line":307},[574],{"type":43,"tag":304,"props":575,"children":576},{},[577],{"type":48,"value":578},"@foreach (var item in items)\n",{"type":43,"tag":304,"props":580,"children":581},{"class":306,"line":316},[582],{"type":43,"tag":304,"props":583,"children":584},{},[585],{"type":48,"value":367},{"type":43,"tag":304,"props":587,"children":588},{"class":306,"line":325},[589],{"type":43,"tag":304,"props":590,"children":591},{},[592],{"type":48,"value":593},"    \u003CItemCard @key=\"item.Id\" \u002F>\n",{"type":43,"tag":304,"props":595,"children":596},{"class":306,"line":335},[597],{"type":43,"tag":304,"props":598,"children":599},{},[600],{"type":48,"value":385},{"type":43,"tag":273,"props":602,"children":604},{"id":603},"advanced-persistentcomponentstate-service",[605,607,613],{"type":48,"value":606},"Advanced: ",{"type":43,"tag":85,"props":608,"children":610},{"className":609},[],[611],{"type":48,"value":612},"PersistentComponentState",{"type":48,"value":614}," service",{"type":43,"tag":58,"props":616,"children":617},{},[618],{"type":48,"value":619},"For complex scenarios (dynamic keys, custom serialization), use the imperative API:",{"type":43,"tag":293,"props":621,"children":625},{"className":622,"code":623,"language":624,"meta":298,"style":298},"language-csharp shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","@inject PersistentComponentState ApplicationState\n\n@code {\n    private List\u003COrder>? orders;\n\n    protected override async Task OnInitializedAsync()\n    {\n        ApplicationState.RegisterOnPersisting(PersistOrders);\n\n        if (!ApplicationState.TryTakeFromJson\u003CList\u003COrder>>(\"orders\", out var restored))\n        {\n            orders = await OrderService.GetOrdersAsync();\n        }\n        else\n        {\n            orders = restored;\n        }\n    }\n\n    private Task PersistOrders()\n    {\n        ApplicationState.PersistAsJson(\"orders\", orders);\n        return Task.CompletedTask;\n    }\n}\n","csharp",[626],{"type":43,"tag":85,"props":627,"children":628},{"__ignoreMap":298},[629,637,644,651,659,666,673,680,688,695,703,711,719,727,735,742,750,757,764,771,779,786,794,802,809],{"type":43,"tag":304,"props":630,"children":631},{"class":306,"line":307},[632],{"type":43,"tag":304,"props":633,"children":634},{},[635],{"type":48,"value":636},"@inject PersistentComponentState ApplicationState\n",{"type":43,"tag":304,"props":638,"children":639},{"class":306,"line":316},[640],{"type":43,"tag":304,"props":641,"children":642},{"emptyLinePlaceholder":329},[643],{"type":48,"value":332},{"type":43,"tag":304,"props":645,"children":646},{"class":306,"line":325},[647],{"type":43,"tag":304,"props":648,"children":649},{},[650],{"type":48,"value":463},{"type":43,"tag":304,"props":652,"children":653},{"class":306,"line":335},[654],{"type":43,"tag":304,"props":655,"children":656},{},[657],{"type":48,"value":658},"    private List\u003COrder>? orders;\n",{"type":43,"tag":304,"props":660,"children":661},{"class":306,"line":344},[662],{"type":43,"tag":304,"props":663,"children":664},{"emptyLinePlaceholder":329},[665],{"type":48,"value":332},{"type":43,"tag":304,"props":667,"children":668},{"class":306,"line":352},[669],{"type":43,"tag":304,"props":670,"children":671},{},[672],{"type":48,"value":498},{"type":43,"tag":304,"props":674,"children":675},{"class":306,"line":361},[676],{"type":43,"tag":304,"props":677,"children":678},{},[679],{"type":48,"value":420},{"type":43,"tag":304,"props":681,"children":682},{"class":306,"line":370},[683],{"type":43,"tag":304,"props":684,"children":685},{},[686],{"type":48,"value":687},"        ApplicationState.RegisterOnPersisting(PersistOrders);\n",{"type":43,"tag":304,"props":689,"children":690},{"class":306,"line":379},[691],{"type":43,"tag":304,"props":692,"children":693},{"emptyLinePlaceholder":329},[694],{"type":48,"value":332},{"type":43,"tag":304,"props":696,"children":697},{"class":306,"line":388},[698],{"type":43,"tag":304,"props":699,"children":700},{},[701],{"type":48,"value":702},"        if (!ApplicationState.TryTakeFromJson\u003CList\u003COrder>>(\"orders\", out var restored))\n",{"type":43,"tag":304,"props":704,"children":705},{"class":306,"line":397},[706],{"type":43,"tag":304,"props":707,"children":708},{},[709],{"type":48,"value":710},"        {\n",{"type":43,"tag":304,"props":712,"children":713},{"class":306,"line":405},[714],{"type":43,"tag":304,"props":715,"children":716},{},[717],{"type":48,"value":718},"            orders = await OrderService.GetOrdersAsync();\n",{"type":43,"tag":304,"props":720,"children":721},{"class":306,"line":414},[722],{"type":43,"tag":304,"props":723,"children":724},{},[725],{"type":48,"value":726},"        }\n",{"type":43,"tag":304,"props":728,"children":729},{"class":306,"line":423},[730],{"type":43,"tag":304,"props":731,"children":732},{},[733],{"type":48,"value":734},"        else\n",{"type":43,"tag":304,"props":736,"children":737},{"class":306,"line":432},[738],{"type":43,"tag":304,"props":739,"children":740},{},[741],{"type":48,"value":710},{"type":43,"tag":304,"props":743,"children":744},{"class":306,"line":441},[745],{"type":43,"tag":304,"props":746,"children":747},{},[748],{"type":48,"value":749},"            orders = restored;\n",{"type":43,"tag":304,"props":751,"children":752},{"class":306,"line":449},[753],{"type":43,"tag":304,"props":754,"children":755},{},[756],{"type":48,"value":726},{"type":43,"tag":304,"props":758,"children":759},{"class":306,"line":457},[760],{"type":43,"tag":304,"props":761,"children":762},{},[763],{"type":48,"value":438},{"type":43,"tag":304,"props":765,"children":766},{"class":306,"line":466},[767],{"type":43,"tag":304,"props":768,"children":769},{"emptyLinePlaceholder":329},[770],{"type":48,"value":332},{"type":43,"tag":304,"props":772,"children":773},{"class":306,"line":475},[774],{"type":43,"tag":304,"props":775,"children":776},{},[777],{"type":48,"value":778},"    private Task PersistOrders()\n",{"type":43,"tag":304,"props":780,"children":781},{"class":306,"line":484},[782],{"type":43,"tag":304,"props":783,"children":784},{},[785],{"type":48,"value":420},{"type":43,"tag":304,"props":787,"children":788},{"class":306,"line":492},[789],{"type":43,"tag":304,"props":790,"children":791},{},[792],{"type":48,"value":793},"        ApplicationState.PersistAsJson(\"orders\", orders);\n",{"type":43,"tag":304,"props":795,"children":796},{"class":306,"line":501},[797],{"type":43,"tag":304,"props":798,"children":799},{},[800],{"type":48,"value":801},"        return Task.CompletedTask;\n",{"type":43,"tag":304,"props":803,"children":804},{"class":306,"line":509},[805],{"type":43,"tag":304,"props":806,"children":807},{},[808],{"type":48,"value":438},{"type":43,"tag":304,"props":810,"children":811},{"class":306,"line":518},[812],{"type":43,"tag":304,"props":813,"children":814},{},[815],{"type":48,"value":385},{"type":43,"tag":51,"props":817,"children":819},{"id":818},"disable-prerendering",[820],{"type":48,"value":821},"Disable Prerendering",{"type":43,"tag":58,"props":823,"children":824},{},[825,827,832],{"type":48,"value":826},"Disable prerendering when a component depends on browser APIs immediately or when the prerender+interactive double render causes problems you can't solve with ",{"type":43,"tag":85,"props":828,"children":830},{"className":829},[],[831],{"type":48,"value":284},{"type":48,"value":833},".",{"type":43,"tag":273,"props":835,"children":837},{"id":836},"on-a-component-definition",[838],{"type":48,"value":839},"On a component definition",{"type":43,"tag":293,"props":841,"children":843},{"className":295,"code":842,"language":297,"meta":298,"style":298},"@rendermode @(new InteractiveServerRenderMode(prerender: false))\n",[844],{"type":43,"tag":85,"props":845,"children":846},{"__ignoreMap":298},[847],{"type":43,"tag":304,"props":848,"children":849},{"class":306,"line":307},[850],{"type":43,"tag":304,"props":851,"children":852},{},[853],{"type":48,"value":842},{"type":43,"tag":58,"props":855,"children":856},{},[857,859,865,867,873,875,881],{"type":48,"value":858},"Replace ",{"type":43,"tag":85,"props":860,"children":862},{"className":861},[],[863],{"type":48,"value":864},"InteractiveServerRenderMode",{"type":48,"value":866}," with ",{"type":43,"tag":85,"props":868,"children":870},{"className":869},[],[871],{"type":48,"value":872},"InteractiveWebAssemblyRenderMode",{"type":48,"value":874}," or ",{"type":43,"tag":85,"props":876,"children":878},{"className":877},[],[879],{"type":48,"value":880},"InteractiveAutoRenderMode",{"type":48,"value":882}," as needed.",{"type":43,"tag":273,"props":884,"children":886},{"id":885},"on-a-component-instance",[887],{"type":48,"value":888},"On a component instance",{"type":43,"tag":293,"props":890,"children":892},{"className":295,"code":891,"language":297,"meta":298,"style":298},"\u003CMyChart @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n",[893],{"type":43,"tag":85,"props":894,"children":895},{"__ignoreMap":298},[896],{"type":43,"tag":304,"props":897,"children":898},{"class":306,"line":307},[899],{"type":43,"tag":304,"props":900,"children":901},{},[902],{"type":48,"value":891},{"type":43,"tag":273,"props":904,"children":906},{"id":905},"on-the-entire-app",[907],{"type":48,"value":908},"On the entire app",{"type":43,"tag":58,"props":910,"children":911},{},[912,914,920],{"type":48,"value":913},"In ",{"type":43,"tag":85,"props":915,"children":917},{"className":916},[],[918],{"type":48,"value":919},"App.razor",{"type":48,"value":162},{"type":43,"tag":293,"props":922,"children":924},{"className":295,"code":923,"language":297,"meta":298,"style":298},"\u003CHeadOutlet @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n\u003CRoutes @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n",[925],{"type":43,"tag":85,"props":926,"children":927},{"__ignoreMap":298},[928,936],{"type":43,"tag":304,"props":929,"children":930},{"class":306,"line":307},[931],{"type":43,"tag":304,"props":932,"children":933},{},[934],{"type":48,"value":935},"\u003CHeadOutlet @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n",{"type":43,"tag":304,"props":937,"children":938},{"class":306,"line":316},[939],{"type":43,"tag":304,"props":940,"children":941},{},[942],{"type":48,"value":943},"\u003CRoutes @rendermode=\"new InteractiveServerRenderMode(prerender: false)\" \u002F>\n",{"type":43,"tag":58,"props":945,"children":946},{},[947,949,955],{"type":48,"value":948},"Note: A parent's prerendering setting overrides children. If ",{"type":43,"tag":85,"props":950,"children":952},{"className":951},[],[953],{"type":48,"value":954},"\u003CRoutes>",{"type":48,"value":956}," disables prerendering, individual pages cannot re-enable it.",{"type":43,"tag":51,"props":958,"children":960},{"id":959},"exclude-pages-from-interactive-routing",[961],{"type":48,"value":962},"Exclude Pages from Interactive Routing",{"type":43,"tag":58,"props":964,"children":965},{},[966,968,974],{"type":48,"value":967},"In a globally interactive app, some pages may need ",{"type":43,"tag":85,"props":969,"children":971},{"className":970},[],[972],{"type":48,"value":973},"HttpContext",{"type":48,"value":975}," (cookies, request headers, response status codes). These pages must render via static SSR, not inside the interactive runtime.",{"type":43,"tag":58,"props":977,"children":978},{},[979,981,987],{"type":48,"value":980},"Use ",{"type":43,"tag":85,"props":982,"children":984},{"className":983},[],[985],{"type":48,"value":986},"[ExcludeFromInteractiveRouting]",{"type":48,"value":162},{"type":43,"tag":293,"props":989,"children":991},{"className":295,"code":990,"language":297,"meta":298,"style":298},"@page \"\u002Fprivacy\"\n@attribute [ExcludeFromInteractiveRouting]\n\n\u003Ch1>Privacy Policy\u003C\u002Fh1>\n",[992],{"type":43,"tag":85,"props":993,"children":994},{"__ignoreMap":298},[995,1003,1011,1018],{"type":43,"tag":304,"props":996,"children":997},{"class":306,"line":307},[998],{"type":43,"tag":304,"props":999,"children":1000},{},[1001],{"type":48,"value":1002},"@page \"\u002Fprivacy\"\n",{"type":43,"tag":304,"props":1004,"children":1005},{"class":306,"line":316},[1006],{"type":43,"tag":304,"props":1007,"children":1008},{},[1009],{"type":48,"value":1010},"@attribute [ExcludeFromInteractiveRouting]\n",{"type":43,"tag":304,"props":1012,"children":1013},{"class":306,"line":325},[1014],{"type":43,"tag":304,"props":1015,"children":1016},{"emptyLinePlaceholder":329},[1017],{"type":48,"value":332},{"type":43,"tag":304,"props":1019,"children":1020},{"class":306,"line":335},[1021],{"type":43,"tag":304,"props":1022,"children":1023},{},[1024],{"type":48,"value":1025},"\u003Ch1>Privacy Policy\u003C\u002Fh1>\n",{"type":43,"tag":58,"props":1027,"children":1028},{},[1029,1031,1036,1038,1043],{"type":48,"value":1030},"This forces a ",{"type":43,"tag":64,"props":1032,"children":1033},{},[1034],{"type":48,"value":1035},"full page reload",{"type":48,"value":1037}," when navigating to this page, exiting interactive routing. The page renders as static SSR with full ",{"type":43,"tag":85,"props":1039,"children":1041},{"className":1040},[],[1042],{"type":48,"value":973},{"type":48,"value":1044}," access.",{"type":43,"tag":58,"props":1046,"children":1047},{},[1048,1049,1054],{"type":48,"value":913},{"type":43,"tag":85,"props":1050,"children":1052},{"className":1051},[],[1053],{"type":48,"value":919},{"type":48,"value":1055},", conditionally apply the render mode:",{"type":43,"tag":293,"props":1057,"children":1059},{"className":295,"code":1058,"language":297,"meta":298,"style":298},"\u003C!DOCTYPE html>\n\u003Chtml>\n\u003Chead>\n    \u003CHeadOutlet @rendermode=\"RenderModeForPage\" \u002F>\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003CRoutes @rendermode=\"RenderModeForPage\" \u002F>\n    \u003Cscript src=\"_framework\u002Fblazor.web.js\">\u003C\u002Fscript>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n\n@code {\n    [CascadingParameter]\n    public HttpContext HttpContext { get; set; } = default!;\n\n    private IComponentRenderMode? RenderModeForPage =>\n        HttpContext.AcceptsInteractiveRouting() ? InteractiveServer : null;\n}\n",[1060],{"type":43,"tag":85,"props":1061,"children":1062},{"__ignoreMap":298},[1063,1071,1079,1087,1095,1103,1111,1119,1127,1135,1143,1150,1157,1165,1173,1180,1188,1196],{"type":43,"tag":304,"props":1064,"children":1065},{"class":306,"line":307},[1066],{"type":43,"tag":304,"props":1067,"children":1068},{},[1069],{"type":48,"value":1070},"\u003C!DOCTYPE html>\n",{"type":43,"tag":304,"props":1072,"children":1073},{"class":306,"line":316},[1074],{"type":43,"tag":304,"props":1075,"children":1076},{},[1077],{"type":48,"value":1078},"\u003Chtml>\n",{"type":43,"tag":304,"props":1080,"children":1081},{"class":306,"line":325},[1082],{"type":43,"tag":304,"props":1083,"children":1084},{},[1085],{"type":48,"value":1086},"\u003Chead>\n",{"type":43,"tag":304,"props":1088,"children":1089},{"class":306,"line":335},[1090],{"type":43,"tag":304,"props":1091,"children":1092},{},[1093],{"type":48,"value":1094},"    \u003CHeadOutlet @rendermode=\"RenderModeForPage\" \u002F>\n",{"type":43,"tag":304,"props":1096,"children":1097},{"class":306,"line":344},[1098],{"type":43,"tag":304,"props":1099,"children":1100},{},[1101],{"type":48,"value":1102},"\u003C\u002Fhead>\n",{"type":43,"tag":304,"props":1104,"children":1105},{"class":306,"line":352},[1106],{"type":43,"tag":304,"props":1107,"children":1108},{},[1109],{"type":48,"value":1110},"\u003Cbody>\n",{"type":43,"tag":304,"props":1112,"children":1113},{"class":306,"line":361},[1114],{"type":43,"tag":304,"props":1115,"children":1116},{},[1117],{"type":48,"value":1118},"    \u003CRoutes @rendermode=\"RenderModeForPage\" \u002F>\n",{"type":43,"tag":304,"props":1120,"children":1121},{"class":306,"line":370},[1122],{"type":43,"tag":304,"props":1123,"children":1124},{},[1125],{"type":48,"value":1126},"    \u003Cscript src=\"_framework\u002Fblazor.web.js\">\u003C\u002Fscript>\n",{"type":43,"tag":304,"props":1128,"children":1129},{"class":306,"line":379},[1130],{"type":43,"tag":304,"props":1131,"children":1132},{},[1133],{"type":48,"value":1134},"\u003C\u002Fbody>\n",{"type":43,"tag":304,"props":1136,"children":1137},{"class":306,"line":388},[1138],{"type":43,"tag":304,"props":1139,"children":1140},{},[1141],{"type":48,"value":1142},"\u003C\u002Fhtml>\n",{"type":43,"tag":304,"props":1144,"children":1145},{"class":306,"line":397},[1146],{"type":43,"tag":304,"props":1147,"children":1148},{"emptyLinePlaceholder":329},[1149],{"type":48,"value":332},{"type":43,"tag":304,"props":1151,"children":1152},{"class":306,"line":405},[1153],{"type":43,"tag":304,"props":1154,"children":1155},{},[1156],{"type":48,"value":463},{"type":43,"tag":304,"props":1158,"children":1159},{"class":306,"line":414},[1160],{"type":43,"tag":304,"props":1161,"children":1162},{},[1163],{"type":48,"value":1164},"    [CascadingParameter]\n",{"type":43,"tag":304,"props":1166,"children":1167},{"class":306,"line":423},[1168],{"type":43,"tag":304,"props":1169,"children":1170},{},[1171],{"type":48,"value":1172},"    public HttpContext HttpContext { get; set; } = default!;\n",{"type":43,"tag":304,"props":1174,"children":1175},{"class":306,"line":432},[1176],{"type":43,"tag":304,"props":1177,"children":1178},{"emptyLinePlaceholder":329},[1179],{"type":48,"value":332},{"type":43,"tag":304,"props":1181,"children":1182},{"class":306,"line":441},[1183],{"type":43,"tag":304,"props":1184,"children":1185},{},[1186],{"type":48,"value":1187},"    private IComponentRenderMode? RenderModeForPage =>\n",{"type":43,"tag":304,"props":1189,"children":1190},{"class":306,"line":449},[1191],{"type":43,"tag":304,"props":1192,"children":1193},{},[1194],{"type":48,"value":1195},"        HttpContext.AcceptsInteractiveRouting() ? InteractiveServer : null;\n",{"type":43,"tag":304,"props":1197,"children":1198},{"class":306,"line":457},[1199],{"type":43,"tag":304,"props":1200,"children":1201},{},[1202],{"type":48,"value":385},{"type":43,"tag":58,"props":1204,"children":1205},{},[1206,1207,1213],{"type":48,"value":858},{"type":43,"tag":85,"props":1208,"children":1210},{"className":1209},[],[1211],{"type":48,"value":1212},"InteractiveServer",{"type":48,"value":1214}," with the app's configured render mode.",{"type":43,"tag":51,"props":1216,"children":1218},{"id":1217},"detect-prerender-vs-interactive-at-runtime",[1219],{"type":48,"value":1220},"Detect Prerender vs Interactive at Runtime",{"type":43,"tag":58,"props":1222,"children":1223},{},[1224,1225,1231],{"type":48,"value":980},{"type":43,"tag":85,"props":1226,"children":1228},{"className":1227},[],[1229],{"type":48,"value":1230},"RendererInfo",{"type":48,"value":1232}," to guard code that should only run interactively:",{"type":43,"tag":293,"props":1234,"children":1236},{"className":622,"code":1235,"language":624,"meta":298,"style":298},"protected override async Task OnInitializedAsync()\n{\n    if (RendererInfo.IsInteractive)\n    {\n        \u002F\u002F Only runs during the interactive render, not during prerender\n        await StartSignalRConnection();\n    }\n}\n",[1237],{"type":43,"tag":85,"props":1238,"children":1239},{"__ignoreMap":298},[1240,1248,1255,1263,1270,1278,1286,1293],{"type":43,"tag":304,"props":1241,"children":1242},{"class":306,"line":307},[1243],{"type":43,"tag":304,"props":1244,"children":1245},{},[1246],{"type":48,"value":1247},"protected override async Task OnInitializedAsync()\n",{"type":43,"tag":304,"props":1249,"children":1250},{"class":306,"line":316},[1251],{"type":43,"tag":304,"props":1252,"children":1253},{},[1254],{"type":48,"value":367},{"type":43,"tag":304,"props":1256,"children":1257},{"class":306,"line":325},[1258],{"type":43,"tag":304,"props":1259,"children":1260},{},[1261],{"type":48,"value":1262},"    if (RendererInfo.IsInteractive)\n",{"type":43,"tag":304,"props":1264,"children":1265},{"class":306,"line":335},[1266],{"type":43,"tag":304,"props":1267,"children":1268},{},[1269],{"type":48,"value":420},{"type":43,"tag":304,"props":1271,"children":1272},{"class":306,"line":344},[1273],{"type":43,"tag":304,"props":1274,"children":1275},{},[1276],{"type":48,"value":1277},"        \u002F\u002F Only runs during the interactive render, not during prerender\n",{"type":43,"tag":304,"props":1279,"children":1280},{"class":306,"line":352},[1281],{"type":43,"tag":304,"props":1282,"children":1283},{},[1284],{"type":48,"value":1285},"        await StartSignalRConnection();\n",{"type":43,"tag":304,"props":1287,"children":1288},{"class":306,"line":361},[1289],{"type":43,"tag":304,"props":1290,"children":1291},{},[1292],{"type":48,"value":438},{"type":43,"tag":304,"props":1294,"children":1295},{"class":306,"line":370},[1296],{"type":43,"tag":304,"props":1297,"children":1298},{},[1299],{"type":48,"value":385},{"type":43,"tag":58,"props":1301,"children":1302},{},[1303,1308],{"type":43,"tag":85,"props":1304,"children":1306},{"className":1305},[],[1307],{"type":48,"value":1230},{"type":48,"value":1309}," properties:",{"type":43,"tag":77,"props":1311,"children":1312},{},[1313,1340],{"type":43,"tag":81,"props":1314,"children":1315},{},[1316,1322,1324,1330,1332,1338],{"type":43,"tag":85,"props":1317,"children":1319},{"className":1318},[],[1320],{"type":48,"value":1321},"IsInteractive",{"type":48,"value":1323}," — ",{"type":43,"tag":85,"props":1325,"children":1327},{"className":1326},[],[1328],{"type":48,"value":1329},"false",{"type":48,"value":1331}," during prerender, ",{"type":43,"tag":85,"props":1333,"children":1335},{"className":1334},[],[1336],{"type":48,"value":1337},"true",{"type":48,"value":1339}," after interactive runtime attaches",{"type":43,"tag":81,"props":1341,"children":1342},{},[1343,1349,1350,1356,1357,1363,1364,1370],{"type":43,"tag":85,"props":1344,"children":1346},{"className":1345},[],[1347],{"type":48,"value":1348},"Name",{"type":48,"value":1323},{"type":43,"tag":85,"props":1351,"children":1353},{"className":1352},[],[1354],{"type":48,"value":1355},"\"Static\"",{"type":48,"value":1331},{"type":43,"tag":85,"props":1358,"children":1360},{"className":1359},[],[1361],{"type":48,"value":1362},"\"Server\"",{"type":48,"value":874},{"type":43,"tag":85,"props":1365,"children":1367},{"className":1366},[],[1368],{"type":48,"value":1369},"\"WebAssembly\"",{"type":48,"value":1371}," when interactive",{"type":43,"tag":51,"props":1373,"children":1375},{"id":1374},"client-services-fail-during-prerender",[1376],{"type":48,"value":1377},"Client Services Fail During Prerender",{"type":43,"tag":58,"props":1379,"children":1380},{},[1381,1383,1389,1391,1397,1399,1405],{"type":48,"value":1382},"Components in the ",{"type":43,"tag":85,"props":1384,"children":1386},{"className":1385},[],[1387],{"type":48,"value":1388},".Client",{"type":48,"value":1390}," project prerender on the server. Services registered only in the client ",{"type":43,"tag":85,"props":1392,"children":1394},{"className":1393},[],[1395],{"type":48,"value":1396},"Program.cs",{"type":48,"value":1398}," (e.g., ",{"type":43,"tag":85,"props":1400,"children":1402},{"className":1401},[],[1403],{"type":48,"value":1404},"IWebAssemblyHostEnvironment",{"type":48,"value":1406},") won't be available during prerender.",{"type":43,"tag":58,"props":1408,"children":1409},{},[1410],{"type":48,"value":1411},"Fix by one of:",{"type":43,"tag":1413,"props":1414,"children":1415},"ol",{},[1416,1433,1449,1466],{"type":43,"tag":81,"props":1417,"children":1418},{},[1419,1424,1426,1431],{"type":43,"tag":64,"props":1420,"children":1421},{},[1422],{"type":48,"value":1423},"Register a matching service on the server",{"type":48,"value":1425}," — both ",{"type":43,"tag":85,"props":1427,"children":1429},{"className":1428},[],[1430],{"type":48,"value":1396},{"type":48,"value":1432}," files provide the service",{"type":43,"tag":81,"props":1434,"children":1435},{},[1436,1441,1443],{"type":43,"tag":64,"props":1437,"children":1438},{},[1439],{"type":48,"value":1440},"Make the service optional",{"type":48,"value":1442}," — use constructor injection with a nullable default: ",{"type":43,"tag":85,"props":1444,"children":1446},{"className":1445},[],[1447],{"type":48,"value":1448},"public MyComponent(IMyService? svc = null)",{"type":43,"tag":81,"props":1450,"children":1451},{},[1452,1457,1459,1464],{"type":43,"tag":64,"props":1453,"children":1454},{},[1455],{"type":48,"value":1456},"Create a service abstraction",{"type":48,"value":1458}," — interface in ",{"type":43,"tag":85,"props":1460,"children":1462},{"className":1461},[],[1463],{"type":48,"value":1388},{"type":48,"value":1465},", implementations in both projects",{"type":43,"tag":81,"props":1467,"children":1468},{},[1469,1474],{"type":43,"tag":64,"props":1470,"children":1471},{},[1472],{"type":48,"value":1473},"Disable prerendering",{"type":48,"value":1475}," for that component",{"type":43,"tag":51,"props":1477,"children":1479},{"id":1478},"donts",[1480],{"type":48,"value":1481},"Don'ts",{"type":43,"tag":77,"props":1483,"children":1484},{},[1485,1504,1529,1548],{"type":43,"tag":81,"props":1486,"children":1487},{},[1488,1490,1495,1497,1503],{"type":48,"value":1489},"Don't call JS interop in ",{"type":43,"tag":85,"props":1491,"children":1493},{"className":1492},[],[1494],{"type":48,"value":90},{"type":48,"value":1496}," — JS isn't available during prerender. Use ",{"type":43,"tag":85,"props":1498,"children":1500},{"className":1499},[],[1501],{"type":48,"value":1502},"OnAfterRenderAsync(firstRender)",{"type":48,"value":833},{"type":43,"tag":81,"props":1505,"children":1506},{},[1507,1509,1514,1516,1521,1522,1527],{"type":48,"value":1508},"Don't assume ",{"type":43,"tag":85,"props":1510,"children":1512},{"className":1511},[],[1513],{"type":48,"value":90},{"type":48,"value":1515}," runs once — it runs twice with prerendering. Always use ",{"type":43,"tag":85,"props":1517,"children":1519},{"className":1518},[],[1520],{"type":48,"value":284},{"type":48,"value":874},{"type":43,"tag":85,"props":1523,"children":1525},{"className":1524},[],[1526],{"type":48,"value":542},{"type":48,"value":1528}," guards.",{"type":43,"tag":81,"props":1530,"children":1531},{},[1532,1534,1539,1541,1546],{"type":48,"value":1533},"Don't use ",{"type":43,"tag":85,"props":1535,"children":1537},{"className":1536},[],[1538],{"type":48,"value":973},{"type":48,"value":1540}," in interactive components — it's only available during the static prerender, not during the interactive lifetime. Use ",{"type":43,"tag":85,"props":1542,"children":1544},{"className":1543},[],[1545],{"type":48,"value":986},{"type":48,"value":1547}," for pages that need it.",{"type":43,"tag":81,"props":1549,"children":1550},{},[1551,1553,1558],{"type":48,"value":1552},"Don't disable prerendering as a first resort — it hurts perceived load time and SEO. Use ",{"type":43,"tag":85,"props":1554,"children":1556},{"className":1555},[],[1557],{"type":48,"value":284},{"type":48,"value":1559}," to preserve state instead.",{"type":43,"tag":1561,"props":1562,"children":1563},"style",{},[1564],{"type":48,"value":1565},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":1567,"total":1727},[1568,1582,1597,1612,1630,1644,1661,1671,1683,1693,1706,1717],{"slug":1569,"name":1569,"fn":1570,"description":1571,"org":1572,"tags":1573,"stars":1579,"repoUrl":1580,"updatedAt":1581},"multithreaded-task-migration","migrate MSBuild tasks to multithreaded mode","Guide for migrating MSBuild tasks to multithreaded mode support, including compatibility red-team review. Use this when converting tasks to thread-safe versions, implementing IMultiThreadableTask, adding TaskEnvironment support, or auditing migrations for behavioral compatibility.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1574,1575,1578],{"name":17,"slug":18,"type":15},{"name":1576,"slug":1577,"type":15},"Engineering","engineering",{"name":13,"slug":14,"type":15},5535,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fmsbuild","2026-07-22T05:37:33.965588",{"slug":1583,"name":1583,"fn":1584,"description":1585,"org":1586,"tags":1587,"stars":25,"repoUrl":26,"updatedAt":1596},"analyzing-dotnet-performance","analyze .NET code for performance anti-patterns","Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I\u002FO with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1588,1589,1592,1595],{"name":17,"slug":18,"type":15},{"name":1590,"slug":1591,"type":15},"Code Analysis","code-analysis",{"name":1593,"slug":1594,"type":15},"Debugging","debugging",{"name":13,"slug":14,"type":15},"2026-07-12T08:23:25.400375",{"slug":1598,"name":1598,"fn":1599,"description":1600,"org":1601,"tags":1602,"stars":25,"repoUrl":26,"updatedAt":1611},"android-tombstone-symbolication","symbolicate .NET runtime frames in Android tombstones","Symbolicate the .NET runtime frames in an Android tombstone file. Extracts BuildIds and PC offsets from the native backtrace, downloads debug symbols from the Microsoft symbol server, and runs llvm-symbolizer to produce function names with source file and line numbers. USE FOR triaging a .NET MAUI or Mono Android app crash from a tombstone, resolving native backtrace frames in libmonosgen-2.0.so or libcoreclr.so to .NET runtime source code, or investigating SIGABRT, SIGSEGV, or other native signals originating from the .NET runtime on Android. DO NOT USE FOR pure Java\u002FKotlin crashes, managed .NET exceptions that are already captured in logcat, or iOS crash logs. INVOKES Symbolicate-Tombstone.ps1 script, llvm-symbolizer, Microsoft symbol server.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1603,1604,1607,1608],{"name":17,"slug":18,"type":15},{"name":1605,"slug":1606,"type":15},"Android","android",{"name":1593,"slug":1594,"type":15},{"name":1609,"slug":1610,"type":15},"Microsoft","microsoft","2026-07-12T08:23:21.595572",{"slug":1613,"name":1613,"fn":1614,"description":1615,"org":1616,"tags":1617,"stars":25,"repoUrl":26,"updatedAt":1629},"apple-crash-symbolication","symbolicate .NET runtime frames in crash logs","Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS). Extracts UUIDs and addresses from the native backtrace, locates dSYM debug symbols, and runs atos to produce function names with source file and line numbers. Automatically downloads .dwarf symbols from the Microsoft symbol server using Mach-O UUIDs. USE FOR triaging a .NET MAUI or Mono app crash from an .ips file on any Apple platform, resolving native backtrace frames in libcoreclr or libmonosgen-2.0 to .NET runtime source code, retrieving .ips crash logs from a connected iOS device or iPhone, or investigating EXC_CRASH, EXC_BAD_ACCESS, SIGABRT, or SIGSEGV originating from the .NET runtime. DO NOT USE FOR pure Swift\u002FObjective-C crashes with no .NET components, or Android tombstone files. INVOKES Symbolicate-Crash.ps1 script, atos, dwarfdump, idevicecrashreport.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1618,1619,1620,1623,1626],{"name":17,"slug":18,"type":15},{"name":1593,"slug":1594,"type":15},{"name":1621,"slug":1622,"type":15},"iOS","ios",{"name":1624,"slug":1625,"type":15},"macOS","macos",{"name":1627,"slug":1628,"type":15},"Observability","observability","2026-07-12T08:23:20.369986",{"slug":1631,"name":1631,"fn":1632,"description":1633,"org":1634,"tags":1635,"stars":25,"repoUrl":26,"updatedAt":1643},"assertion-quality","evaluate assertion quality in test suites","Analyzes the variety and depth of assertions across test suites in any language. Use when the user asks to evaluate assertion quality, find shallow tests, identify assertion-free tests (no assertions or only trivial ones like Assert.IsNotNull \u002F toBeTruthy()), flag self-referential or tautological assertions, measure assertion diversity, or audit whether tests verify different facets of behavior. Polyglot: .NET, Python, TS\u002FJS, Java, Go, Ruby, Rust, Swift, Kotlin, PowerShell, C++. DO NOT USE FOR: writing new tests (use code-testing-agent \u002F writing-mstest-tests), mutation reasoning about whether tests would catch a bug (use test-gap-analysis), or a general severity-ranked anti-pattern audit (use test-anti-patterns), fixing or rewriting assertions, or writing, fixing, or modernizing MSTest tests, assertions, or attributes (use writing-mstest-tests).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1636,1637,1640],{"name":1590,"slug":1591,"type":15},{"name":1638,"slug":1639,"type":15},"QA","qa",{"name":1641,"slug":1642,"type":15},"Testing","testing","2026-07-12T08:23:51.277743",{"slug":1645,"name":1645,"fn":1646,"description":1647,"org":1648,"tags":1649,"stars":25,"repoUrl":26,"updatedAt":1660},"author-component","create and review Blazor components","Create or review Blazor components (.razor files) with correct architecture. USE FOR: writing new Blazor components that do NOT involve JavaScript interop, implementing parameters and EventCallback, RenderFragment slots, component lifecycle (OnInitializedAsync, OnParametersSet), async patterns, IAsyncDisposable, CancellationToken, CSS isolation, code-behind. DO NOT USE FOR: creating new projects (use create-blazor-project), JavaScript interop or calling browser APIs from Blazor (use use-js-interop), forms and validation (use collect-user-input), prerendering issues (use support-prerendering), HTTP data fetching patterns (use fetch-and-send-data), coordinating state between unrelated components (use coordinate-components).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1650,1651,1652,1654,1657],{"name":17,"slug":18,"type":15},{"name":20,"slug":21,"type":15},{"name":1653,"slug":624,"type":15},"C#",{"name":1655,"slug":1656,"type":15},"UI Components","ui-components",{"name":1658,"slug":1659,"type":15},"Web Development","web-development","2026-07-15T06:03:29.216359",{"slug":1662,"name":1662,"fn":1663,"description":1664,"org":1665,"tags":1666,"stars":25,"repoUrl":26,"updatedAt":1670},"binlog-failure-analysis","analyze MSBuild binary logs","Analyze MSBuild binary logs to diagnose build failures. USE FOR: build errors that are unclear from console output, diagnosing cascading failures across multi-project builds, tracing MSBuild target execution order, and generally any MSBuild build issues. Requires an existing .binlog file. DO NOT USE FOR: generating binlogs (use binlog-generation), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1667,1668,1669],{"name":1590,"slug":1591,"type":15},{"name":1593,"slug":1594,"type":15},{"name":1609,"slug":1610,"type":15},"2026-07-12T08:21:34.637923",{"slug":1672,"name":1672,"fn":1673,"description":1674,"org":1675,"tags":1676,"stars":25,"repoUrl":26,"updatedAt":1682},"binlog-generation","generate MSBuild binary logs for diagnostics","Generate MSBuild binary logs (binlogs) for build diagnostics and analysis. USE FOR: adding \u002Fbl:{} to any dotnet build, test, pack, publish, or restore command to capture a full build execution trace, prerequisite for binlog-failure-analysis and build-perf-diagnostics skills, enabling post-build investigation of errors or performance. Requires MSBuild 17.8+ \u002F .NET 8 SDK+ for {} placeholder; PowerShell needs -bl:{{}}. DO NOT USE FOR: non-MSBuild build systems (npm, Maven, CMake), analyzing an existing binlog (use binlog-failure-analysis instead).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1677,1680,1681],{"name":1678,"slug":1679,"type":15},"Build","build",{"name":1593,"slug":1594,"type":15},{"name":1576,"slug":1577,"type":15},"2026-07-19T05:38:19.340791",{"slug":1684,"name":1684,"fn":1685,"description":1686,"org":1687,"tags":1688,"stars":25,"repoUrl":26,"updatedAt":1692},"build-parallelism","optimize MSBuild build parallelism","Diagnose and fix under-parallelized MSBuild builds. USE WHEN a multi-project solution build is slower than expected, doesn't speed up when you add cores, pegs a single core while others idle, or you want to know why `-m` isn't helping. Note: `\u002Fmaxcpucount` default is 1 (sequential) — always pass `-m` for parallel builds. Covers finding the critical path (longest serial ProjectReference chain), graph build (`\u002Fgraph`), BuildInParallel, and solution filters (`.slnf`). DO NOT USE FOR: single-project builds, incremental issues (use incremental-build), compilation slowness inside one project (use build-perf-diagnostics), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1689,1690,1691],{"name":17,"slug":18,"type":15},{"name":1576,"slug":1577,"type":15},{"name":13,"slug":14,"type":15},"2026-07-19T05:38:18.364937",{"slug":1694,"name":1694,"fn":1695,"description":1696,"org":1697,"tags":1698,"stars":25,"repoUrl":26,"updatedAt":1705},"build-perf-baseline","establish and optimize build performance baselines","Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before\u002Fafter measurements (cold, warm, no-op scenarios), applying optimization strategies like MSBuild Server, static graph builds, artifacts output, and dependency graph trimming. Start here before diving into build-perf-diagnostics, incremental-build, or build-parallelism. DO NOT USE FOR: non-MSBuild build systems, detailed bottleneck analysis (use build-perf-diagnostics after baselining).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1699,1700,1703,1704],{"name":1576,"slug":1577,"type":15},{"name":1701,"slug":1702,"type":15},"Monitoring","monitoring",{"name":13,"slug":14,"type":15},{"name":1641,"slug":1642,"type":15},"2026-07-12T08:21:35.865649",{"slug":1707,"name":1707,"fn":1708,"description":1709,"org":1710,"tags":1711,"stars":25,"repoUrl":26,"updatedAt":1716},"build-perf-diagnostics","diagnose MSBuild build performance bottlenecks","Diagnose MSBuild build performance bottlenecks using binary log analysis. USE FOR: identifying why builds are slow by analyzing binlog performance summaries, detecting ResolveAssemblyReference (RAR) taking >5s, Roslyn analyzers consuming >30% of Csc time, single targets dominating >50% of build time, node utilization below 80%, excessive Copy tasks, NuGet restore running every build. Covers timeline analysis, Target\u002FTask Performance Summary interpretation, and 7 common bottleneck categories. Use after build-perf-baseline has established measurements. DO NOT USE FOR: establishing initial baselines (use build-perf-baseline first), fixing incremental build issues (use incremental-build), parallelism tuning (use build-parallelism), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1712,1713,1714,1715],{"name":17,"slug":18,"type":15},{"name":1593,"slug":1594,"type":15},{"name":1576,"slug":1577,"type":15},{"name":13,"slug":14,"type":15},"2026-07-12T08:21:40.961722",{"slug":1718,"name":1718,"fn":1719,"description":1720,"org":1721,"tags":1722,"stars":25,"repoUrl":26,"updatedAt":1726},"check-bin-obj-clash","detect MSBuild output path conflicts","Detects MSBuild projects with conflicting OutputPath or IntermediateOutputPath. USE FOR: builds failing with 'Cannot create a file when that file already exists', 'The process cannot access the file because it is being used by another process', intermittent build failures that succeed on retry, or missing\u002Foverwritten outputs in multi-project or multi-targeting builds where bin\u002Fobj (or project.assets.json) collide. Common causes: shared OutputPath, missing AppendTargetFrameworkToOutputPath, extra global properties (e.g. PublishReadyToRun), or SetTargetFramework on a ProjectReference to a single-targeting project. DO NOT USE FOR: file access errors unrelated to MSBuild (OS-level locking), single-project single-TFM builds, non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1723,1724,1725],{"name":1593,"slug":1594,"type":15},{"name":1576,"slug":1577,"type":15},{"name":1638,"slug":1639,"type":15},"2026-07-19T05:38:14.336279",144,{"items":1729,"total":1778},[1730,1737,1744,1752,1758,1766,1772],{"slug":1583,"name":1583,"fn":1584,"description":1585,"org":1731,"tags":1732,"stars":25,"repoUrl":26,"updatedAt":1596},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1733,1734,1735,1736],{"name":17,"slug":18,"type":15},{"name":1590,"slug":1591,"type":15},{"name":1593,"slug":1594,"type":15},{"name":13,"slug":14,"type":15},{"slug":1598,"name":1598,"fn":1599,"description":1600,"org":1738,"tags":1739,"stars":25,"repoUrl":26,"updatedAt":1611},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1740,1741,1742,1743],{"name":17,"slug":18,"type":15},{"name":1605,"slug":1606,"type":15},{"name":1593,"slug":1594,"type":15},{"name":1609,"slug":1610,"type":15},{"slug":1613,"name":1613,"fn":1614,"description":1615,"org":1745,"tags":1746,"stars":25,"repoUrl":26,"updatedAt":1629},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1747,1748,1749,1750,1751],{"name":17,"slug":18,"type":15},{"name":1593,"slug":1594,"type":15},{"name":1621,"slug":1622,"type":15},{"name":1624,"slug":1625,"type":15},{"name":1627,"slug":1628,"type":15},{"slug":1631,"name":1631,"fn":1632,"description":1633,"org":1753,"tags":1754,"stars":25,"repoUrl":26,"updatedAt":1643},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1755,1756,1757],{"name":1590,"slug":1591,"type":15},{"name":1638,"slug":1639,"type":15},{"name":1641,"slug":1642,"type":15},{"slug":1645,"name":1645,"fn":1646,"description":1647,"org":1759,"tags":1760,"stars":25,"repoUrl":26,"updatedAt":1660},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1761,1762,1763,1764,1765],{"name":17,"slug":18,"type":15},{"name":20,"slug":21,"type":15},{"name":1653,"slug":624,"type":15},{"name":1655,"slug":1656,"type":15},{"name":1658,"slug":1659,"type":15},{"slug":1662,"name":1662,"fn":1663,"description":1664,"org":1767,"tags":1768,"stars":25,"repoUrl":26,"updatedAt":1670},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1769,1770,1771],{"name":1590,"slug":1591,"type":15},{"name":1593,"slug":1594,"type":15},{"name":1609,"slug":1610,"type":15},{"slug":1672,"name":1672,"fn":1673,"description":1674,"org":1773,"tags":1774,"stars":25,"repoUrl":26,"updatedAt":1682},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[1775,1776,1777],{"name":1678,"slug":1679,"type":15},{"name":1593,"slug":1594,"type":15},{"name":1576,"slug":1577,"type":15},96]