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

feat: support extended media API response #326

Merged
merged 7 commits into from
Oct 6, 2023

Conversation

lihbr
Copy link
Member

@lihbr lihbr commented Sep 29, 2023

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Context: https://prismic-team.slack.com/archives/C014VAACCQL/p1695984909427609

I considered the new properties as optional because users will need to trigger a master ref release for them to appear, but maybe we don't need to? 🤔

This is to be released in sync with API changes in November.

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (26d5b0f) 99.97% compared to head (ce9d095) 99.97%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #326   +/-   ##
=======================================
  Coverage   99.97%   99.97%           
=======================================
  Files          59       59           
  Lines        6843     6852    +9     
  Branches      376      376           
=======================================
+ Hits         6841     6850    +9     
  Misses          2        2           
Files Coverage Δ
src/helpers/asImageWidthSrcSet.ts 100.00% <100.00%> (ø)
src/types/value/richText.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@angeloashmore
Copy link
Member

I think we can remove the ? from the properties in this case. Developers are unlikely to use the properties anytime soon, if ever, at which point their master ref has probably already been updated.

Following that logic, should we also remove the ? from Slice's id property?

Otherwise, everything looks good to merge when the API is updated.

@lihbr
Copy link
Member Author

lihbr commented Oct 4, 2023

Should be good @angeloashmore, type tests are failing however due to #318, do you want me to finish it?

@angeloashmore
Copy link
Member

@lihbr Awesome! I made a few changes to fix the tests, which uncovered a small bug.

  • I added // @ts-expect-error to some of the tests that use @prismicio/mock. Because mock uses @prismicio/client as a dependency, it doesn't have the updated types that @prismicio/client is looking for. We can remove the // @ts-expect-error comments once we publish these type changes.

  • There was a bug in how asImageWidthSrcSet() extracted thumbnails. It tried to use the id and edit properties as thumbnails, which threw an error, of course.

With those fixes, we are good to merge once the updates go live!

@lihbr lihbr merged commit 5e5d057 into master Oct 6, 2023
12 checks passed
@lihbr lihbr deleted the feat/support-extended-media-api-response branch October 6, 2023 09:00
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