Skip to content

Commit

Permalink
Revert "BC-5162 - drag and drop race condition (#4420)" (#4427)
Browse files Browse the repository at this point in the history
This reverts commit 476f79c.
  • Loading branch information
virgilchiriac authored Sep 21, 2023
1 parent a812989 commit 40227eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 2 additions & 3 deletions apps/server/src/modules/board/repo/board-node.repo.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntityManager } from '@mikro-orm/mongodb';
import { Test, TestingModule } from '@nestjs/testing';
// import { ColumnBoardNode } from '@shared/domain';
import { ColumnBoardNode } from '@shared/domain';
import { MongoMemoryDatabaseModule } from '@shared/infra/database';
import {
cardNodeFactory,
Expand Down Expand Up @@ -208,7 +208,7 @@ describe('BoardNodeRepo', () => {
});
});
});
/* BC-5162 - avoid race condition due to unit of work

describe('findById', () => {
describe('when boardNode exists in the database but NOT in the unit-of-work', () => {
it('should return an equal object', async () => {
Expand Down Expand Up @@ -236,5 +236,4 @@ describe('BoardNodeRepo', () => {
});
});
});
*/
});
7 changes: 6 additions & 1 deletion apps/server/src/modules/board/repo/board-node.repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ export class BoardNodeRepo {
constructor(private readonly em: EntityManager) {}

async findById(id: EntityId): Promise<BoardNode> {
const entity = await this.em.findOneOrFail(BoardNode, id);
let entity = this.em.getUnitOfWork().getById<BoardNode>(BoardNode.name, id);
if (entity) {
return entity;
}

entity = await this.em.findOneOrFail(BoardNode, id);
return entity;
}

Expand Down

0 comments on commit 40227eb

Please sign in to comment.