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

Fix incorrect path modification in dom-repeat __handleObservedPaths() #5048

Merged
merged 2 commits into from
Jan 23, 2018

Conversation

MajorBreakfast
Copy link
Contributor

Fixes #4983

The path modification is wrong. The path is already modified in __handleItemPath()
https://github.com/Polymer/polymer/blob/master/lib/elements/dom-repeat.html#L649

This causes the sort and filter to fail if a nested property is modified, e.g. 'items.1.prop.nestedProp'. The current code gets the already modified 'prop.nestedProp' and incorrectly modifies it to nestedProp.

@kevinpschaaf

@TimvdLippe
Copy link
Contributor

Please add a regression test so we can verify the original issue remains fixed.

@MajorBreakfast MajorBreakfast force-pushed the dom-repeat-observed-path-fix branch from deebf91 to 2f06deb Compare January 16, 2018 14:56
@MajorBreakfast
Copy link
Contributor Author

There you go.

BTW the test suite for dom-repeat is over 4000 lines and of code. Would it be alright if I broke it up into multiple files in another PR? (not today, but sometime in the future) I'm thinking of one file per custom component and one file per suite. I'm not a big fan of long files because it leads me to waste a lot of time trying to find where I just left off.

@MajorBreakfast MajorBreakfast force-pushed the dom-repeat-observed-path-fix branch from 2f06deb to 54aa3c2 Compare January 16, 2018 15:08
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.

We generally keep it in one file if it concerns one feature. I think it is okay for now to keep it like this, to not overflow the tests directory.

is: 'x-repeat-filter-and-sort-by-nested-property',
properties: {
items: {
value: [
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be function() { return [...]; }

Copy link
Contributor Author

@MajorBreakfast MajorBreakfast Jan 16, 2018

Choose a reason for hiding this comment

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

May I use ES2015 style value () { return []; }?

@MajorBreakfast MajorBreakfast force-pushed the dom-repeat-observed-path-fix branch from 54aa3c2 to e72e90d Compare January 16, 2018 15:20
@MajorBreakfast
Copy link
Contributor Author

@TimvdLippe I was thinking about a folder ;)

@MajorBreakfast
Copy link
Contributor Author

safari 11.0.2            Tests passed
firefox 57               Tests passed
chrome 62                Tests passed

@MajorBreakfast
Copy link
Contributor Author

Ready to merge: It fixes a bug in Polymer that the tests previously didn't cover

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.

Implementation and test look good. We have to fix #5050 first and then we can merge this one

@MajorBreakfast
Copy link
Contributor Author

@TimvdLippe Ah okay. Thx for the update :)

Copy link
Member

@kevinpschaaf kevinpschaaf left a comment

Choose a reason for hiding this comment

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

Awesome fix, @MajorBreakfast and @michalsukupcak. Thanks for the contribution.

@dfreedm dfreedm merged commit 4b58f54 into Polymer:master Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants