Skip to content

Commit 3149951

Browse files
committed
Cleanups
1 parent 4bc47f9 commit 3149951

File tree

3 files changed

+10
-210
lines changed

3 files changed

+10
-210
lines changed

src/Components/Components/src/ComponentSubscriptionKey.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
namespace Microsoft.AspNetCore.Components.Infrastructure;
77

8-
internal struct ComponentSubscriptionKey(ComponentState subscriber, string propertyName) : IEquatable<ComponentSubscriptionKey>
8+
// TODO: Add debugger display to show the component state component type and property name.
9+
internal readonly struct ComponentSubscriptionKey(ComponentState subscriber, string propertyName) : IEquatable<ComponentSubscriptionKey>
910
{
1011
public ComponentState Subscriber { get; } = subscriber;
1112

src/Components/Components/src/PersistentState/ComponentStatePersistenceManager.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,22 @@ public async Task RestoreStateAsync(IPersistentComponentStateStore store, Restor
7373

7474
if (_stateIsInitialized)
7575
{
76+
if (context != RestoreContext.ValueUpdate)
77+
{
78+
throw new InvalidOperationException("State already initialized.");
79+
}
7680
State.UpdateExistingState(data, context);
81+
foreach (var registration in _registeredRestoringCallbacks)
82+
{
83+
registration.Callback();
84+
}
7785
}
7886
else
7987
{
8088
State.InitializeExistingState(data, context);
8189
_servicesRegistry?.RegisterForPersistence(State);
8290
_stateIsInitialized = true;
8391
}
84-
85-
if (context == RestoreContext.ValueUpdate)
86-
{
87-
foreach (var registration in _registeredRestoringCallbacks)
88-
{
89-
registration.Callback();
90-
}
91-
return;
92-
}
9392
}
9493

9594
/// <summary>

src/Components/Components/src/PersistentState/PersistentStateKeyResolver.cs

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)