prismicio / prismic-helpers

Set of helpers to manage Prismic data
https://prismic.io/docs/technical-reference/prismicio-helpers
Apache License 2.0
15 stars 9 forks source link

fix: include `url` property when using `asLink()` with a document #48

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Types of changes

Description

This PR updates the LinkResolverFunction type to include the url property.

When Route Resolver and Link Resolver are both used in an app, the url property may be filled. This lets developers to check the url property in a Link Resolver for something like the following:

const linkResolver = (doc) => {
  if (doc.url === "/home") {
    return "/";
  }
};

The asLink() and documentToLinkField() already behaved this way, but the type of LinkResolverFunction did not allow it.

Checklist:

🚡

codecov-commenter commented 2 years ago

Codecov Report

Merging #48 (77307a0) into master (2a1ad82) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##            master       #48   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          198       198           
  Branches        47        47           
=========================================
  Hits           198       198           

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 2a1ad82...77307a0. Read the comment docs.

github-actions[bot] commented 2 years ago

size-limit report 📦

Path Size
dist/index.js 3.12 KB (0%)
dist/index.cjs 3.64 KB (0%)
lihbr commented 2 years ago

Makes total sense to me! Merged the PR, did not publish, feel free to ☺️