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

Conversation

himaniraghav3
Copy link
Collaborator

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-1502

What's in this PR?

@@ -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.

@@ -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
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.

{' '}
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.

@himaniraghav3 himaniraghav3 merged commit 2e832a4 into feat/review Aug 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant