1
votes

The Scenario Sitecore 8 site, we have a component called Related Video Panel that has one field for the title, and a placeholder that allows the editor to drop onto it Related Video components using the experience editor.

Related Video Panel and Related Video are both MVC controller renderings populated via GlassMapper.

The Issue - Steps to recreate (all via Experience Editor)

  1. Drop Related Video Panel on the right rail. When prompted for the datasource, choose create new and name it Panel1.
  2. Save
  3. Drop a Related Video component on the panel created in step 1
  4. Save
  5. Remove the entire component from the right rail by clicking the red X
  6. Save.
  7. Repeat step 1, again creating a brand new panel, naming it Panel2

Following step 7, I expected a blank Related Video Panel, but instead we are presented a Related Videos Panel with Related Videos already added to it.

Troubleshooting thus far I tested that the panel was new by adding a title each time I dropped it on the page. The title is fresh every time, so I know it's showing a fresh panel, even when the renderings are incorrectly showing up.

I've also verified that the presentation details on the new tab panel are empty, so so there's no renderings explicitly set on the item's presentation details that would make them show up.

I verified that it must be related to the specific placeholder because if I follow the steps above on a different placeholder on the same page, I get the blank panel as expected.

Summary This does seem like it could be a Sitecore bug, though I hesitate to go there without further investigation/discussion. There may be something else in my configuration messing this up. I'm stumped and I'm not sure what else to investigate. I might open a ticket with Sitecore as well. Does anyone have any experience with such an issue?

1
This is standard Sitecore behavior. When you remove the Panel the nested components are not removed, you can verify this by checking the components on the Presentation Details. When you add the Panel again, the existing component is still bound to the Panel Placeholder, thus reappears.jammykam
I never thought of it working that way but it makes sense. I'll play around with it more tonight.tjans
@jammykam I would convert your comment to an answer.Dmytro Shevchenko

1 Answers

2
votes

The problem you have described is standard behaviour in Sitecore unfortunately. When you remove a control which defines the placeholder, the components placed within those placeholders are not removed but instead are left orphaned. You can confirm this by looking at the Presentation Details and you can verify that those nested rendering are still listed. When you add the Panel with the placeholder again the existing renderings reappear since they are still bound to that placeholder key.

You would have to write some custom code, hooking into item:saving and then checking the Layout/Final Layout field for the any orphaned renderings and then removing them.