Skip to content

Commit 67af71b

Browse files
committed
fix(virtual-scroll): supports null records
fixes 11093
1 parent 78d427d commit 67af71b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/slides/swiper/swiper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ export function enableTouchControl(s: Slides) {
892892
// Cleanup dynamic styles
893893
function cleanupStyles(s: Slides) {
894894
if (!s.container || !s._wrapper) {
895-
//fix #10830
895+
// fix #10830
896896
return;
897897
}
898898

src/components/virtual-scroll/virtual-util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function processRecords(stopAtHeight: number,
2121
let startRecordIndex: number;
2222
let previousCell: VirtualCell;
2323
let tmpData: any;
24-
let lastRecordIndex = (records.length - 1);
24+
let lastRecordIndex = records ? (records.length - 1) : -1;
2525

2626
if (cells.length) {
2727
// we already have cells
@@ -131,11 +131,11 @@ export function populateNodeData(startCellIndex: number, endCellIndex: number, v
131131
cells: VirtualCell[], records: any[], nodes: VirtualNode[], viewContainer: ViewContainerRef,
132132
itmTmp: TemplateRef<VirtualContext>, hdrTmp: TemplateRef<VirtualContext>, ftrTmp: TemplateRef<VirtualContext>,
133133
initialLoad: boolean): boolean {
134-
const recordsLength = records.length;
135-
if (!recordsLength) {
134+
if (!records || records.length === 0) {
136135
nodes.length = 0;
137136
return true;
138137
}
138+
const recordsLength = records.length;
139139

140140
let hasChanges = false;
141141
let node: VirtualNode;

0 commit comments

Comments
 (0)