Skip to content

Commit db8101e

Browse files
committed
Fix tests
1 parent feb8303 commit db8101e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Components/Components/src/PersistentComponentState.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ internal PersistentComponentState(
3131

3232
internal bool PersistingState { get; set; }
3333

34-
// TODO: Replace IPersistentComponentStateScenario with RestoreContext
3534
internal void InitializeExistingState(IDictionary<string, byte[]> existingState, RestoreContext context)
3635
{
3736
if (_existingState != null)
@@ -89,7 +88,6 @@ public RestoringComponentStateSubscription RegisterOnRestoring(Action callback,
8988

9089
if (options.AllowUpdates)
9190
{
92-
// TODO: Remove the filter from registration
9391
var registration = new RestoreComponentStateRegistration(callback);
9492
_registeredRestoringCallbacks.Add(registration);
9593
return new RestoringComponentStateSubscription(_registeredRestoringCallbacks, registration);

src/Components/Components/test/PersistentStateValueProviderTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public void Subscribe_RegistersPersistenceCallback()
5252
new Dictionary<string, byte[]>(),
5353
[],
5454
[]);
55+
56+
InitializeState(state, []);
57+
5558
var provider = new PersistentStateValueProvider(state, NullLogger<PersistentStateValueProvider>.Instance, new ServiceCollection().BuildServiceProvider());
5659
var renderer = new TestRenderer();
5760
var component = new TestComponent();
@@ -76,6 +79,8 @@ public void Unsubscribe_RemovesCallbackFromRegisteredCallbacks()
7679
[],
7780
[]);
7881

82+
InitializeState(state, []);
83+
7984
var provider = new PersistentStateValueProvider(state, NullLogger<PersistentStateValueProvider>.Instance, new ServiceCollection().BuildServiceProvider());
8085

8186
var renderer = new TestRenderer();
@@ -102,7 +107,7 @@ private static void InitializeState(PersistentComponentState state, List<(Compon
102107
var key = PersistentStateValueProviderKeyResolver.ComputeKey(item.componentState, item.propertyName);
103108
dictionary[key] = JsonSerializer.SerializeToUtf8Bytes(item.value, JsonSerializerOptions.Web);
104109
}
105-
state.InitializeExistingState(dictionary, null);
110+
state.InitializeExistingState(dictionary, RestoreContext.InitialValue);
106111
}
107112

108113
private static CascadingParameterInfo CreateCascadingParameterInfo(string propertyName, Type propertyType)

0 commit comments

Comments
 (0)