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

Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error. #14

Open
vincejairam opened this issue Sep 10, 2023 · 9 comments
Assignees

Comments

@vincejairam
Copy link

I am using Blazor Server and followed the instructions on setting this up e.g. this was added to main, where I essentially copy the sample LocalStateStorage class

builder.Services.AddBlazoredLocalStorage();
builder.Services.AddScoped<IStringStateStorage, LocalStateStorage>();
builder.Services.AddScoped<IStoreHandler, JsonStoreHandler>();

builder.Services.AddFluxor(config =>
{
    config
        .ScanAssemblies(typeof(Program).Assembly)
#if DEBUG
        .UseReduxDevTools(rdt =>
        {
            rdt.Name = "MY APP";
        })
#endif
        .UsePersist()
        ;
});

When I start my app, I see the error at the top of the page "Attempting to reconnect to the server: 1 of 8" the console has the following error "[2023-09-10T17:05:49.166Z] Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error.'.
log @ blazor.server.js:1
"
The page eventually loads and I can see my view, data has loaded, store is created in localstorage. I now click on a detail page for an item or navigate to another page etc. same error etc.

Am I missing something for the setup? Does this work with Blazor Server vs Blazor WASM? I am using "Fluxor Version="5.9.1" and Blazored.LocalStorage" Version="4.4.0"

@vincejairam
Copy link
Author

vincejairam commented Sep 10, 2023

Also please confirm, I want all my stores or most of them to be stored in local storage and DO NOT want Fluxor to use in memory for the stores that I want to utilize for local storage any more, that is the intent of this library correct?

@Tailslide
Copy link
Owner

I haven’t tested with Fluxor 5.9.1 since I can’t find any information on what changed in that release.

Is Fluxor working in your project if you do not use Fluxor.Persist?

Does the sample blazer server project in this repo work for you with Fluxor 5.9.0?

This library lets you persist a copy of the state (typically in local storage but could also be elsewhere). You can persist all state or just the states you flag. There is still a copy in memory. If you have a large amount of data you don’t want in memory you should be looking at indexedDb.

@vincejairam
Copy link
Author

Hi @Tailslide , thanks for the quick response. Yes when I comment out the line for UsePersist the app works with no issues. I haven't tried 5.9.0 with the sample application. I did download and run the sample app with no issues. I also change my version to 5.9.0 as I taught it might be an issue as the your docs indicate support at 5.9.0 level but it was still giving me the same issue.

I would like however to get rid of the in copy memory from Fluxor as its quite large, that was the main reason at looking at this package. I've never used indexedDb would that be a addon to Fluxor or a replacement all together....

@Tailslide
Copy link
Owner

Fluxor Persist will not solve your memory problems even if we get it working on your project.

IndexedDb is a completely different system than Fluxor. It is a database built into the browser you can inspect it with F12 from the browser. Here is a library for it:

https://github.com/amuste/DnetIndexedDb

The author disappeared so here is a fork and .NET 7 nuget I made of it:
https://github.com/Tailslide/DnetIndexedDb/tree/newpublish.
There might be other packages for it too if you search around.

If you have just certain states that are huge you might want to move those states from Fluxor to IndexedDb but then they will of course not be Fluxor states anymore.

@vincejairam
Copy link
Author

Hi @Tailslide , thanks for the clarification and information, much appreciated.

@Tailslide
Copy link
Owner

Did you ever get this working? If you're still stuck since the sample is working for you just gradually copy your project into the sample project and keep testing after each page/state to make sure it doesn't break.

@Tailslide
Copy link
Owner

Feel free to re-open this issue or open another issue if you need more help.

@danik121
Copy link

danik121 commented Mar 14, 2024

Same problem. FLuxor version 5.9.1. Sample code is not working

@Tailslide
Copy link
Owner

Ok I will take a look when I get a chance

@Tailslide Tailslide reopened this Mar 21, 2024
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

3 participants