Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluxor Not Working With .NET 8 Blazor App Boilerplate SLN #512

Open
zeus82 opened this issue Oct 28, 2024 · 1 comment
Open

Fluxor Not Working With .NET 8 Blazor App Boilerplate SLN #512

zeus82 opened this issue Oct 28, 2024 · 1 comment

Comments

@zeus82
Copy link

zeus82 commented Oct 28, 2024

I tried using fluxor in a blazor 8 template app and my ReducerMethod aren't being called. I replaced the 'Counter' with a Fluxor State.

I added <Fluxor.Blazor.Web.StoreInitializer /> to the top of the Routes.razor files and I added <script src="_content/Fluxor.Blazor.Web/scripts/index.js"></script> to the App.razor file.

I added Fluxor to my services like this on the server

            builder.Services.AddFluxor(options => options.ScanAssemblies(typeof(Program).Assembly));
            builder.Services.AddFluxor(options => options.ScanAssemblies(typeof(Client._Imports).Assembly));

and like this on the client:

            builder.Services.AddFluxor(options => options.ScanAssemblies(typeof(Program).Assembly));

The component in question has @inherits Fluxor.Blazor.Web.Components.FluxorComponent - its the Counter component in the client project.

Is there something else I need to do? Here is a repo with my sln: https://github.com/zeus82/FluxorAsp8

@StefanLochauMF
Copy link

I recently ran into a similar issue and found that multiple calls to AddFluxor seem to overwrite each other's features. I'm not sure if the overwriting is by design.

That is, it might be a solution for you by using just one call to AddFluxor like so:

builder.Services.AddFluxor(options =>
    options.ScanAssemblies(typeof(Program).Assembly, typeof(Client._Imports).Assembly));

// or 

builder.Services.AddFluxor(options => 
    {
        options.ScanAssemblies(typeof(Program).Assembly);
        options.ScanAssemblies(typeof(Client._Imports).Assembly);
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants