Skip to content

Commit e425468

Browse files
committed
RDBC-440 Using load with includes returns null for documents that were previously stored
1 parent b83033c commit e425468

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/Documents/Session/InMemoryDocumentSessionOperations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ export abstract class InMemoryDocumentSessionOperations
460460
hasAll = hasAll && this.isLoaded(includeId);
461461
});
462462

463-
if (!hasAll[0]) {
463+
if (!hasAll) {
464464
return false;
465465
}
466466
}

test/Ported/Issues/RDBC_440.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { IDocumentStore } from "../../../src";
2+
import { disposeTestDocumentStore, testContext } from "../../Utils/TestUtil";
3+
import { User } from "../../Assets/Entities";
4+
import { assertThat } from "../../Utils/AssertExtensions";
5+
6+
describe("RDBC_440", function () {
7+
8+
let store: IDocumentStore;
9+
10+
beforeEach(async function () {
11+
store = await testContext.getDocumentStore();
12+
});
13+
14+
afterEach(async () =>
15+
await disposeTestDocumentStore(store));
16+
17+
it("can load just added entity", async () => {
18+
const session = store.openSession();
19+
const user1 = Object.assign(new User(), {
20+
name: "Marcin",
21+
id: "users/1"
22+
});
23+
24+
await session.store(user1);
25+
const loadedUser = await session
26+
.include("addressId")
27+
.load("users/1")
28+
29+
assertThat(loadedUser)
30+
.isSameAs(user1);
31+
});
32+
});

0 commit comments

Comments
 (0)