Skip to content

ReduceComputedProperty ignore invalidated property observers.#3364

Merged
wagenet merged 1 commit intoemberjs:masterfrom
hjdivad:fix-3273
Sep 10, 2013
Merged

ReduceComputedProperty ignore invalidated property observers.#3364
wagenet merged 1 commit intoemberjs:masterfrom
hjdivad:fix-3273

Conversation

@hjdivad
Copy link
Copy Markdown
Member

@hjdivad hjdivad commented Sep 9, 2013

It can happen that several reduce computed properties depend on the same
items, because the same items are shared between computed arrays. This will
often be the case with filter/sort chains, for instance. When they depend on
the same item properties it can happen that an item property change is
registered for a downstream array, but a different item property observer
invalidates the change.

For example, changing the priority on an item may cause it to be resorted.
This resorting will result in it being removed and reinserted into a
downstream filtering. However, the original priority change also triggered
an observer to update the filtering: an observer that has been invalidated by
the changes resulting from its being resorted.

  • Properly invalidate such observers.
  • Also update indexes even more lazily, during flushChanges.

Fix #3273.

@hjdivad
Copy link
Copy Markdown
Member Author

hjdivad commented Sep 9, 2013

cc @ssured in case you're curious about the fix to the bug you had identified.

@hjdivad
Copy link
Copy Markdown
Member Author

hjdivad commented Sep 9, 2013

ah sorry @ssured; see the other PR i cc-d you on. This is an unrelated issue.

@ssured
Copy link
Copy Markdown
Contributor

ssured commented Sep 9, 2013

No problem. Its cool too see this superpower feature getting more <3!

@hjdivad
Copy link
Copy Markdown
Member Author

hjdivad commented Sep 9, 2013

Yeah, I'm really excited that people are already using it enough to identify these deficiencies so we can improve it quickly. ^_^

On a related note you can see #3365 for a new feature to work better with item controllers.

There's another thing I need to do to make it easier to refer to multiple item properties in a bash-like syntax, but sadly no PR yet.

@mixonic
Copy link
Copy Markdown
Member

mixonic commented Sep 10, 2013

@hjdivad "the fix to the bug you had identified", this bug? #3332

@ssured
Copy link
Copy Markdown
Contributor

ssured commented Sep 10, 2013

@mixonic: no, its about #3331

For #3332 we first have to determine if its a feature or a bug...

…rvers.

It can happen that several reduce computed properties depend on the same items,
because the same items are shared between computed arrays.  This will often be
the case with filter/sort chains, for instance.  When they depend on the same
item properties it can happen that an item property change is registered for a
downstream array, but a different item property observer invalidates the change.

For example, changing the priority on an item may cause it to be resorted.  This
resorting will result in it being removed and reinserted into a downstream
filtering.  However, the original priority change also triggered an observer to
update the filtering: an observer that has been invalidated by the changes
resulting from its being resorted.

- Properly invalidate such observers.
- Also update indexes even more lazily, during `flushChanges`.

Fix emberjs#3273.
wagenet added a commit that referenced this pull request Sep 10, 2013
ReduceComputedProperty ignore invalidated property observers.
@wagenet wagenet merged commit 0431d82 into emberjs:master Sep 10, 2013
@hjdivad hjdivad deleted the fix-3273 branch September 24, 2013 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array Computed: Exception and odd behavior when filtering a sorted array

4 participants