From e60435b8cca49ff76ba5dd44c34e374e03e9eb83 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 25 Aug 2025 15:09:38 +0200 Subject: [PATCH] Handle store state updates when moving documents - Add null check to prevent error when evaluation is not part of this social work --- .../public/vuejs/AccompanyingCourseWorkEdit/store.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index 00a7ddde7..741c87ddf 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -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(