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

IndexedDB agent #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TiemenSch
Copy link

I went ahead and took the plunge for an IndexedDB worker crate using yew-agent and also added a small example.

However, something is off with deserialization and I can't seem to find it.

intendednull and others added 3 commits October 10, 2023 02:59
Signed-off-by: Tiemen Schuijbroek <t.j.l.schuijbroek@ratio-case.nl>
Signed-off-by: Tiemen Schuijbroek <t.j.l.schuijbroek@ratio-case.nl>
@TiemenSch
Copy link
Author

Well, deserialization was just a simple mistake to fix.

The Cargo.toml changes are related to some weird Hook impl errors on the examples. Not sure what is going on there.

The current basis is more or less a generic IndexedDB worker I drummed up. I could even put that in it's own crate, because it isn't really yewdux specific at all. I'm kind of on the fence between the current BTreeMap for put actions and a more generic FIFO vector approach that would work through all messages instead of the latest one per pointer. I think the Map approach makes sense for Yewdux' serialization since you wouldn't want to do any redundant PUT cycles.

However, the part that is glaringly missing is a more sensible way for Store initialization and a dedicated listener for the IndexedDB way of things. The example's dummy component method is a tad bit hacky (:

What do you think?

@intendednull
Copy link
Owner

Haven't had time yet for a thorough review, but I like the idea! Maybe it would be possible to connect a store to the db worker, so it will automatically sync changes.

Will get back with a more detailed response when I have some time to dive in. Thanks for your contribution!

@TiemenSch
Copy link
Author

I've been toying around with the idea to generalize the WebWorker part in a separate crate (MIT/Apache) this week.

I.e. extracting the job shop/queue part for different strategies.

I'll link to it when I get to it, but depending on what you prefer for yewdux you're free to copy/use and adapt the code directly instead of adding a dependency.

@intendednull
Copy link
Owner

That might be better tbh. We can always add an adapter here, but I think DB management itself might be stretching this projects scope

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

Successfully merging this pull request may close these issues.

2 participants