Skip to content

Commit

Permalink
Fix Server-Side AddBlazorCookiesExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriyDurov committed Mar 4, 2024
1 parent fe87103 commit 33e9b78
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@page "/cookies"
@rendermode @(new InteractiveAutoRenderMode())
@inject ICookieService CookieService

<PageTitle>Blazor.Cookies | Client-side rendered page</PageTitle>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"DetailedErrors": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\src\BitzArt.Blazor.Cookies.Server\BitzArt.Blazor.Cookies.Server.csproj" />
<ProjectReference Include="..\BitzArt.Blazor.Cookies.SampleApp.Client\BitzArt.Blazor.Cookies.SampleApp.Client.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</head>

<body>
<Routes />
<Routes @rendermode="InteractiveAuto"/>
<script src="_framework/blazor.web.js"></script>
</body>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
},
"DetailedErrors": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static IHostApplicationBuilder AddBlazorCookies(this IHostApplicationBuil
{
var httpContextAccessor = x.GetRequiredService<IHttpContextAccessor>();
var httpContext = httpContextAccessor.HttpContext;
var isPrerendering = (httpContext is not null);
var isPrerendering = (httpContext is not null && !httpContext.Response.HasStarted);
return isPrerendering
? x.GetRequiredService<HttpContextCookieService>()
Expand Down

0 comments on commit 33e9b78

Please sign in to comment.