Я создаю приложение NS и Angular, и я использую RadListView с включенным pullToRefre sh. Я заметил, что после некоторого использования приложение начинает тормозить. После исследования я увидел, что некоторые элементы, такие как изображения, протекают.
Вот снимок памяти после одного нажатия, чтобы обновить sh попадание:
введите описание изображения здесь
Вот общее сравнение после дополнительных обновлений и вы можете видеть, что память увеличивается на многих элементах, и даже больше изображений просачивается
введите описание изображения здесь
и здесь
введите описание изображения здесь
Вот мой код (я думаю, я не делаю ничего особенного):
<RadListView #myListView [items]="items" [height]="scrollViewHeight"
(pullToRefreshInitiated)="onPullToRefreshInitiated($event)" pullToRefresh="true">
<ng-template tkListItemTemplate let-item="item">
<GridLayout columns="auto, *, 22, auto" rows="*" class="item-holder" (tap)="onLayoutTap($event)"
backgroundColor="white" padding="0">
<StackLayout col="0" row="0">
<Image [src]="item?.profilePicture"
class="-thumb img-circle image-border-{{item?.status}}" width="60" height="60">
</Image>
<Label text=" {{ item?.text5 }}" class="icon review-text"></Label>
</StackLayout>
<StackLayout col="1" row="0">
<Label [text]="item?.text3" class="h2"></Label>
<Label [text]="item?.text1" class="h5 list-item--subheader"></Label>
<Label [text]="item?.text2" class="h4" textWrap="true"></Label>
<GridLayout columns="*,auto" class="additional-info">
<Label col="0" text="{{ item?.text8}} {{ item?.text9}}" class="h5 cherry-text"
textWrap="true"></Label>
<Label col="1" [text]="item?.text7" class="h5 cherry-text" textWrap="true"></Label>
</GridLayout>
</StackLayout>
<StackLayout col="2" row="0" rowSpan="2" class="status-bar status--{{item?.status}}"></StackLayout>
</GridLayout>
</ng-template>
и ts
@Component({
selector: 'px-received-items',
templateUrl: './received-items.component.html',
styleUrls: ['./received-items.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ReceivedItemsComponent implements OnInit {
private leftThresholdPassed = false;
private rightThresholdPassed = false;
items: any
get scrollViewHeight() {
return screen.mainScreen.heightDIPs - 250;
}
@ViewChild('myListView', { read: RadListViewComponent, static: false }) myListViewComponent: RadListViewComponent;
constructor(
cd: ChangeDetectorRef,
private dataGQL: DataGQL,
private authService: AuthService,
) {}
ngOnInit() {
setTimeout(() => {
this.fetchData();
});
}
async onPullToRefreshInitiated(args: any) {
this.fetchData();
const listView = args.object;
listView.notifyPullToRefreshFinished();
}
private fetchData() {
this.dataGQL.watch({ id: this.authService.authData._id })
.valueChanges
.pipe(take(1))
.subscribe(response => {
this.items = response.data.inquiries.receivedInquiriesn
this.cd.markForCheck();
});
}
}
Любые идеи, как чтобы решить эту утечку?