Bläddra i källkod

:bug: fixing some weird list loading double posts navigating list to list

tags/0.9.0
J 4 år sedan
förälder
incheckning
80d5512809
3 ändrade filer med 11 tillägg och 5 borttagningar
  1. 1
    0
      vue-theme/src/components/card.vue
  2. 7
    3
      vue-theme/src/pages/list.vue
  3. 3
    2
      vue-theme/src/pages/single.vue

+ 1
- 0
vue-theme/src/components/card.vue Visa fil

@@ -16,6 +16,7 @@
16 16
             p(v-if="content.end && type == 'event'" class="datetime") {{ dateFrom(content.start, type=='event') }} – {{ dateFrom(content.end, type=='event').split(',')[1] }}
17 17
             p(v-else-if="content.end" class="datetime") {{ dateFrom(content.start, type=='event') }} – {{ dateFrom(content.end, type=='event') }}
18 18
             p.excerpt {{ content.excerpt }}
19
+            router-link(:to="`/${type}/${content.slug}`") read more
19 20
 </template>
20 21
 
21 22
 <script>

+ 7
- 3
vue-theme/src/pages/list.vue Visa fil

@@ -76,7 +76,7 @@ export default {
76 76
     },
77 77
     methods: {
78 78
         clearAllPosts() {
79
-            if(!this.type) return console.error(`type: ${type}...`)
79
+            if(!this.type) return console.error(`type: ${this.type}...`)
80 80
             const uppercaseType = this.type.toUpperCase() + 'S'
81 81
             this.$store.commit(`CLEAR_${uppercaseType}`)
82 82
             this.$store.commit(`${uppercaseType}_LOADED`)
@@ -112,10 +112,11 @@ export default {
112 112
         async getPosts() {
113 113
             // Edge case for episodes
114 114
             await this._getAll('episode', this.$store)
115
-            
115
+
116 116
             const dispatchAction = `getMore${this.pType}`
117
+            const ignore = [`getMoreEpisodes`, 'getMorePages']
117 118
             let res = null
118
-            if(this.pType && dispatchAction != `getMoreEpisodes`) {
119
+            if(this.pType && !ignore.includes(dispatchAction)) {
119 120
                 res = await this.$store.dispatch(
120 121
                     dispatchAction,
121 122
                     this._getDispatchParams()
@@ -204,6 +205,9 @@ export default {
204 205
                 from.fullPath.includes(this.sortBy) ||
205 206
                 (!to.fullPath.includes(this.sortBy) && !from.fullPath.includes(this.sortBy))
206 207
             ) {
208
+                // !: BUG: this causes event and exhibit posts to double(?)
209
+                const ignore = ['event', 'exhibition', 'post']
210
+                if(ignore.includes(this.type)) return
207 211
                 this.clearAndInitPostList()
208 212
             }
209 213
         }

+ 3
- 2
vue-theme/src/pages/single.vue Visa fil

@@ -48,7 +48,7 @@ import breadcrumb from '@/components/breadcrumb'
48 48
 
49 49
 import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
50 50
 
51
-import { convertTitleCase, dePluralize, typeFromRoute } from '@/utils/helpers'
51
+import { sortTypes, convertTitleCase, dePluralize, typeFromRoute } from '@/utils/helpers'
52 52
 
53 53
 const TIMEOUT = 1
54 54
 
@@ -224,7 +224,8 @@ export default {
224 224
             // Only load post data when
225 225
             //  navigating TO a single page
226 226
             const path = to.fullPath.split('/').filter(p => p)
227
-            if (path.length > 1) {
227
+            const hasSort = path.filter(fragment => Object.values(sortTypes).includes(fragment))
228
+            if (path.length < 1 && hasSort.length < 1) {
228 229
                 this._clearHero(this.$store)
229 230
                 this.loadPostData()
230 231
             }

Laddar…
Avbryt
Spara