You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this feels dirty, but this way, state is properly tied to each object instance, not to some closure shared by all instances of a factory. And we could always put in some assert to ensure the additional property names aren't colliding, and tell off the user if they are.
The text was updated successfully, but these errors were encountered:
The Problem
Suppose you are writing code for some DS.Model using
computedPromise
Aside from the infinite loop notification problem as mentioned in #132 (comment)
There is another issue regarding different instances of an object sharing the same result state.
The Reason
From the code at:
https://github.com/cibernox/ember-cpm/blob/master/addon/macros/computed-promise.js#L41
We see that both
pendingPromise
andresult
are declared outside the computed property, which means if you have something like:That is, even though we have two distinct instances of the
IssueThread
, they both share theresult
state... which is definitely a bugMy Humble Suggestion
Please consider just putting
pendingPromise
andresult
directly into the object instance, i.e.:Yes, this feels dirty, but this way, state is properly tied to each object instance, not to some closure shared by all instances of a factory. And we could always put in some
assert
to ensure the additional property names aren't colliding, and tell off the user if they are.The text was updated successfully, but these errors were encountered: