Explorar el Código

:recycle: stop init on route watch

tags/0.9.0
J hace 4 años
padre
commit
b2651eb947
Se han modificado 1 ficheros con 7 adiciones y 5 borrados
  1. 7
    5
      vue-theme/src/pages/list.vue

+ 7
- 5
vue-theme/src/pages/list.vue Ver fichero

@@ -90,7 +90,7 @@ export default {
90 90
             if(!this.keepFetching) return console.warn('nothing left to fetch...')
91 91
 
92 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 95
             this.page++
96 96
             await this.getPosts()
@@ -132,6 +132,7 @@ export default {
132 132
             }
133 133
 
134 134
             // Stop trying to load more posts
135
+            console.log('res :', res)
135 136
             if(res && !res.length) {
136 137
                 console.warn(`empty response for ${this.type}:`, res)
137 138
                 this.keepFetching = false
@@ -188,7 +189,7 @@ export default {
188 189
             this.page = 0
189 190
             this.keepFetching = true
190 191
 
191
-            this.checkAndSetHero(this.type)
192
+            await this.checkAndSetHero(this.type)
192 193
 
193 194
             // Fires when loading from home
194 195
             // Clear any preloaded posts (from home, etc.)
@@ -208,6 +209,9 @@ export default {
208 209
         // a list page, to another list page
209 210
         type(newType, oldType) {
210 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 216
         $route(to, from) {
213 217
             console.log('---')
@@ -221,13 +225,11 @@ export default {
221 225
             if(!toPathInfo.sortBy != sortTypes.material) {
222 226
                 this.setIntersectionLoader()
223 227
             }
224
-
225
-            console.log('init from $route watch...')
226
-            this.clearAndInitPostList()
227 228
         }
228 229
     },
229 230
     mounted() {
230 231
         this.setIntersectionLoader()
232
+        console.log('init from mounted...')
231 233
         this.clearAndInitPostList()
232 234
     },
233 235
     beforeDestroy() {

Loading…
Cancelar
Guardar