-
Notifications
You must be signed in to change notification settings - Fork 789
Performance improvements, and better lifecycle support #51
Conversation
I think I would prefer
What does this mean? |
@jbaxleyiii wait, did we ever decide that rebuilding the mutation functions on each re-render wouldn't work? Is there a downside to that approach, which wouldn't require changing the API to add extra arguments? |
@stubailo since we rerun the I can rebuild the mutation functions on each re-render (I have it mostly done). The reason I diverged from that to the mapMutationsToProps = () => ({
action: (my, args) => { // MutationObject }
})
// vs unused `{ ownProps, state }`
mapMutationsToProps = () => ({
action: ({ ownProps, state }, my, args) => { // MutationObject }
}) Thoughts? |
2a9f5d8
to
3b14705
Compare
Thx for the update. Any interface that you guys decide is just great, but if I was to do it maybe would be with something like: const mapMutationsToProps = () => ({ state, ownProps }) => ({
action: (my, args) => { ... }
}); It is much closer to the original one, it feels more natural... Also, arguments called in runtime |
Thanks for the feedback! I think that's one of the points behind this change in my mind. Keeping it as the current API is possible! I'll do a comparison branch and try to add in a performance test to see if my concerns about rebuilding the mutations each time is valid or not! (We are rebuilding queries each time so it's probably nothing!) |
Ehhh, I'll just rewrite to keep the same API. The plumbing is there already and the execution won't be that much, if any perf loss. |
Sounds good to me! |
mapMutationsToProps?(opts: MapMutationsToPropsOptions): any; // Mutation Handle | ||
mergeProps?(stateProps: Object, dispatchProps: Object, ownProps: Object): Object; | ||
mapQueriesToProps?(opts: MapQueriesToPropsOptions): Object; // WatchQueryHandle | ||
mapMutationsToProps?(opts: MapQueriesToPropsOptions): Object; // Mutation Handle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this now MapQueriesToPropsOptions
instead of MapMutationsToPropsOptions
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha because I copy pasted wrong. Thanks!
@jbaxleyiii looks great to me! |
I think something broke =[. When I upgrade to
|
Could this be deep equal failing on a circular reference or something? |
@deoqc could you make a reproduction repo I can debug? |
It may be a circular reference, or the way I'm rebuilding queries when props / state change is getting stuck in a loop |
Also @deoqc can you post a new issue for this? |
@deoqc that's definitely a bug! |
This PR does a few things (it can be split up if needed).
mapMutationsToProps
rebuild on changeFixes #41 and #20
cc @stubailo @johnthepink