Refactor/es feeds
TODO:
- Re-introduce block client side
- Re-synchronise entities in the background
0/5 discussions resolved
mentioned in merge request engine!221
added 1 commit
- 9dc4d33a - (fix): use combineLatest to ensure obversables are in sync for hasMore
21 21 22 22 <ng-container *ngIf="['images', 'videos'].indexOf(type) > -1; else entityListView"> 23 23 <m-newsfeed__tiles 24 [entities]="getAllEntities()" 24 [entities]="feedsService.feed | async" - Maintainer
Yaaaay! Asyc pipes <3
96 this.params.sync = 1; 97 } 98 return this; 99 } 69 100 70 // Garbage collection 101 setOffset(offset: number): FeedsService { 102 this.offset.next(offset); 103 return this; 104 } 71 105 72 this.feedsSync.gc(); 73 setTimeout(() => this.feedsSync.gc(), 15 * 60 * 1000); // Every 15 minutes 106 fetch(): FeedsService { 107 this.inProgress.next(true); 108 this.client.get(this.endpoint, {...this.params, ...{ limit: 150 }}) // Over 12 scrolls - Maintainer
Hissssssssss, I hate the spread operator so much. Your call if we use it, but I find it impossible to keep track of what objects we're mapping.
- Last updated by Mark Harding
123 clear(): FeedsService { 124 this.offset.next(0); 125 this.inProgress.next(true); 126 this.rawFeed.next([]); 127 return this; 128 } 81 129 82 return { 83 entities, 84 next, 85 } 86 } catch (e) { 87 console.error('FeedsService.get', e); 88 throw e; 89 } 130 hydrateEntities(): FeedsService { - Maintainer
Aren't we already hydrating entities in this corresponding MR. engine!221
I'd expect this to return an array of hydrated entities, but this looks like it's returning the service itself.
- Owner
Yes this function isn't actually used
14 14 import { PosterComponent } from "../../newsfeed/poster/poster.component"; 15 15 import { SortedService } from "./sorted.service"; 16 16 import { ClientMetaService } from "../../../common/services/client-meta.service"; 17 import { Observable } from "rxjs"; - Maintainer
Added this, but it doesn't look like we're using it? Or is it necessary to use async pipes in the template?
125 126 if (this.entities && !refresh) { 127 this.entities.push(...entities); 128 } else { 129 this.entities = entities; 130 } 131 132 if (!next) { 133 this.moreData = false; 134 } 135 136 this.offset = next; 94 95 this.feedsService 96 .setEndpoint(`api/v2/feeds/container/${this.group.guid}/${this.type}`) 97 .setLimit(12) - Maintainer
These 12s should be defined as constants
added MR::Awaiting Review label