Skip to content

Commit

Permalink
Fix(@inquirer/core): Fixes usePagination assuming the list is never e…
Browse files Browse the repository at this point in the history
…mpty
  • Loading branch information
SBoudrias committed Jul 21, 2024
1 parent f2c4983 commit 6f75cd2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/lib/pagination/lines.mts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export function lines<T>({
isActive: index === active,
}));
const layoutsInPage = rotate(active - requested, layouts).slice(0, pageSize);
const renderItemAt = (index: number) => split(renderItem(layoutsInPage[index]!), width);
const renderItemAt = (index: number) =>
layoutsInPage[index] == null ? [] : split(renderItem(layoutsInPage[index]), width);

// Create a blank array of lines for the page
const pageBuffer: string[] = Array.from({ length: pageSize });
Expand Down

0 comments on commit 6f75cd2

Please sign in to comment.