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

Revert "BC-5162 - drag and drop race condition (#4420)" #4427

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
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
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
Loading