You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
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)
The text was updated successfully, but these errors were encountered:
deepkit-framework/packages/orm-integration/src/bookstore.ts
Line 714 in 64cc55e
bookstore:multipleJoins
:since
review.user === review.book.user
and user is joined (fully loaded) it's necessary that both objects are the same. currentlyreview.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 inreview.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)The text was updated successfully, but these errors were encountered: