Skip to content

Commit 3dcad29

Browse files
committed
tmp
1 parent 8527825 commit 3dcad29

File tree

3 files changed

+29
-20
lines changed

3 files changed

+29
-20
lines changed

src/Components/Components/src/PersistentStateValueProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ internal class ComponentSubscription
400400
private object? _lastValue = _uninitializedValue;
401401
private bool _hasPendingInitialValue;
402402
private bool _ignoreUpdatedValues;
403-
private string _storageKey;
403+
private string? _storageKey;
404404
private readonly PersistentComponentState _state;
405405
private readonly ComponentState _subscriber;
406406
private readonly string _propertyName;

src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics;
45
using System.Globalization;
56
using System.Reflection;
67
using System.Security.Claims;
@@ -31,31 +32,39 @@ public RazorComponentEndpointsStartup(IConfiguration configuration)
3132
public void ConfigureServices(IServiceCollection services)
3233
{
3334
services.AddValidation();
35+
if (Debugger.IsAttached)
36+
{
37+
services.AddSignalR(options =>
38+
{
39+
options.KeepAliveInterval = TimeSpan.FromMinutes(10); // default is 15 seconds
40+
options.ClientTimeoutInterval = TimeSpan.FromMinutes(20); // must be longer than KeepAliveInterval
41+
});
42+
}
3443

3544
services.AddRazorComponents(options =>
3645
{
3746
options.MaxFormMappingErrorCount = 10;
3847
options.MaxFormMappingRecursionDepth = 5;
3948
options.MaxFormMappingCollectionSize = 100;
4049
})
41-
.RegisterPersistentService<InteractiveServerService>(RenderMode.InteractiveServer)
42-
.RegisterPersistentService<InteractiveAutoService>(RenderMode.InteractiveAuto)
43-
.RegisterPersistentService<InteractiveWebAssemblyService>(RenderMode.InteractiveWebAssembly)
44-
.AddInteractiveWebAssemblyComponents()
45-
.AddInteractiveServerComponents(options =>
46-
{
47-
if (Configuration.GetValue<bool>("DisableReconnectionCache"))
48-
{
49-
// This disables the reconnection cache, which forces the server to persist the circuit state.
50-
options.DisconnectedCircuitMaxRetained = 0;
51-
options.DetailedErrors = true;
52-
}
53-
})
54-
.AddAuthenticationStateSerialization(options =>
50+
.RegisterPersistentService<InteractiveServerService>(RenderMode.InteractiveServer)
51+
.RegisterPersistentService<InteractiveAutoService>(RenderMode.InteractiveAuto)
52+
.RegisterPersistentService<InteractiveWebAssemblyService>(RenderMode.InteractiveWebAssembly)
53+
.AddInteractiveWebAssemblyComponents()
54+
.AddInteractiveServerComponents(options =>
55+
{
56+
if (Configuration.GetValue<bool>("DisableReconnectionCache"))
5557
{
56-
bool.TryParse(Configuration["SerializeAllClaims"], out var serializeAllClaims);
57-
options.SerializeAllClaims = serializeAllClaims;
58-
});
58+
// This disables the reconnection cache, which forces the server to persist the circuit state.
59+
options.DisconnectedCircuitMaxRetained = 0;
60+
options.DetailedErrors = true;
61+
}
62+
})
63+
.AddAuthenticationStateSerialization(options =>
64+
{
65+
bool.TryParse(Configuration["SerializeAllClaims"], out var serializeAllClaims);
66+
options.SerializeAllClaims = serializeAllClaims;
67+
});
5968

6069
if (Configuration.GetValue<bool>("UseHybridCache"))
6170
{

src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PersistentState/PageWithDeclarativeEnhancedNavigationPersistentComponents.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
{
1717
@if (!string.IsNullOrEmpty(StreamingId))
1818
{
19-
<StreamingComponentWithDeclarativePersistentState @rendermode="@_renderMode" StreamingId="@StreamingId" ServerState="@ServerState" />
19+
<StreamingComponentWithDeclarativePersistentState @key="@("PersistentComponent")" @rendermode="@_renderMode" StreamingId="@StreamingId" ServerState="@ServerState" />
2020
}
2121
else
2222
{
23-
<NonStreamingComponentWithDeclarativePersistentState @rendermode="@_renderMode" ServerState="@ServerState" />
23+
<NonStreamingComponentWithDeclarativePersistentState @key="@("NonStreamingComponent")" @rendermode="@_renderMode" ServerState="@ServerState" />
2424
}
2525
}
2626
@if (!string.IsNullOrEmpty(StreamingId))

0 commit comments

Comments
 (0)