Skip to content

Commit c6f7549

Browse files
committed
fix(list-view): Do not access destroyed items' ng views.
1 parent fa089aa commit c6f7549

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: nativescript-angular/directives/list-view-comp.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class ListViewComponent implements DoCheck, OnDestroy, AfterContentInit {
158158
items.getItem(index) : items[index];
159159
let viewRef: EmbeddedViewRef<ListItemContext>;
160160

161-
if (args.view) {
161+
if (args.view && args.view[NG_VIEW]) {
162162
listViewLog("onItemLoading: " + index + " - Reusing existing view");
163163
viewRef = args.view[NG_VIEW];
164164
// getting angular view from original element (in cases when ProxyViewContainer
@@ -245,6 +245,7 @@ export function getItemViewRoot(viewRef: ComponentView, rootLocator: RootLocator
245245
const rootView = rootLocator(viewRef.rootNodes, 0);
246246
rootView.on("unloaded", () => {
247247
viewRef.destroy();
248+
delete rootView[NG_VIEW];
248249
});
249250
return rootView;
250251
}

0 commit comments

Comments
 (0)