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

[BUGFIX beta] computed.sort array should update if sort properties array is empty #16632

Merged
merged 1 commit into from
May 16, 2018

Conversation

miguelcobain
Copy link
Contributor

@miguelcobain miguelcobain commented May 13, 2018

Basically, when the sort properties array is empty, computed.sort was returning the original array, but not responding to any changes in that array.
The result was that any computed.sort never changed, even when the dependent array changed.

I hope the (previously failing) test is self explanatory.
Is there a chance we can backport this to previous ember versions?

Please let me know if anything else is needed from me. Thanks!

@miguelcobain
Copy link
Contributor Author

Failure is related to a Browserstack issue.

@@ -1297,6 +1297,29 @@ moduleFor(
);
}

['@test array should update if sort properties array is empty'](assert) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you update this title to be @test array should update if items to be sorted is replaced when sort properties array is empty, and then add a second test as @test array should update if items to be sorted is mutated when sort properties array is empty?

'array is not changed'
);

set(o, 'items', emberA([5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4]));
Copy link
Member

Choose a reason for hiding this comment

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

This test is testing "replacement" of items, not mutation.

Can you add another test that does o.get('items').pushObject(...)?

@miguelcobain
Copy link
Contributor Author

@rwjblue feedback was applied 👍

@rwjblue rwjblue merged commit d50242c into emberjs:master May 16, 2018
@rwjblue
Copy link
Member

rwjblue commented May 16, 2018

Thank you!

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.

2 participants