-
-
Notifications
You must be signed in to change notification settings - Fork 241
[Do Not Merge]fix(list-view): Recycle items for component children #740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We were not recycling item views if the item contained a single custom component child.
@@ -160,6 +162,7 @@ export class ListViewComponent implements DoCheck, OnDestroy, AfterContentInit { | |||
|
|||
if (args.view && args.view[NG_VIEW]) { | |||
listViewLog("onItemLoading: " + index + " - Reusing existing view"); | |||
console.log("onItemLoading: " + index + " - Reusing existing view"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug console.log leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the code that should extract the view ref, event if the root view was "wrapped" in Stack layout
@@ -169,6 +172,7 @@ export class ListViewComponent implements DoCheck, OnDestroy, AfterContentInit { | |||
} | |||
} else { | |||
listViewLog("onItemLoading: " + index + " - Creating view from template"); | |||
console.log("onItemLoading: " + index + " - Creating view from template"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug console.log leftover?
@@ -242,7 +246,12 @@ export interface ComponentView { | |||
export type RootLocator = (nodes: Array<any>, nestLevel: number) => View; | |||
|
|||
export function getItemViewRoot(viewRef: ComponentView, rootLocator: RootLocator = getSingleViewRecursive): View { | |||
const rootView = rootLocator(viewRef.rootNodes, 0); | |||
let rootView = rootLocator(viewRef.rootNodes, -1); | |||
if (rootView instanceof ProxyViewContainer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a more borad check should be used:
if (!args.view instanceof LayoutBase || args.view instanceof ProxyViewContainer)
This will handle cases when template produces a single Label
or Button
for example
Closing in because of #743 |
We were not recycling item views if the item contained a single
custom component child.
Fixes #737