Closed samuelsimoes closed 8 years ago
Like discussed on chat, let first fix this with a more simple approach, computing subsets before computed properties (https://github.com/fluxo-js/fluxo/commit/f2c7c8aface54906c58f5cf5b5b845a786ca874f), if this kind of dependency managment turns into a necessary thing, we reconsiders.
I just have an epiphany moment to fix this issue, not that I had this problem recently but I really think the Fluxo's first computation on store construction is inconsistent with what happen on the subsequent state mutations, so I thought on a little tweak that could address this issue.
The basically idea is:
Fluxo.ObjectStore#set
on the constructor.Fluxo.CollectionStore#setStores
on the constructor (if it's a collection).Take a look in the branch https://github.com/fluxo-js/fluxo/compare/smart-first-computation.
What do you think?
Today, the subsets are computed on the store construction after the computed properties first compution. This works for most of cases, but you could get on this kind of situation:
We can easily fix this computing subsets first on the construction, but Isn't hard imagine situations where subset can depend on some computed property.
I think we need a way to compute every computed property and subset on first object construction computing the dependencies first.
I already tried something, but it doesn't look a simple task to get this with elegant code.