mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(virtual-scroll): supports null records
fixes 11093
This commit is contained in:
@ -21,7 +21,7 @@ export function processRecords(stopAtHeight: number,
|
|||||||
let startRecordIndex: number;
|
let startRecordIndex: number;
|
||||||
let previousCell: VirtualCell;
|
let previousCell: VirtualCell;
|
||||||
let tmpData: any;
|
let tmpData: any;
|
||||||
let lastRecordIndex = (records.length - 1);
|
let lastRecordIndex = records ? (records.length - 1) : -1;
|
||||||
|
|
||||||
if (cells.length) {
|
if (cells.length) {
|
||||||
// we already have cells
|
// we already have cells
|
||||||
@ -131,11 +131,11 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
|
|||||||
cells: VirtualCell[], records: any[], nodes: VirtualNode[], viewContainer: ViewContainerRef,
|
cells: VirtualCell[], records: any[], nodes: VirtualNode[], viewContainer: ViewContainerRef,
|
||||||
itmTmp: TemplateRef<VirtualContext>, hdrTmp: TemplateRef<VirtualContext>, ftrTmp: TemplateRef<VirtualContext>,
|
itmTmp: TemplateRef<VirtualContext>, hdrTmp: TemplateRef<VirtualContext>, ftrTmp: TemplateRef<VirtualContext>,
|
||||||
initialLoad: boolean): boolean {
|
initialLoad: boolean): boolean {
|
||||||
const recordsLength = records.length;
|
if (!records || records.length === 0) {
|
||||||
if (!recordsLength) {
|
|
||||||
nodes.length = 0;
|
nodes.length = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
const recordsLength = records.length;
|
||||||
|
|
||||||
let hasChanges = false;
|
let hasChanges = false;
|
||||||
let node: VirtualNode;
|
let node: VirtualNode;
|
||||||
|
Reference in New Issue
Block a user