-
Notifications
You must be signed in to change notification settings - Fork 128
Description
https://github.com/deepkit/deepkit-framework/blob/64cc55e812a6be555515e036de4e6b18d147b4f0/packages/orm-integration/src/bookstore.ts#L714 bookstore:multipleJoins
:
{
const review = await database.query(Review)
.innerJoinWith('book')
.innerJoinWith('user')
.findOne();
console.log('review', review);
console.log('review.user', review.user);
expect(review.user.id).toBe(user.id);
expect(review.book.id).toBe(book.id);
// author became hydrated since we loaded the full user object also
expect(review.book.author.name).toBe('Peter');
expect(review.user.name).toBe('Peter');
expect(review.book.title).toBe('Great');
expect(review.status).toBe(ReviewStatus.hidden);
}
since review.user === review.book.user
and user is joined (fully loaded) it's necessary that both objects are the same. currently review.book.author
is a unhydrated reference. the reference should hydrate as soon as the full user is found. we have the reference in formatter pool.
Also as soon as identity map is enabled for this query the formatter breaks. concretely: review.user
becomes a reference and is never hydrated because it was first found in review.book.author
as reference and stays a reference. we need to check first for pool then identitymap (identitymap alone is not hydrated when new information is available)