Closed pwfraley closed 6 months ago
I was curious about this because I've been using pinia-orm for many months and have not encountered this.
I just tested it and this is not happening for me at all.
I compared useRepo(Product).query().first()
vs useRepo(Product).query().withAllRecursive().first()
and the former returned only the product attributes and none of its relationships and the latter did return all the nested relationships.
@pwfraley Please provide a reproduction for it 🙏 .
@pwfraley please reopen it if still occurs with v1.9.0. Thanks!
Environment
Pinia ORM 1.7.2
Reproduction
this.userRepo.where("id", 1).first(); // This will always get all relational objects and subobjects { id: 1, name: 'admin', posts: [{ tilte: 'Cool post', body: 'Cool infos', },{},...] }
this.userRepo.where("id", 1).get()[0]; // This will only get the user { id: 1, name: 'admin', posts: [] }
Describe the bug
When using .first() to get an object the object is always return withAllRecursive, even though the query does NOT have withAllRecursive. So calling this: this.userRepo.where("id", 1).first(); is equal to: this.userRepo.withAllRecursive().where("id", 1).first();
Additional context
No response
Logs
No response