From 7c2a2ff46469d5e8f44fb3ec7feae5f798e0baf8 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Thu, 27 Feb 2020 17:23:32 +0100
Subject: viewer: architectural fixes and improvements

Make use of VueX's strict mode (which is different from vuex-class-component strict mode)
Fixed issues and bad-practices with search filter tags mutations
Correctly implement the new index.json format
---
 viewer/src/views/GallerySearch.vue | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

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

diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue
index f4c28b0..4b6dd7f 100644
--- a/viewer/src/views/GallerySearch.vue
+++ b/viewer/src/views/GallerySearch.vue
@@ -22,22 +22,17 @@
 </template>
 
 <script lang="ts">
-import { Component, Vue, Prop, Watch } from "vue-property-decorator";
+import { Component, Vue, Prop } from "vue-property-decorator";
 import { Operation } from "@/@types/Operation";
 import IndexSearch from "@/services/indexsearch";
-import IndexFactory from "@/services/indexfactory";
 
 @Component
 export default class GalleryPicture extends Vue {
   @Prop(String) readonly path!: string;
-  @Prop(Array) readonly query!: string[];
-
-  currentSearch: Tag.Search[] = [];
 
   mounted() {
     this.$uiStore.fullscreen = false;
     this.$uiStore.searchMode = true;
-    this.restoreSearchFilters();
   }
 
   destroyed() {
@@ -45,14 +40,7 @@ export default class GalleryPicture extends Vue {
   }
 
   items() {
-    return IndexSearch.search(this.currentSearch, this.path);
-  }
-
-  @Watch("query")
-  restoreSearchFilters() {
-    const tagsIndex = this.$galleryStore.tagsIndex;
-    this.currentSearch = this.query.flatMap(filter => IndexFactory.searchTags(tagsIndex, filter));
-    this.$uiStore.searchFilters = [...this.currentSearch];
+    return IndexSearch.search(this.$galleryStore.currentSearch, this.path);
   }
 }
 </script>
-- 
cgit v1.2.3

