I've got a service call that loads ten items onto the screen. When users click a "View More" button, I send another call to the service with different paging arguments. What's the best way to gracefully append the new array of items from the second call into the existing array emitted by the first call?
My example below technically works, but it resets the original observable, refreshing all items on the screen, rather than just adding the new ones. Thoughts? Could Subjects help with this?
private onViewMoreClicked(): void {
this.pageOffset += this.pageLimit;
const moreItems$ = this.itemService.get(
this.pageLimit,
this.pageOffset
);
this.items$ = forkJoin(this.items$, moreItems$).pipe(
map(([a, b]) => [...a, ...b])
);