Skip to content

Fix pagination text and no records message #1194

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

Merged
merged 1 commit into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export const TableScorecards: FC<Props> = (props: Props) => {
const { width: screenWidth }: WindowSize = useWindowSize()
const isTablet = useMemo(() => screenWidth <= 1000, [screenWidth])

const start = (props.page - 1) * (props.perPage ?? 0) + 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a default value for props.perPage to avoid potential issues if it is undefined. For example, you could use a default value of 1 or another appropriate number.

const end = Math.min(props.page * (props.perPage ?? 0), props.metadata?.total ?? 0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous line, ensure that props.perPage has a sensible default value to prevent unexpected behavior if it is undefined.


const columns = useMemo<TableColumn<Scorecard>[]>(
() => [
{
Expand Down Expand Up @@ -153,12 +156,15 @@ export const TableScorecards: FC<Props> = (props: Props) => {
)}
<div className={styles.pagination}>
<div className={styles.paginationText}>
Showing 1-
{props.perPage}
Showing
{' '}
{start}
-
{end}
{' '}
of
{' '}
{props.metadata.total}
{props.metadata?.total ?? 0}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a default value for props.metadata.total directly in the destructuring assignment or initialization to avoid using the nullish coalescing operator here.

{' '}
results
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const ScorecardsListPage: FC<{}> = () => {
) : (
<>
{scorecards.length === 0 ? (
<TableNoRecord />
<TableNoRecord message='No scorecards were found that meet your criteria.' />
) : (
<TableScorecards
onClone={handleScorecardClone}
Expand Down