تخطَّ إلى المحتوى

Missing Eager Load (ARCH3051)

هذا المحتوى غير متوفر بلغتك بعد.

Key typescript.orm.missing-eager-load · Severity warning · Category orm

When you traverse related data from a query result without declaring eager loading (Include/with/relations), each access triggers a separate query. Eager loading is the canonical N+1 prevention.

const posts = await postRepo.find();
const titles = posts.map(p => `${p.title} by ${p.author.name}`); // author lazy
const posts = await postRepo.find({ relations: { author: true } });
const titles = posts.map(p => `${p.title} by ${p.author.name}`);

Eager-load the relation explicitly in the query with relations/include.