-
Notifications
You must be signed in to change notification settings - Fork 22
Rename "store" to "domain", make accessible via Microcosm instance #127
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
src/microcosm.js
Outdated
|
||
for (const domain of this.domains) { | ||
const [key, config] = domain | ||
if (key) { |
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.
Should we warn if there are duplicate domains?
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.
Maybe even throw?
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.
A warning feels appropriate. Maybe there is a legitimate use case for overwriting a domain?
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.
duplicate/overwrites were allowed before with the metaStore (by calling addStore
with no key
argument, once could replace the default metaStore). Is that something we want to continue to allow?
I don't want to let this get too cold. Generally, big 👍 for a new name. Store is a relic of adhering to Flux nomenclature, which was important at the time, but Still thinking through the last part, with the |
@nhunzaker curious what you think about this map-based approach I just pushed up |
|
||
this.stores = this.stores.concat([[ key, config ]]) | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (key && this.domains.has(key)) { |
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.
added this in for warning about duplicates, but only if a key is present
@ltk Hesitant to require a |
Insertion order... right. Very... very important. |
@ltk Do you mind if I reconcile the conflicts here and remove the |
dont mind at all. |
Invalidated in favor of #146 |
This is just a conceptual proposal, not a final implementation.
What if 'stores' were called 'domains', and were conceptually more important?
'Store' is kind of a misnomer strictly speaking at the moment. Instead I suggest that we think instead about 'Domains', which can be thought of as representing all state management logic for a given business/application domain.
A domain looks just like an existing store, however conceptually it should include domain actions, and the entire domain object is made available via the microcosm instance.
Using domains: