-
Notifications
You must be signed in to change notification settings - Fork 22
Remove commit and shouldCommit #219
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
Conversation
Interesting timing - I was just considering how those methods might have let me use a Vis.js DataSet as my domain state. Good to know that would have been a bad time performance wise. 🇺🇸 I'm Dan Tello and I approve of this message 🇺🇸 |
@greypants oh that's a super interesting idea though. I'd love to see that. |
I like 👍 |
return Array.from(next.values()) | ||
} | ||
} | ||
``` |
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.
🔥
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.
👍
dd1fd4d
to
a182530
Compare
I've used commit on 3 projects, and I removed it on two of them (and I'd like to remove it on all three). Commit adds a lot of edge cases internally, and requires dependency on other domains in order to be useful. For example, reducing down a dataset to match a specific query. We have indexes and computed props for that now, so the utility is no longer there. Additionally, I want to remove as many use cases from Domains that require external knowledge as possible. I've also removed the ImmutableJS docs for the time being. When we document indexing, we should dig into how to use them with ImmutableJS.
a182530
to
c200903
Compare
I've used
Domain::commit
on 3 projects, and I removed it on two of them (and I'd like to remove it on all three).Why did we add commit?
The original motivation was to make it easier maintain one representation of data inside of a Domain where it is easy to write to, and expose a format easier to query when accessing
repo.state
Why do I want to remove commit?
This worked nice for simple cases, but it has a ton of edge cases. It invites dependency on other domains in order to be useful. For example, reducing down a dataset to match a specific query.
It's also slow, potentially creating new objects where it doesn't need to. Our most recent data viz project, this was the single biggest source of inefficient rendering. It's simply too cumbersome to use
shouldCommit
to check to see if you should calculate state again. Often that depends on UI requirements, which don't belong in the data layer.Also, it removes the amount of knowledge you need to know about domains. The current "special" hook methods are now:
getInitialState
,register
,serialize
,deserialize
,setup
, andteardown
.What to do moving forward
We have indexes and computed props for that now, so the utility is no longer there. Additionally, I want to remove as many use cases from Domains that require external knowledge as possible.
I've also removed the ImmutableJS docs for the time being. When we document indexing, we should dig into how to use them with ImmutableJS. For example: