-
Notifications
You must be signed in to change notification settings - Fork 595
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
State should be able to be an array #23
Comments
Hmm, I think this ties further into whether or not non-objects should be supported at the top level. If you're not using namespaces it should diff just fine. We could probably detect if an obj Just to verify, what you're trying to achieve is: app.model({
namespace: 'tables',
state: [],
reducers: { /* things go here */}
}) Given the approach I'm proposing, this should be possible too: app.model({
namespace: 'something',
state: 'foobar',
reducers: {
update: (state, action) => state + 'bar' // 'foobarbar'
}
}) does this make sense? edit: fixed typo as per comment below |
That's right. Of course |
hah, you're right - derp. Fixed! |
I reckon this should land in |
Hmmm, I think arrays should perhaps be the only ones that can exist in the top level scope too; adding all other types throws us down JS type equality hell, which def isn't where we want to be. |
yeah feel like this might be the solution to models troubles (: - well, if we add some docs and patterns too - selectors feel like v. useful - probs if we add plugins too we could do some amaze things C: |
Closing because |
I have a "tables" model that's a collection of tables. I would expect to be able to set my
state
property to an array within thetables
namespace
and the resulting global state look like:{ app: {}, tables: [] }
as it would in redux. Instead, if you set thestate
to an empty array, it's not included in the global state. If you set it to an array with a value, it gets set to{tables: {0: 'that value'}}
.Not a big deal, just thought I'd point it out. At first glance I imagine it could be an issue with
apply
orxtend
.The text was updated successfully, but these errors were encountered: