-
Notifications
You must be signed in to change notification settings - Fork 346
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
feature: Multiple indices in EntityStore #43
Comments
Actually you can do it easily with the selectAll({ filterBy: entity => entity.tags.includes(tagId) }) As for the performance, I don't think there should be a significant problem. Browsers are highly optimized when it comes to |
Thanks. You are right, this might be a case of premature optimization. It does have its place though, when you handle larger amounts of normalized data, especially on less powerful clients. |
Agree, but I think it's hard to develop something that will satisfy all cases. |
I think that your case is very good example for the document @j2L4e then should we close this issue? |
Yes. Closing for now. |
There's Relational Pouch so if the store is persisted to pouchdb it might be a good solution performance wise. Hoping to get time to play with it soon. |
edit: I just realized, this isn't the best example, because you could already have the needed index in the
tags
EntityState. But you get the gist.Example: you might want to look up items by a tag that's attached to it. Say we have an EntityStore with
items
where each item can have one or several tags (by id, assume a normalized state).The resulting State looks like this:
Filtering or finding items by tag is cumbersome and slow. It'd be nice to get the possibility of indexing items by one or more keys different from
id
to get a state similar to this one:Implementing this reactively isn't feasible as you'd have to either diff or reindex the entire thing on every state change.
The text was updated successfully, but these errors were encountered: