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

fix(Pagination): handle unknown totalItems again #16306

Merged
merged 4 commits into from
May 7, 2024

Conversation

finken2
Copy link
Contributor

@finken2 finken2 commented May 2, 2024

Closes #16298

a previous PR broke the ability to use pagesUnknown and totalItems. This fixes that and these things:

  • next page button no longer gets disabled
  • don't render the Select for page selection when pagesUnknown. (it previously rendered and did nothing)
  • Fix text for "page x" when pagesUnknown
  • Adds some margin next to that text so it looks better
  • Add a story for pagesUnknown and totalItems undefined
  • Simplify some of the logic where there were unneeded ternaries and double checks

Changelog

Changed

  • Pagination: revert previous change that defaulted totalItems to 1
  • Pagination: don't render non-functional page dropdown when pagesUnknown

Testing / Reviewing

New story in storybook
unit test added
send totalItems undefined

image

@finken2 finken2 requested a review from a team as a code owner May 2, 2024 19:53
@finken2 finken2 requested review from tw15egan and guidari May 2, 2024 19:53
Copy link

netlify bot commented May 2, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c227699
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/663a35d7d6be0c0008ee567a
😎 Deploy Preview https://deploy-preview-16306--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

This is a really solid improvement, thanks for tackling it! I'm not sure why we didn't do something like this earlier. Your solution here is much better than what I was previously recommending in #9754

I do think a better long-term alternative to not rendering the select would be a number input, #5546

@finken2 finken2 requested a review from a team as a code owner May 7, 2024 14:08
@finken2 finken2 requested a review from alisonjoseph May 7, 2024 14:08
Copy link
Member

@alisonjoseph alisonjoseph left a comment

Choose a reason for hiding this comment

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

Nice!

@alisonjoseph alisonjoseph added this pull request to the merge queue May 7, 2024
Merged via the queue into carbon-design-system:main with commit eb5e10f May 7, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Pagination behavior change for unknown total items
3 participants