diff --git a/api/src/chat/repositories/block.repository.ts b/api/src/chat/repositories/block.repository.ts index 78903a3c..dea414ce 100644 --- a/api/src/chat/repositories/block.repository.ts +++ b/api/src/chat/repositories/block.repository.ts @@ -131,8 +131,9 @@ export class BlockRepository extends BaseRepository< criteria: TFilterQuery, updates: UpdateQuery>, ): Promise { - const categoryId: string = updates.$set.category; - if (categoryId) { + // Only proceed if category is being updated + if (updates.$set?.category) { + const categoryId: string = updates.$set.category; const movedBlocks = await this.find(criteria); if (movedBlocks.length) {