-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
_ignoreComponentPropertyValue
needs to be unconditionally set outside of the loop.
Whenever we restore from persistent component state storage we always need to return that value instead of the one on the property.
We should cover this behavior in the unit tests for PersistentValueProviderComponentSubscription.cs
Otherwise, when a component is added, removed, then added again (for example, like what happens when we switch pages and a component gets destroyed and added back, or when a component doesn't use @key
) the restored value gets ignored.
We should look at the E2E test cases in #62824 to add also support for these other two scenarios.
Specifically src/Components/test/E2ETest/Tests/StatePersistenceTest.cs
and src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/PersistentState/PageWithDeclarativeEnhancedNavigationPersistentComponents.razor
Our test could be designed to use a query string to choose to render or not render the components. There would be one component without a key that renders always and a component that gets added/removed depending on the value of the query string.
In both cases the state should be restored successfully