2
0
Эх сурвалжийг харах

fix: duplicate page selector items

NGPixel 5 жил өмнө
parent
commit
21f19d3ae6

+ 6 - 7
client/components/common/page-selector.vue

@@ -28,7 +28,7 @@
           div(style='height:400px;')
           div(style='height:400px;')
             vue-scroll(:ops='scrollStyle')
             vue-scroll(:ops='scrollStyle')
               v-treeview(
               v-treeview(
-                :key='`pageTree` + treeViewCacheId'
+                :key='`pageTree-` + treeViewCacheId'
                 :active.sync='currentNode'
                 :active.sync='currentNode'
                 :open.sync='openNodes'
                 :open.sync='openNodes'
                 :items='tree'
                 :items='tree'
@@ -56,8 +56,8 @@
                   color='primary'
                   color='primary'
                   )
                   )
                   template(v-for='(page, idx) of currentPages')
                   template(v-for='(page, idx) of currentPages')
-                    v-list-item(:key='`page` + page.id', :value='page.path')
-                      v-list-item-icon: v-icon mdi-file-document-box
+                    v-list-item(:key='`page-` + page.id', :value='page.path')
+                      v-list-item-icon: v-icon mdi-text-box
                       v-list-item-title {{page.title}}
                       v-list-item-title {{page.title}}
                     v-divider(v-if='idx < pages.length - 1')
                     v-divider(v-if='idx < pages.length - 1')
           v-alert.animated.fadeIn(
           v-alert.animated.fadeIn(
@@ -143,7 +143,7 @@ export default {
       tree: [
       tree: [
         {
         {
           id: 0,
           id: 0,
-          title: '/ (root',
+          title: '/ (root)',
           children: []
           children: []
         }
         }
       ],
       ],
@@ -286,9 +286,8 @@ export default {
       } else {
       } else {
         item.children = undefined
         item.children = undefined
       }
       }
-      this.pages.push(...itemPages)
-
-      this.all.push(...items)
+      this.pages = _.unionBy(this.pages, itemPages, 'id')
+      this.all = _.unionBy(this.all, items, 'id')
 
 
       this.searchLoading = false
       this.searchLoading = false
     }
     }