mrpmorris / Fluxor

Fluxor is a zero boilerplate Flux/Redux library for Microsoft .NET and Blazor.
MIT License
1.22k stars 139 forks source link

Blazor dot net 8 server interactive component does not re-render when state changes via redux tools time travel #494

Closed AddictArts closed 3 weeks ago

AddictArts commented 3 weeks ago

Hi,

I have a server interactive Blazor app. I have some components that do detect the time travel state changes of redux tools. For example Telerik Grid does. However a simple child component that takes a List of a simple class that has simple data does not re-render. The child has a foreach looping over the list and rendering simple html.

I can't find anything that explains why the Telerik grid re-renders as expexted, but the simple componet does not.

OnParameterSet is when moving back in time, then moving forward again it is not called for that child component.

AddictArts commented 3 weeks ago

To answer and provide reference for anyone else hitting this.

Using an interface for a parameter to pass data was the main issue.

interface IFoo
{
  string bar = "";
}

Parent;

<Child Foo="@State.Value.Foo">

Child:

@foreach (var foo in foos) { ... }

@code {
  [parameter]
  public List<IFoo> foos = [];
}