Skip to content

Eager relations with DeleteDateColumn override manually requested relations with nested properties #11265

Closed

Description

@LeviHeber

Issue description

When performing a TypeORM query with both manually specified relations and eager relations of entity with DeleteDateColumn, the current implementation incorrectly overwrites manually loaded relation data with partial eager relation data. This leads to loss of detailed information for manually requested nested relations.

Expected Behavior

  • Manually specified relations should be preserved in full
  • Eager relations should complement, not replace, existing relation data
  • Nested relations within manually specified relations should remain intact
  • When multiple relation loading methods are used, all relation data should be merged correctly

Actual Behavior

The eager entity is returnd without it nested entity that was manually requested.
During the query execution, TypeORM performs multiple joins to load the relations. When constructing the final object, the system overwrites the manually specified relation data with an eager-loaded version. This overwrite process results in a loss of detailed information for the manually specified nested relation, replacing it with a potentially incomplete representation that only includes eager-loaded fields.

Steps to reproduce

  1. Create an entity with an eager relation that contains another nested relation and has DeleteDateColumn.
  2. Perform a find query where you manually specify the eager relation and it's nested relation.
  3. Execute the query and retrieve the result.

My Environment

Dependency Version
Operating System Windows
Node.js version v20.10.0
Typescript version 5.3.3
TypeORM version 0.3.20

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

Activity

  1. changed the title [-]Eager relations override manually requested relations with nested properties[/-] [+]Eager relations with DeleteDateColumn override manually requested relations with nested properties[/+] on Jan 28, 2025
  2. added a commit that references this issue on Jan 28, 2025
    251b184
  3. github-actions commented on Sep 17, 2025

    @github-actions

    TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).

    As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.

    🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
    If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.

  4. LeviHeber commented on Sep 17, 2025

    @LeviHeber
    ContributorAuthor

    Are there any updates? This is a patch that fixes several bugs at the same time, and it's worth moving forward with it.

  5. reopened this on Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions