|
|
@@ -195,6 +195,13 @@ export default {
|
|
195
|
195
|
// Clear any preloaded posts (from home, etc.)
|
|
196
|
196
|
this.clearAllPosts()
|
|
197
|
197
|
this.loadMorePosts()
|
|
|
198
|
+ },
|
|
|
199
|
+ routeInfoFromPath(fullPath) {
|
|
|
200
|
+ const [ potentialType, potentialSort ] = fullPath.split('/')
|
|
|
201
|
+ return {
|
|
|
202
|
+ sortBy: Object.values(sortTypes).includes(potentialSort) ? potentialSort : null,
|
|
|
203
|
+ type: postTypes.includes(potentialType) ? potentialType : null
|
|
|
204
|
+ }
|
|
198
|
205
|
}
|
|
199
|
206
|
},
|
|
200
|
207
|
watch: {
|
|
|
@@ -202,22 +209,20 @@ export default {
|
|
202
|
209
|
// a list page, to another list page
|
|
203
|
210
|
type(newType, oldType) {
|
|
204
|
211
|
if(!postTypes.includes(newType)) return console.warn('type not found...')
|
|
205
|
|
-
|
|
206
|
|
- // this.setIntersectionLoader()
|
|
207
|
|
- this.clearAndInitPostList()
|
|
|
212
|
+ // this.clearAndInitPostList()
|
|
208
|
213
|
},
|
|
209
|
214
|
$route(to, from) {
|
|
210
|
|
- // Reset the intersection loader if navigating AWAY from material sort page
|
|
211
|
|
- console.log('---')
|
|
212
|
|
- console.log('to :', to)
|
|
213
|
|
- console.log('from :', from)
|
|
214
|
|
-
|
|
|
215
|
+ // Always unset and reset the intersection loader
|
|
215
|
216
|
this.unsetIntersectionLoader()
|
|
216
|
|
- if(!to.fullPath.includes(sortTypes.material)) {
|
|
|
217
|
+ if(!toPathInfo.sortBy != sortTypes.material) {
|
|
217
|
218
|
this.setIntersectionLoader()
|
|
218
|
219
|
}
|
|
219
|
|
-
|
|
220
|
|
-
|
|
|
220
|
+ console.log('---')
|
|
|
221
|
+ const toPathInfo = this.routeInfoFromPath(to.fullPath)
|
|
|
222
|
+ const fromPathInfo = this.routeInfoFromPath(from.fullPath)
|
|
|
223
|
+ console.log('to :', toPathInfo)
|
|
|
224
|
+ console.log('from :', fromPathInfo)
|
|
|
225
|
+
|
|
221
|
226
|
// Check if we changed sort method
|
|
222
|
227
|
// from no sort to sorted
|
|
223
|
228
|
// or sorted to no sort
|