modifyComponentProps not modifying the component props #2010
Unanswered
Adamduehansen
asked this question in
Help
Replies: 1 comment 1 reply
-
Hi @Adamduehansen , thanks for the submission. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Hi. I'm facing an issue with the Placeholder component from the Next.js JSS package. I want to modify the props that is parsed into each rendering and I assume that
modifyComponentProps
is made for this purpose. Take this exampleI would assume that the rendering "SomeRendering" would have
anotherProp
as a prop besides the usual (fields
,rendering
) when placed into this placeholder. It does not seem to work though.Looking at the code of the Placeholder component it looks like the
modifyComponentProps
that I pass to the Placeholder component is never used:jss/packages/sitecore-jss-nextjs/src/components/Placeholder.tsx
Line 21 in 83f002f
I'm reminded that I experienced this once before and made a PR on this issue: #1668. Is this intended behaviour and no bug? If it is a bug, I'm all good if the PR is rejected and you make the changes yourself, but could you look into it? I'm currenly moving from JSS 21 to JSS 22 and the other way I worked around this issue last year seems to be broken now.
Additional information
If I add

modifyComponentProps
to the placeholder, it adds that prop to the props of the component inside the placeholder. This is a screenshot of the props of my component (the SitecoreContext prop looks unusual because the screenshot is from a Storybook story) andmodifyComponentProps
is added here:Beta Was this translation helpful? Give feedback.
All reactions