Skip to content
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

[Bug]: Pagination behavior change for unknown total items #16298

Closed
2 tasks done
finken2 opened this issue May 1, 2024 · 0 comments · Fixed by #16306
Closed
2 tasks done

[Bug]: Pagination behavior change for unknown total items #16298

finken2 opened this issue May 1, 2024 · 0 comments · Fixed by #16306

Comments

@finken2
Copy link
Contributor

finken2 commented May 1, 2024

Package

@carbon/react

Browser

Chrome

Package version

v1.56.0

React version

v16

Description

The gist of the issue is the next page button gets disabled when passing undefined for total items. In a case where the user is doing server-side paging, they don't know the total items, so we were passing undefined to represent that.

This PR added a default to totalItems in Pagination. Previously, we were passing undefined for totalItems in the case of server-side paging, which worked fine. Now, totalItems gets defaulted to 1 and the next page button gets disabled.

It looks like typescript was complaining when the default wasn't there, but we can make other changes to make typescript happy. Was there another reason the default needed to be added? I wouldn't think so; doesn't seem logical to just default to 1 total item.

I can put out a PR to fix this too, but would like confirmation on the expectation. There's also another oddity with how the dropdown works for pages in this scenario that we can talk more about on Slack.

Reproduction/example

https://stackblitz.com/edit/github-uanwpm?file=src%2FApp.jsx

Steps to reproduce

Set up pagination with pagesUnknown and don't pass totalItems.

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

cloud-pal-community and consumers in IBM

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant