-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
ObservableGroupMap for Map to Arrays #314
Comments
What is the key for your map? Could you flip it around by just having an array as a base and having your cells map be another ObservableGroupMap? |
The key for the cell map is id. Can't use an array as the base since we're dependent on map for getting and deleting cells by id. Is there a performant way of taking an observable map and having a derived observable array of map values that we can use as the base to ObservableGroupMap? Feel like a close analogy is how you can create indices on tables in SQL databases: |
Can't think of an out-of-the-box of doing this currently. Implementing your own shouldn't be much work though, take a look at https://github.com/mobxjs/mobx-utils/blob/master/src/ObservableGroupMap.ts for inspiration. |
Yah I've managed to make a slight change to Now I'm just running into a problem mentioned in #284 with Storing Storing |
@NaridaL Closed the issue but would love feedback if you have time, specifically whether to keep enhance or dehanced values in the group arrays. I don't have as experience with mobx as you do |
I'm currently using mobx-state-tree and have a map of objects that look like
I would like to create arrays that effectively index on
colId
androwId
and which are cached as long as the entries remain the same.I'm running into an performance issues with mobx-state-tree (mobxjs/mobx-state-tree#1994) where arrays are not cached since MST doesn't allowed for custom computed; and where using mobx computed is also too slow.
Fastest way to index on an attribute is to use
observe
, so I'm wondering if anyone has built aObservableGroupMap
util for Map to Arrays.Is there a util in
mobx
ormobx-utils
that can be similar to this API?The text was updated successfully, but these errors were encountered: