Quellcode durchsuchen

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

tags/0.9.0
J vor 4 Jahren
Ursprung
Commit
80d5512809
3 geänderte Dateien mit 11 neuen und 5 gelöschten Zeilen
  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 Datei anzeigen

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

+ 7
- 3
vue-theme/src/pages/list.vue Datei anzeigen

76
     },
76
     },
77
     methods: {
77
     methods: {
78
         clearAllPosts() {
78
         clearAllPosts() {
79
-            if(!this.type) return console.error(`type: ${type}...`)
79
+            if(!this.type) return console.error(`type: ${this.type}...`)
80
             const uppercaseType = this.type.toUpperCase() + 'S'
80
             const uppercaseType = this.type.toUpperCase() + 'S'
81
             this.$store.commit(`CLEAR_${uppercaseType}`)
81
             this.$store.commit(`CLEAR_${uppercaseType}`)
82
             this.$store.commit(`${uppercaseType}_LOADED`)
82
             this.$store.commit(`${uppercaseType}_LOADED`)
112
         async getPosts() {
112
         async getPosts() {
113
             // Edge case for episodes
113
             // Edge case for episodes
114
             await this._getAll('episode', this.$store)
114
             await this._getAll('episode', this.$store)
115
-            
115
+
116
             const dispatchAction = `getMore${this.pType}`
116
             const dispatchAction = `getMore${this.pType}`
117
+            const ignore = [`getMoreEpisodes`, 'getMorePages']
117
             let res = null
118
             let res = null
118
-            if(this.pType && dispatchAction != `getMoreEpisodes`) {
119
+            if(this.pType && !ignore.includes(dispatchAction)) {
119
                 res = await this.$store.dispatch(
120
                 res = await this.$store.dispatch(
120
                     dispatchAction,
121
                     dispatchAction,
121
                     this._getDispatchParams()
122
                     this._getDispatchParams()
204
                 from.fullPath.includes(this.sortBy) ||
205
                 from.fullPath.includes(this.sortBy) ||
205
                 (!to.fullPath.includes(this.sortBy) && !from.fullPath.includes(this.sortBy))
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
                 this.clearAndInitPostList()
211
                 this.clearAndInitPostList()
208
             }
212
             }
209
         }
213
         }

+ 3
- 2
vue-theme/src/pages/single.vue Datei anzeigen

48
 
48
 
49
 import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
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
 const TIMEOUT = 1
53
 const TIMEOUT = 1
54
 
54
 
224
             // Only load post data when
224
             // Only load post data when
225
             //  navigating TO a single page
225
             //  navigating TO a single page
226
             const path = to.fullPath.split('/').filter(p => p)
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
                 this._clearHero(this.$store)
229
                 this._clearHero(this.$store)
229
                 this.loadPostData()
230
                 this.loadPostData()
230
             }
231
             }

Laden…
Abbrechen
Speichern