Skip to content

nested relations ignored if parent is eager #5169

@ilovett

Description

@ilovett

Issue type:

[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

        const example = await Example.findOne(
          {  id  },
          { relations: ["parent", "parent.childOne", "parent.childTwo", "other"] }
        );

In this example, if Example entity's parent relation is eager: true, then childOne and childTwo will not be loaded as requested.

  @ManyToOne(
    () => Parent,
    (parent: Parent) => parent.example,
    {
      eager: true // disabling this and the above code will load nested relations
    }
  )
  @JoinColumn()
  parent: Parent | null;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions