Blazor parent does not update chilld

I`m using Fluxor for state management for my NET8 Blazor WASM app. My parent component passes down state from the store to the child component via an input parameter.

parent

@page "/people"
@inherits Fluxor.Blazor.Web.Components.FluxorComponent
@inject IState<PeopleState> _state

<ShowPeople Requests="_state.Value.People.ToArray()"></ShowPeople>

child

@foreach(var person in People)
{
    <div>@person.Name</div>
}

@code {
    [Parameter] public Person[] People { get; set; } = [];
}

state excerpt

public record PeopleState
{   
    public bool IsLoading { get; init; }
    public bool IsLoaded { get; init; }
    public string? Error { get; init; }
    public DateTimeOffset LoadedAt { get; init; }

    public List<Person> People { get; init; } = [];
}

public class PeopleFeatureState : Feature<PeopleState>
{
    public override string GetName() => nameof(PeopleState);
    protected override PeopleState GetInitialState() => new();
}

public record RejectPerson(string Id);
public record RejectPersonSuccess(string Id);
public record RejectPersonFailure(string Error);
//...

public static class PeopleReducer
{
    [ReducerMethod] public static PeopleState HandleRejectPerson(PeopleState state, RejectPerson _)
    {
        return state with { IsLoading = true };
    }
    [ReducerMethod] public static PeopleState HandleRejectPersonFailure(PeopleState state, RejectPersonFailure action)
    {
        return state with
        {
            IsLoading = false,
            Error = action.Error
        };
    }
    [ReducerMethod] public static PeopleState HandleRejectPersonSuccess(PeopleState state, RejectPersonSuccess action)
    {
        return state with
        {
            IsLoading = false,
            People = [.. state.People.Where(u => u.Id != action.Id)] //remove person
        };
    }
    //...
}


public class PeopleEffects(IState<PeopleState> state)
{
    [EffectMethod] public async Task OnRejectPerson(RejectPerson action, IDispatcher dispatcher)
    {
        string id = action.Id;

        try
        {
            var http = new HttpClient();
            HttpResponseMessage resp = await http.DeleteAsync($"people/{id}");
            if (!resp.IsSuccessStatusCode)
            {
                throw new ApplicationException("error");
            }

            dispatcher.Dispatch(new RejectPersonSuccess(id));
        }
        catch (Exception ex)
        {
            dispatcher.Dispatch(new RejectPersonFailure(ex.Message));
        }
    }
    //...
}

The state is a list of people that can be approved or rejected (user signups). When a RejectPerson action is dispatched, I can see it happening in the Redux DevTools and there the state also updates. But in the UI the child component does not change.

I also tried forcing a refresh when explicitly listening the relevant event, but it also didn’t work.

protected override void OnInitialized()
{
    base.OnInitialized();
    ActionSubscriber.SubscribeToAction<RejectPersonSuccess>(this, (action) => StateHasChanged());
}

Though I know, I can just inject the state in the child and this works, I need to understand why it doesnt work when using an input parameter. Any ideas?

Also what completely puzzles me, is that an action triggering the following reducer correctly updates the state and UI. LoadPeopleStateSuccess does a round-trip to the database and gets all data. Basically the same as is done when the parent is loaded.


public record LoadPeopleState(bool Force = false);
public record LoadPeopleStateSuccess(Person[] People);

[ReducerMethod] public static PeopleState HandleLoadPeopleStateSuccess(PeopleState state, LoadPeopleStateSuccess action)
{
    return state with
    {
        IsLoading = false,
        IsLoaded = true,
        People = [.. action.People],
        LoadedAt = DateTimeOffset.UtcNow
    };
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật