Skip to content

Commit 5a9de2d

Browse files
simplify
1 parent 4d97fcf commit 5a9de2d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/PageCollector.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,11 @@ export class PageCollector<T> {
144144
}
145145

146146
const data: T[] = [];
147-
const navigationNum = Math.min(
148-
navigations.length - 1,
149-
this.#maxNavigationSaved,
150-
);
151-
for (let index = navigationNum; index >= 0; index--) {
152-
data.push(...navigations[index]);
147+
148+
for (let index = this.#maxNavigationSaved; index >= 0; index--) {
149+
if (navigations[index]) {
150+
data.push(...navigations[index]);
151+
}
153152
}
154153
return data;
155154
}

0 commit comments

Comments
 (0)