Closed bryanspears closed 3 years ago
I don't think ampersand-state
should define how ampersand-collection
initializes. Collection is just another type, but unlike other simple types (e.g. 'string' and 'number') it defines its own get/set methods and more. Throwing an error based on dynamic data could be a problem.
My thought is when new Collection()
is executed it should always result in a valid, working collection object. Especially since it can be a child of a State
object. Which means it needs to be more forgiving in all the null
, undefined
, or other situations and just initialize with []
.
I wonder if
null
should be rejected (throw) as an initial value for states.In any case, I'll try to review this PR this weekend.