6

I have component

manifest.addComponent({
  name: 'MyComponentWithPlaceholder',
  icon: SitecoreIcon.DocumentTag,
  fields: [
    { name: 'heading', type: CommonFieldTypes.SingleLineText },
  ],
  placeholders: ['my-placeholder']
});

with implementation

const MyComponentWithPlaceholder = (props) => (
  <div>
    <p>My component with <strong>Placeholder</strong></p>
    <Text field={props.fields.heading} />
    <Placeholder name='my-placeholder' rendering={props.rendering} />
  </div>
);

and my-placeholder field Allowed Controls filled with some components...

Field Allowed Controls in my-placeholder item

But, when I'm trying to add this component to layout in experience editor, inner placeholder my-placeholder is behaving like it did not contain any allowed controls.

Empty dialog

However, after saving state of layout (in experience editor), my-placeholder let me correctly select component, that I'm allowed to add to parent component.

What I'm doing wrong? I don't want to save layout state after every added component.

2
  • 2
    I have the same, and use the save workaround. Feb 19, 2019 at 14:20
  • According Sitecore Support there is another workaround that can sometimes fit your needs. You can add a next placeholder settings with undefined key where you can set the allowed components. Of course, this will apply for all inner placeholders then in the same manner. Mar 22, 2019 at 6:48

1 Answer 1

1

You are not doing anything wrong. This is a known issue (documented in the Help Page of JSS Docs), and unfortunately it causes a lot of confusion for those encountering it for the first time.

Saving the page to resolve the issue is the current recommended workaround.

2
  • Hi, thanks for the info. I marked your answer as an accepted one, although the proposed workaround is far from an ideal solution. Instructs content editors to save the page if a Renderings dialog is empty feels wrong... Sep 23, 2020 at 11:33
  • 1
    Totally agreed. We have this in our backlog.
    – Anastasiya
    Sep 24, 2020 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.