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: <TodoSliceComponent /> compat with Slice Mapper #202

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

lihbr
Copy link
Member

@lihbr lihbr commented Mar 27, 2024

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

Mapped slices would cause the <TODOSliceComponent /> component to throw because of a different interface used by mapped slices (slice type being top level instead of nested under the slice property).

This standardizes the props given to <TODOSliceComponent /> so everything keeps working smoothly based on our Svelte implementation: https://github.com/prismicio/prismic-svelte/blob/master/src/SliceZone/SliceZone.svelte#L118-L128

I first explored adapting the <TODOSliceComponent /> to support different interfaces instead, but it resulted in messier code in my opinion: https://github.com/prismicio/prismic-vue/blob/95d5771b51dc45df5bd6663178afceae8942dc4c/src/components/SliceZone.ts#L263-L280 (hence the sister PR for Vue: prismicio/prismic-vue#70)

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.

@lihbr lihbr requested a review from angeloashmore March 27, 2024 14:24
Copy link

size-limit report 📦

Path Size
./dist/index.cjs 8.03 KB (+0.1% 🔺)
./dist/index.js 6.05 KB (+0.13% 🔺)
./dist/react-server.cjs 7.22 KB (+0.14% 🔺)
./dist/react-server.js 5.58 KB (+0.2% 🔺)

@angeloashmore
Copy link
Member

Thanks, good catch! This version is simple to read.

@angeloashmore angeloashmore merged commit 0fd4313 into master Mar 27, 2024
1 check passed
@angeloashmore angeloashmore deleted the fix/todo-slice-component branch March 27, 2024 18:44
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.

2 participants