From 6b125a393d8ce10bfd9273c24ea1615b335abeba Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sat, 26 Jun 2021 17:44:03 +0200
Subject: viewer/GalleryNavigation: uniquely identify viewer instances by item

Fixed error "Object is possibly 'null'" in the template
---
 viewer/src/views/GalleryNavigation.vue | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'viewer/src/views/GalleryNavigation.vue')

diff --git a/viewer/src/views/GalleryNavigation.vue b/viewer/src/views/GalleryNavigation.vue
index c53df66..69198f6 100644
--- a/viewer/src/views/GalleryNavigation.vue
+++ b/viewer/src/views/GalleryNavigation.vue
@@ -21,7 +21,7 @@
   <div>
     <ld-error v-if="isError" icon="folder-open" :message="$t('gallery.unknown-resource')" />
     <gallery-search v-else-if="isSearch" :path="path" />
-    <component :is="componentName" v-else :key="$galleryStore.currentItem.path" :item="$galleryStore.currentItem" />
+    <component :is="componentName" v-else :key="componentKey" :item="$galleryStore.currentItem" />
   </div>
 </template>
 
@@ -66,6 +66,10 @@ export default class GalleryNavigation extends Vue {
     return this.COMPONENT_BY_TYPE[this.$galleryStore.currentItem?.properties.type ?? ItemType.OTHER];
   }
 
+  get componentKey() {
+    return this.$galleryStore.currentItem?.path ?? "";
+  }
+
   @Watch("path")
   pathChanged() {
     this.$galleryStore.setCurrentPath(this.path);
-- 
cgit v1.2.3

