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 IEnumerable.Union() result being discarded in ContentByQuerySearchTransformator #296

Merged
merged 1 commit into from
May 3, 2021

Conversation

jackpoz
Copy link
Contributor

@jackpoz jackpoz commented Apr 30, 2021

This PR fixes a typo where the result of IEnumerable.Union() is discarded. The author probably assumed this LINQ method was going to modify the collection itself but it actually returns a new collection.

In this particular case the first collection is always empty, so it's enough to just assign the variable to the second collection.

List<ContentType> cts = new List<ContentType>();

Another way could be to assign the result of Union() to the variable cts .

Please note that I'm not familiar with how this part of the code is used or how to test it but it looks like a small change only.

@jansenbe
Copy link
Contributor

jansenbe commented May 3, 2021

Good catch, thanks for sharing @jackpoz

@jansenbe jansenbe added the area: page transformation 🦾 Page transformation issue or pull request label May 3, 2021
jansenbe added a commit that referenced this pull request May 3, 2021
@jansenbe jansenbe merged commit a1ac82e into pnp:dev May 3, 2021
@jackpoz jackpoz deleted the fixes/linq-union branch December 4, 2022 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: page transformation 🦾 Page transformation issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants