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

[Next.js] Component props auto-injection by Placeholder #884

Merged
merged 5 commits into from
Dec 13, 2021
Merged

Conversation

illiakovalenko
Copy link
Contributor

@illiakovalenko illiakovalenko commented Dec 13, 2021

Description / Motivation

Currently, after implementing getStaticProps or getServerSideProps using our component-level data fetching, you need to use useComponentProps to get at the retrieved values. Your component props then also need to include the rendering so that you can get at the rendering uid which is needed when calling this hook. Implementing Storybook stories for such components requires that you mock the full component props context, further complicating use.

We should take advantage of the fact that we own this component's creation, and retrieve/merge the props within the placeholder logic. This may require refactoring the React placeholder to allow Next.js to add this logic/props to the component creation.

Testing Details

Types of changes

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

@vercel
Copy link

vercel bot commented Dec 13, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sitecore-jss/edge-e2e-styleguide/5pYsodEMRm7qhNo5XTNSFP3Y2fWR
✅ Preview: Failed

[Deployment for 44ef0f9 failed]

Copy link
Contributor

@addy-pathania addy-pathania left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@ambrauer ambrauer left a comment

Choose a reason for hiding this comment

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

This looks great!

@ambrauer ambrauer merged commit b873900 into dev Dec 13, 2021
@ambrauer ambrauer deleted the feature/466681 branch December 13, 2021 19:49
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.

3 participants