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 component return type #1635

Merged
merged 1 commit into from
Jun 30, 2022
Merged

Fix Pagination component return type #1635

merged 1 commit into from
Jun 30, 2022

Conversation

robinmetral
Copy link
Contributor

Purpose

Currently, the Pagination component is typed as a ReactNode.

This can be a problem for apps using React 18, because ReactNode can be undefined, and undefined isn't a valid JSX component.

image

Approach and changes

Switch the return type to ReactElement | null.

This is more accurate, since the Pagination component never returns e.g. undefined, a string, or an array of ReactElements (all included in the definition of ReactNode).

It can either be null (when there are less than two pages) or a ReactElement otherwise.

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

@robinmetral robinmetral requested a review from a team as a code owner June 30, 2022 07:06
@robinmetral robinmetral requested review from connor-baer and removed request for a team June 30, 2022 07:06
@sumup-clark
Copy link

sumup-clark bot commented Jun 30, 2022

Hey @robinmetral,
we are super excited that you are contributing! 🎉There's one more thing you need to do. Please accept our Contributor License Agreement. It helps you and us to collaborate on clear terms and focus on what we love most: code.

Thanks!

@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2022

🦋 Changeset detected

Latest commit: d250162

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sumup/circuit-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
oss-circuit-ui ✅ Ready (Inspect) Visit Preview Jun 30, 2022 at 7:06AM (UTC)

@codecov
Copy link

codecov bot commented Jun 30, 2022

Codecov Report

Merging #1635 (d250162) into main (5e4a9e7) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1635   +/-   ##
=======================================
  Coverage   91.54%   91.54%           
=======================================
  Files         195      195           
  Lines        4080     4080           
  Branches     1296     1296           
=======================================
  Hits         3735     3735           
  Misses        326      326           
  Partials       19       19           
Impacted Files Coverage Δ
...es/circuit-ui/components/Pagination/Pagination.tsx 81.57% <100.00%> (ø)

@robinmetral robinmetral added the 🚢 ready to merge Automatically merge the PR once all requirements are met label Jun 30, 2022
'@sumup/circuit-ui': patch
---

Changed `Pagination` type from `ReactNode` to `ReactElement | null` to prevent a clash with React 18 types.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Changed `Pagination` type from `ReactNode` to `ReactElement | null` to prevent a clash with React 18 types.
Changed `Pagination` return type from `ReactNode` to `ReactElement | null` to prevent a clash with React 18 types.

Copy link
Member

Choose a reason for hiding this comment

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

Aaah, Kodiak was too fast 😅

@kodiakhq kodiakhq bot merged commit 5c2ea97 into main Jun 30, 2022
@kodiakhq kodiakhq bot deleted the fix-pagination-type branch June 30, 2022 07:10
@connor-baer connor-baer mentioned this pull request Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗂 circuit-ui 🚢 ready to merge Automatically merge the PR once all requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants