Commit ac7bc7cb authored by Mark Harding's avatar Mark Harding

(chore): some small changes to in feed boosts

parent 196bd999
No related merge requests found
Pipeline #72679158 running with stages
......@@ -66,12 +66,13 @@ export class FeaturedContentComponent implements OnInit {
update() {
this.clear();
const {component, injector} = this.resolve();
if (!this.dynamicHost) {
console.log('tried to load a boost but no dynamicHost found', this.entity);
return;
}
const {component, injector} = this.resolve();
if (component) {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(component);
......
import { Injectable } from "@angular/core";
import { filter, first, map, switchMap } from 'rxjs/operators';
import { filter, first, map, switchMap, mergeMap, skip, take } from 'rxjs/operators';
import { FeedsService } from "../../services/feeds.service";
@Injectable()
......@@ -18,14 +18,20 @@ export class FeaturedContentService {
}
async fetch() {
if (this.offset >= this.feedsService.rawFeed.getValue().length) {
this.offset = -1;
}
return await this.feedsService.feed
.pipe(
filter(feed => feed.length > 0),
first(),
map(feed => feed[this.offset++]),
mergeMap(feed => feed),
skip(this.offset++),
take(1),
switchMap(async entity => {
if (!entity)
if (!entity) {
return false;
}
return await entity.pipe(first()).toPromise();
}),
).toPromise();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment