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: prevent modification of the FindOptions.relations #7887

Merged

Conversation

imnotjames
Copy link
Contributor

@imnotjames imnotjames commented Jul 11, 2021

Description of change

because of how we modify it as part of a recursive function
we were erasing the relations array when iterating over them.
this fixes that so we don't mess with the inputs like that
and instead copy it

fixes #7882

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

because of how we modify it as part of a recursive function
we were erasing the `relations` array when iterating over them.
this fixes that so we don't mess with the inputs like that
and instead copy it
@imnotjames imnotjames force-pushed the fix/7882/relations-gets-emptied branch from 24aaa9e to 548129c Compare July 11, 2021 06:57
@imnotjames imnotjames merged commit a2fcad6 into typeorm:master Jul 11, 2021
@imnotjames imnotjames deleted the fix/7882/relations-gets-emptied branch July 11, 2021 07:22
chriswep added a commit to chriswep/typeorm that referenced this pull request Feb 16, 2022
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.

.findOne reduces relations to an empty array (regression)
1 participant