Skip to content

Commit

Permalink
Fix board cloning without CRDT
Browse files Browse the repository at this point in the history
  • Loading branch information
raimohanska committed Mar 6, 2024
1 parent 974f3aa commit 799c717
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/store/crdt-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,14 @@ export function CRDTStore(

function cloneBoard(board: Board): Board {
const boardCrdt = boards.get(board.id)
const newId = uuid.v4()
if (!boardCrdt) {
throw Error("Assertion failed: board not found")
return {
...board,
id: newId,
}
}

const newId = uuid.v4()
const items = boardCrdt.augmentItems(Object.values(board.items))
const newBoard = {
...board,
Expand Down

0 comments on commit 799c717

Please sign in to comment.