From 461c8375046b4e57049484fd491fa3358eb6ac1e Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Wed, 3 Apr 2024 21:48:39 +0200
Subject: [PATCH] Fix oldId handling

---
 .../components/coursebook/documentation/LessonSummary.vue     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue
index 52e921f33..5fb2ea181 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue
@@ -119,11 +119,11 @@ export default {
             (o) => o[itemId] === this.documentation.id,
           );
           // merged with the incoming partial documentation
-          // set ID of documentation currently being edited as oldID so that key in coursebook doesn't change
+          // if creation of proper documentation from dummy one, set ID of documentation currently being edited as oldID so that key in coursebook doesn't change
           cached[index] = {
             ...this.documentation,
             ...object,
-            oldId: this.documentation.id,
+            oldId: this.documentation.id !== object.id ? this.documentation.id : this.documentation.oldId,
           };
         }
         return cached;
-- 
GitLab