Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(core): Improve hydrator performance for customFields #2961

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,16 @@ export class EntityHydrator {
const missingRelations: string[] = [];
for (const relation of options.relations.slice().sort()) {
if (typeof relation === 'string') {
const parts = !relation.startsWith('customFields') ? relation.split('.') : [relation];
const parts = relation.split('.');
let entity: Record<string, any> | undefined = target;
const path = [];
for (const part of parts) {
path.push(part);
// null = the relation has been fetched but was null in the database.
// undefined = the relation has not been fetched.
if (entity && entity[part] === null) {
break;
}
if (entity && entity[part]) {
entity = Array.isArray(entity[part]) ? entity[part][0] : entity[part];
} else {
Expand Down
Loading