prismicio / prismic-react

React components and hooks to fetch and present Prismic content
https://prismic.io/docs/technologies/homepage-reactjs
Apache License 2.0
154 stars 40 forks source link

fix: better support for custom `<PrismicLink>` components using `forwardRef()` #132

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Types of changes

Description

This PR fixes a regression introduced by #131. Due to the way #131 implemented type-parameter-aware ref forwarding, projects using @prismicio/react could not manually declare a component's displayName property.

This PR also fixes a type bug related to the ref prop. It widens the ref element type to Element to support any valid HTML/SVG/etc. element. Note that an individual <PrismicLink> may not have enough information to determine which component is rendered since custom components can be provided to <PrismicProvider>. Element is the safest option.

Checklist:

codecov-commenter commented 2 years ago

Codecov Report

Merging #132 (4e2e970) into master (127a9ca) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #132   +/-   ##
=======================================
  Coverage   92.67%   92.67%           
=======================================
  Files          16       16           
  Lines         273      273           
  Branches       61       61           
=======================================
  Hits          253      253           
  Misses          5        5           
  Partials       15       15           
Impacted Files Coverage Δ
src/PrismicLink.tsx 96.96% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 127a9ca...4e2e970. Read the comment docs.

github-actions[bot] commented 2 years ago

size-limit report 📦

Path Size
dist/index.js 4.42 KB (0%)
dist/index.cjs 6.3 KB (0%)