Sfoglia il codice sorgente

:recycle: stop init on route watch

tags/0.9.0
J 4 anni fa
parent
commit
b2651eb947
1 ha cambiato i file con 7 aggiunte e 5 eliminazioni
  1. 7
    5
      vue-theme/src/pages/list.vue

+ 7
- 5
vue-theme/src/pages/list.vue Vedi File

90
             if(!this.keepFetching) return console.warn('nothing left to fetch...')
90
             if(!this.keepFetching) return console.warn('nothing left to fetch...')
91
 
91
 
92
             this.loadingFetched = true
92
             this.loadingFetched = true
93
-            console.warn(`loading page ${this.page + 1} of ${type} posts: ${this.page * this.perPage + 1} to ${(this.page + 1) * this.perPage}`)
93
+            // console.warn(`loading page ${this.page + 1} of ${type} posts: ${this.page * this.perPage + 1} to ${(this.page + 1) * this.perPage}`)
94
 
94
 
95
             this.page++
95
             this.page++
96
             await this.getPosts()
96
             await this.getPosts()
132
             }
132
             }
133
 
133
 
134
             // Stop trying to load more posts
134
             // Stop trying to load more posts
135
+            console.log('res :', res)
135
             if(res && !res.length) {
136
             if(res && !res.length) {
136
                 console.warn(`empty response for ${this.type}:`, res)
137
                 console.warn(`empty response for ${this.type}:`, res)
137
                 this.keepFetching = false
138
                 this.keepFetching = false
188
             this.page = 0
189
             this.page = 0
189
             this.keepFetching = true
190
             this.keepFetching = true
190
 
191
 
191
-            this.checkAndSetHero(this.type)
192
+            await this.checkAndSetHero(this.type)
192
 
193
 
193
             // Fires when loading from home
194
             // Fires when loading from home
194
             // Clear any preloaded posts (from home, etc.)
195
             // Clear any preloaded posts (from home, etc.)
208
         // a list page, to another list page
209
         // a list page, to another list page
209
         type(newType, oldType) {
210
         type(newType, oldType) {
210
             if(!postTypes.includes(newType)) return console.warn('type not found...')
211
             if(!postTypes.includes(newType)) return console.warn('type not found...')
212
+
213
+            console.log('init from type watch...')
214
+            this.clearAndInitPostList()
211
         },
215
         },
212
         $route(to, from) {
216
         $route(to, from) {
213
             console.log('---')
217
             console.log('---')
221
             if(!toPathInfo.sortBy != sortTypes.material) {
225
             if(!toPathInfo.sortBy != sortTypes.material) {
222
                 this.setIntersectionLoader()
226
                 this.setIntersectionLoader()
223
             }
227
             }
224
-
225
-            console.log('init from $route watch...')
226
-            this.clearAndInitPostList()
227
         }
228
         }
228
     },
229
     },
229
     mounted() {
230
     mounted() {
230
         this.setIntersectionLoader()
231
         this.setIntersectionLoader()
232
+        console.log('init from mounted...')
231
         this.clearAndInitPostList()
233
         this.clearAndInitPostList()
232
     },
234
     },
233
     beforeDestroy() {
235
     beforeDestroy() {

Loading…
Annulla
Salva