Tailslide / fluxor-persist

Fluxor-persist is a library to persist Fluxor states.
MIT License
25 stars 13 forks source link

Potential for persisting with IndexedDB? #15

Closed zola-25 closed 9 months ago

zola-25 commented 1 year ago

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

Tailslide commented 1 year ago

@zola-25 Glad you are finding it useful! I think this is a great idea.. hopefully there is some Blazor library around that can do this now.. as you can see from this issue I posted in IndexedDb library awhile back I was looking for the same thing:

https://github.com/amuste/DnetIndexedDb/issues/44

The author disappeared so here is a fork and .NET 7 nuget I made of it: https://github.com/Tailslide/DnetIndexedDb/tree/newpublish.

Looks like someone made a blazor wrapper for dexie here? Never used it. https://github.com/b-straub/DexieNET

For large amounts of data I ran into performance issues with JSON serializing in blazor 5.0 hopefully things are faster now. I also looked at gRPC with .net into blazor and it was waaay faster. A person could also play with AOT compiling which might speed up serializing.

zola-25 commented 1 year ago

Oh awesome, I'll take a look, yes I think I glanced at that library a while back but never used it, for the exact reason in your issue (no bulk insert/update)..

There's also a huge number of native browser functions made available by https://github.com/LostBeard/SpawnDev.BlazorJS, including IndexedDB, although the documentation is very limited. People seem to like the library though.

I'll see what I can do 🙂

Tailslide commented 9 months ago

I starred spawndev it looks useful.. I'm going to close this issue but feel free to open another one if you want to discuss something specific about this.