Skip to content
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

Ensure re-sort/filter always happens after array item set. Fixes #3626 #4942

Merged
merged 2 commits into from
Nov 22, 2017

Conversation

kevinpschaaf
Copy link
Member

@kevinpschaaf kevinpschaaf commented Nov 17, 2017

Previously, this.set('items.1', {...}) did not cause a re-render when sorted/filtered, even if paths were observed. This fixes the bug by ensuring that changing the entire item always causes a re-sort/filter.

Reference Issue

Fixes #3626
Fixes #3254
Fixes #3247

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 small nits. Other than that LGTM

@@ -456,13 +456,19 @@
}

__handleObservedPaths(path) {
if (this.__observePaths) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the condition was only on this.__observePaths. Is there a case where this.__sortFn and this.__filterFn are both falsy, but this.__observePaths is truthy? In that case, this would regress, as the condition is no longer hit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, observe (which sets __observePaths) is only relevant when using sort and/or filter so this seems ok.

// Handle cases where path changes should cause a re-sort/filter
if (this.__sortFn || this.__filterFn) {
if (!path) {
// Always re-render if the item iteself changed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/iteself/itself

@sorvell sorvell merged commit c42199c into master Nov 22, 2017
@sorvell sorvell deleted the 3626-kschaaf-repeat-refresh branch November 22, 2017 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants