Read Only Tracking Not Disabled (ARCH3054)
Ce contenu n’est pas encore disponible dans votre langue.
Key typescript.orm.readonly-tracking-not-disabled · Severity warning · Category orm
When a read-only query loads fully tracked, hydrated entities, the identity-map and change-tracking cost is wasted. Use a lighter read mode.
Incorrect
Section titled “Incorrect”const users = await userRepo.find({ where: { active: true } });return users.map(u => ({ id: u.id, name: u.name })); // read onlyCorrect
Section titled “Correct”const users = await userRepo.find({ where: { active: true }, select: { id: true, name: true },});return users; // lightweight, untracked readUse a lightweight read mode (AsNoTracking/.values()/select/lean) for read-only queries.