Handle store state updates when moving documents

- Add null check to prevent error when evaluation is not part of this social work
This commit is contained in:
2025-08-25 15:09:38 +02:00
parent ab6ab19499
commit e60435b8cc

View File

@@ -326,9 +326,11 @@ const store = createStore({
(e) => e.id === evaluationDest.id,
);
// add document to chosen evaluation
document.key = evaluationB.documents.length + 1;
evaluationB.documents.splice(0, 0, document);
if (evaluationB) {
// add document to chosen evaluation if evaluation is part of the same social work
document.key = evaluationB.documents.length + 1;
evaluationB.documents.splice(0, 0, document);
}
// remove document from original evaluation
const indexToRemove = evaluationA.documents.findIndex(