You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ability to add indexes on columns (other than the ID, which is indexed by default) [Ability to index fields? #88]
Index on foreign keys by default, preventing full-table scans for e.g. book.authors (also need to memoize using the indexes – instance-based memoization would be insufficient)
Improve API regarding foreign keys: People use fk() on one side and many() on the other side. Maybe allow this or provide another intuitive alternative. At least warn them that many() is strictly for many-to-many relationships.
Refactor many-many field declaration to allow forward/backward declaration at each Model:
implicit (almost like now, but with ability to declare relation at target model too) or
explicit (without any internal magic, cleaner code, easier to support), breaking changes
Computed fields via attr descriptor? Either store in ref while retaining identity, or provide as model-only fields. views should not have access to sessions and models! [see Virtual fields #58, Reference changes without reason #258]
Keep relation ids in a seperate field instead of overloading it with the relation [#102]
Computed fields via attr descriptor?
And since i guess everybody using redux-orm is doing implementing this in some way:
A simple API for denormalizing (including computed fields / relations etc.)?
Reacted by Neal van der Valk, Timmy Huang, haveyaseen and Austen Morgan
@tiii +1 for the documentation and api for denormalizing (including computed fields / relations). Great to see that this library is getting active again!
On 3 Jun 2017, 10:36 +0300, Neal van der Valk ***@***.***>, wrote:
@tiii +1 for the documentation and api for denormalizing (including computed fields / relations). Great to see that this library is getting active again!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
I think it is best to keep this as a possibility (from above) but have a way simpler API point for this as well such as:
export const getAccounts = createSelector(orm, getOrm, (session) => {
return session.Account.all().toRefArrayWithConnections(); // with a different name for the function
});
Well, we are using this library a lot in our application and I must say, that your case is very limited. E.g. You need only subset of relations where some just array of id, but other - array of reduced version of related model(e.g. Id, title), another one must be indexed by some index field. So many cases. In our application we just created few own createSelectors for most cases with some options to tune selectors.
Probably it's better to create another helper-library for it.
On 3 Jun 2017, 13:48 +0300, Neal van der Valk ***@***.***>, wrote:
@plandem I understood it as this.
Currently when you want to get something out of the orm in a selector with it's relations (in this case questions) you need to do the following
export const getAccounts = createSelector(orm, getOrm, (session) => {
const accounts = session.Account.all().toModelArray();
const enhancedAccounts = [];
accounts.map(accountModel => {
enhancedAccounts.push({
...accountModel.ref,
questions: accountModel.questions.toRefArray()
})
});
return enhancedAccounts;
});
While in the ideal case you could do something like:
export const getAccounts = createSelector(orm, getOrm, (session) => {
return session.Account.all().toRefArrayWithConnections(); // with a different name for the function
});
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@plandem yhea maybe that's better. I just think it is a nice convenience. I'm also using this in my application and I find myself doing this quite often though.
Maybe @tiii has more use cases or another insight on this? :)
@nealoke in our case we created and using next selectors:
createSelector,//unified selector, that creates ORM selector or selector from reselectcreateRecordSelector,//to select single record with query info for relations and etccreateListSelector,//to select all records with query info for relations and etccreateTreeSelector,//to select all records resolved as tree with query info for relations and etccreateGroupedSelector,//to select all records grouped by field, with query info for relations and etccreateMapSelector,//to select all records indexed by id with query info for relations and etc
All these selectors have set of options to tune result. So as I said, your case is very limited. And probably external helper library would be better. Maybe I will publish our version.
Reacted by Neal van der Valk, Guillaume Potier, Mark Erikson and Kristian Gerardsson
I sometimes request multiple nested resources so the selectors to grab them get kind of nasty. But thats rather a problem of poor design on my side. I guess I should use more redux containers.
Nonetheless I am also interested in your selectors and I would say they already seem like some easier API for denormalizing. Why move them to a seperate library?
@tiii separate library, because I'm not sure that it fits here (E.g. in our case we use multi-schema ORM, where some schemas are same, but has differ keys at global state. So it can be project specific). For me it's selector's area. Anyway, right now I'm not ready to make it public yet. Need to revise it :)
On 11 Jun 2017, 15:21 +0300, Neal van der Valk ***@***.***>, wrote:
@plandem Are you also planning to update the redux-orm-propTypes? Or do you think this package is obsolete?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@plandem Only other thing I could think of would be performance testing and potentially incorporating Flow. I don't believe either of them are required for v1 though.
Reacted by Neal van der Valk and Titus Ramczykowski
hey @plandem - just wanted to throw in my 2 cents...regarding " refactor many-many field declaration to allow forward/backward declaration at each Model"
If many to many has forward/backward declaration would the normal foreignkey/hasmany relationships also need to be defined separately on each model as well?
I think having the backwards relationship explicitly defined would be better. I currently have to keep comments in my code alerting other developers that "hey the backwards relationship is on the other model..." :)
@Aryk yep, if explicitly then you will have to define on both models and in case of custom through model it can be verbose :) but...at least no surprises :)
Things have stalled a bit, but yeah, I think we ought to figure out what we really want for a 1.0 and get it out the door. (#158 probably ought to be in there.)
library is using in production for few project at our company - quite huge projects with 20+ models/relations and 15k+ records for some models (not sure about 100k, but in some cases we have much more than 15k records).
Activity
tiii commentedon Jun 2, 2017
Up to date documentation! 😉
Keep relation ids in a seperate field instead of overloading it with the relation [#102]
Computed fields via attr descriptor?
And since i guess everybody using redux-orm is doing implementing this in some way:
A simple API for denormalizing (including computed fields / relations etc.)?
nealoke commentedon Jun 3, 2017
@tiii +1 for the documentation and api for denormalizing (including computed fields / relations). Great to see that this library is getting active again!
plandem commentedon Jun 3, 2017
nealoke commentedon Jun 3, 2017
@plandem I understood it as this.
Currently when you want to get something out of the
ormin aselectorwith it's relations (in this case questions) you need to do the following.I think it is best to keep this as a possibility (from above) but have a way simpler API point for this as well such as:
plandem commentedon Jun 3, 2017
nealoke commentedon Jun 3, 2017
@plandem yhea maybe that's better. I just think it is a nice convenience. I'm also using this in my application and I find myself doing this quite often though.
Maybe @tiii has more use cases or another insight on this? :)
plandem commentedon Jun 5, 2017
@nealoke in our case we created and using next selectors:
All these selectors have set of options to tune result. So as I said, your case is very limited. And probably external helper library would be better. Maybe I will publish our version.
tiii commentedon Jun 9, 2017
@plandem @nealoke
I sometimes request multiple nested resources so the selectors to grab them get kind of nasty. But thats rather a problem of poor design on my side. I guess I should use more redux containers.
Nonetheless I am also interested in your selectors and I would say they already seem like some easier API for denormalizing. Why move them to a seperate library?
plandem commentedon Jun 9, 2017
@tiii separate library, because I'm not sure that it fits here (E.g. in our case we use multi-schema ORM, where some schemas are same, but has differ keys at global state. So it can be project specific). For me it's selector's area. Anyway, right now I'm not ready to make it public yet. Need to revise it :)
I recommend to look for this library: https://github.com/artsy/react-redux-controller
It's small and helped me to reduce the complexity of application.
nealoke commentedon Jun 11, 2017
@plandem Are you also planning to update the redux-orm-propTypes? Or do you think this package is obsolete?
plandem commentedon Jun 11, 2017
NathanBWaters commentedon Jun 12, 2017
@plandem Only other thing I could think of would be performance testing and potentially incorporating Flow. I don't believe either of them are required for v1 though.
NathanBWaters commentedon Jun 12, 2017
@nealoke I'll take on updating https://github.com/tommikaikkonen/redux-orm-proptypes because I want to use it haha.
plandem commentedon Jun 13, 2017
@NathanBWaters agree, that someday we need to tune performance :)
Aryk commentedon Jul 15, 2017
hey @plandem - just wanted to throw in my 2 cents...regarding " refactor many-many field declaration to allow forward/backward declaration at each Model"
If many to many has forward/backward declaration would the normal foreignkey/hasmany relationships also need to be defined separately on each model as well?
I think having the backwards relationship explicitly defined would be better. I currently have to keep comments in my code alerting other developers that "hey the backwards relationship is on the other model..." :)
plandem commentedon Jul 15, 2017
@Aryk yep, if explicitly then you will have to define on both models and in case of custom through model it can be verbose :) but...at least no surprises :)
NathanBWaters commentedon Jul 17, 2017
I really like @Aryk's suggestion, I'm doing the same thing currently with using comments to let others know backwards relationships.
marxus commentedon Jul 18, 2017
@NathanBWaters @Aryk as @plandem said, it's already an option. this is how i do it:
no need to write alerting comments..
Aryk commentedon Jul 19, 2017
@marxus85 - im refering to
fkrelationships. There is no way to define a one-to-many backwards on the other model currently...spachori94 commentedon Oct 13, 2017
@plandem add ability to add indexes on columns (other than the ID, which is indexed by default) definitely needed
michelalbers commentedon Dec 13, 2017
Is this project still alive? Love the simplicity and I think about throwing out realm js for it.
nealoke commentedon Dec 13, 2017
@michelalbers I think it is, however even if it is not that active I already use it in various webapps and it is working like a charm :)
markerikson commentedon Dec 31, 2017
Things have stalled a bit, but yeah, I think we ought to figure out what we really want for a 1.0 and get it out the door. (#158 probably ought to be in there.)
plandem commentedon Dec 31, 2017
library is using in production for few project at our company - quite huge projects with 20+ models/relations and 15k+ records for some models (not sure about 100k, but in some cases we have much more than 15k records).