Skip to content

Commit

Permalink
fix(VirtualScroll): initialize trackByFn reference (#11624)
Browse files Browse the repository at this point in the history
* fix(VirtualScroll): initialize trackByFn reference

* fix(VirtualScroll): simplify fix for TrackByFn reference
  • Loading branch information
pluscubed authored and manucorporat committed May 19, 2017
1 parent 3e2eefc commit 892e14f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/virtual-scroll/virtual-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export class VirtualScroll implements DoCheck, AfterContentInit, OnDestroy {
}

private _updateDiffer() {
if (isBlank(this._differ) && isPresent(this._records)) {
if (isPresent(this._records)) {
this._differ = this._iterableDiffers.find(this._records).create(this._virtualTrackBy);
}
}
Expand Down

1 comment on commit 892e14f

@ibnclaudius
Copy link

@ibnclaudius ibnclaudius commented on 892e14f May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason after this commit my virtual list no longer updates when changing segments. Below is the relevant part of my code for you understand.

this.historyProvider.getHistory()
      .subscribe((history: Copy[]): Copy[] => this.history = history);
<ion-segment [(ngModel)]="segment" (ionChange)="mergeNewHistory()">...</ion-segment>
<ion-list [virtualScroll]="history" [virtualTrackBy]="virtualTrack">
  <button *virtualItem="let copy" ion-item>...</button>
</ion-list>
virtualTrack(index: number, copy: Copy): Date {
  return copy.date;
}

If I go back to version 3.2.1 it works perfectly!

Please sign in to comment.