Code Monkey home page Code Monkey logo

fluxor-persist's People

Contributors

240026763 avatar anddrzejb avatar davidnajar avatar lk-smit-ag avatar minhhieugma avatar tailslide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fluxor-persist's Issues

"double" serialization / deserialization issue

Hi,

I've got a strange issue.

The middleware was not able to rehydrate simple object
... The JSON value could not be converted to Sudoku.Store.Counter.StateCounter ...

I succeeded to overcome the issue by updating the method LocalStateStorage.GetStateJsonAsync

The problem seems coming from await LocalStorage.GetItemAsStringAsync(statename)

That I replaced successfully by await LocalStorage.GetItemAsync<string>(statename)

Sincerely,

Loosing state on navigating away

Hi, This is a really great library and i feel like it will solve my issue just need one affirmation. This is more of a question really. I am starting out on blazor and am using fluxor for my state management. Everything works fine but when i navigating away from a component i loose all the state, is that expected behavior when using fluxor? and i mean navigating away and not a page refresh. I believe in blazor on navigating away the component is usually destroyed and a new one created meaning all state will be lost. I figured Fluxor will help maintain the state but it seems thats not the case or there could be something i am missing?

regards

Prioritize State Loading

Is your feature request related to a problem? Please describe.
I'm using LocalStorage to persist my data and I've got an issue where I need a certain feature's state to be loaded before any others because it is used in the key of the others. Example: ZState needs to load before "LastUserSelectionState" because I'm storing things with keys like: "{authorized user}\{ZState.Value}\{LastUserSelection.Value}".

Currently, the features are loaded in alphabetical order by feature type full name. So ZState would load after LastUserSelection and therefore doesn't load LastUserSelection correctly.

Describe the solution you'd like
It would be great to have a feature priority level attribute. If I have a [FeatureState] class or record, I could have another attribute like [FeatureState, PriorityLoad(1)] where "1" denotes the priority level highest (1) to lowest (int max value).

Describe alternatives you've considered
The only other solution I can think of here is to name them alphabetically to prioritize them which is a naming convention snafu and a special rule that has to be remembered/documented.

Additional context
The issue code:

foreach (IFeature feature in Store.Features.Values.OrderBy(x => x.GetName()))

Fluxor persist not usable in non blazor projects

Is your feature request related to a problem? Please describe.

I'm currently sharing the same codebase between a blazor and Xamarin app. The MVVM library uses fluxor to do the state management, but as fluxor persist targets net6 this can't be added to the netstandard shared library

Describe the solution you'd like

Fluxor.Persist should target netstandard2.0, same as Fluxor itself

Describe alternatives you've considered

Of course when .NET maui is released (net6.0) this will not be an issue for mobile apps

Additional context

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

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"

Potential for persisting with IndexedDB?

This is a great library btw and I've been using it extensively.

Probably a little too extensively ๐Ÿ˜…, because I'm having issues with the smaller local storage limits on mobile devices - or maybe the smaller limits on individual entries in local storage?

This is something I'm happy to have a go at when I have the time, but I wanted to get your quick take first:

Do you think there'd be any issues implementing this with persisting to IndexedDB instead of local storage?

I've been using your example implementation of IStringStateStorage but I assume it would just be a matter of implementing this to target IndexedDB? I've not used IndexedDB before and I'm not sure if it can take the sort of 'Bulk Insert' that might be necessary to be sufficiently performant.

But from this answer, it seems like it should be possible, at least back in 2018: Stack overflow answer

So it looks doable. But before I give it a go, have you any thoughts I should consider?

Many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.