Skip to content

Commit

Permalink
Fix fetching of stats in app wall for some cases when list is maxed
Browse files Browse the repository at this point in the history
- Allow time for the list to settle
- fixes #3341
  • Loading branch information
richard-cox committed Jan 17, 2019
1 parent 2c31a24 commit e408066
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Store } from '@ngrx/store';
import { Subscription } from 'rxjs';
import { tag } from 'rxjs-spy/operators/tag';
import { debounceTime, distinctUntilChanged, filter, map, switchMap, withLatestFrom } from 'rxjs/operators';
import { debounceTime, delay, distinctUntilChanged, map, withLatestFrom } from 'rxjs/operators';

import { DispatchSequencer, DispatchSequencerAction } from '../../../../../core/dispatch-sequencer';
import { cfOrgSpaceFilter, getRowMetadata } from '../../../../../features/cloud-foundry/cf.helpers';
Expand Down Expand Up @@ -80,16 +80,16 @@ export class CfAppsDataSource extends ListDataSource<APIResource> {

this.action = action;

const statsSub = this.maxedResults$.pipe(
filter(maxedResults => !maxedResults),
switchMap(() => this.page$),
const statsSub = this.page$.pipe(
// The page observable will fire often, here we're only interested in updating the stats on actual page changes
distinctUntilChanged(distinctPageUntilChanged(this)),
withLatestFrom(this.pagination$),
// Ensure we keep pagination smooth
debounceTime(250),
map(([page, pagination]) => {
if (!page) {
// Allow maxedResults time to settle - see #3359
delay(100),
withLatestFrom(this.maxedResults$),
map(([page, maxedResults]) => {
if (!page || maxedResults) {
return [];
}
const actions = new Array<DispatchSequencerAction>();
Expand Down

0 comments on commit e408066

Please sign in to comment.