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: fixed Pagination, NextLink and PreviousLink return types #1774

Merged
merged 3 commits into from Feb 27, 2024

Conversation

lorenzo-del-rosario
Copy link
Contributor

@lorenzo-del-rosario lorenzo-del-rosario commented Feb 19, 2024

Fixing Pagination, PreviousLink and NextLink returning an invalid JSX element type.

Error:

'Pagination' cannot be used as a JSX component.
  Its type '<NodesType>({ connection, children, }: PaginationProps<NodesType>) => ReactNode' is not a valid JSX element type.
    Type '<NodesType>({ connection, children, }: PaginationProps<NodesType>) => ReactNode' is not assignable to type '(props: any) => ReactElement<any, any> | null'.
      Type 'ReactNode' is not assignable to type 'ReactElement<any, any> | null'.
        Type 'undefined' is not assignable to type 'ReactElement<any, any> | null'.

Screenshot 2024-02-19 at 12 32 30 pm

Dependencies:

    "@remix-run/react": "2.1.0",
    "@shopify/cli": "3.52.0",
    "@shopify/cli-hydrogen": "^7.0.0",
    "@shopify/hydrogen": "^2024.1.0",
    "@shopify/remix-oxygen": "^2.0.3",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",

WHAT is this pull request doing?

ChangesPagination, PreviousLink and NextLink types to rely on the React FunctionalComponent type to give a more consistent typing and align better to React types.

HOW to test your changes?

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@lorenzo-del-rosario lorenzo-del-rosario marked this pull request as ready for review February 19, 2024 02:10
@lorenzo-del-rosario
Copy link
Contributor Author

I have signed the CLA!

Copy link
Contributor

@frandiox frandiox left a comment

Choose a reason for hiding this comment

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

Thanks!

@blittle I think this is probably correct, right?

packages/hydrogen/src/pagination/Pagination.ts Outdated Show resolved Hide resolved
@lorenzo-del-rosario
Copy link
Contributor Author

@frandiox am I required to do something else for the PR to be merged?

Copy link
Contributor

@blittle blittle left a comment

Choose a reason for hiding this comment

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

Thank you!

@blittle blittle merged commit d7e04cb into Shopify:main Feb 27, 2024
8 of 9 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.

None yet

3 participants