cms icon indicating copy to clipboard operation
cms copied to clipboard

Root Page can be added as a child in editor

Open splitmango-jenna opened this issue 2 years ago • 3 comments

Bug description

When Editing the Root Page in Control Panel, if you set the Root Page's parent you will get the error : "Root page cannot have children"

Screen Shot 2022-03-07 at 11 37 33 AMScreen Shot 2022-03-07 at 11 37 40 AM

Even though the error shows, the page successfully saves. Also, the error is saying Root Page cannot have children, but the Root Page has been set as a child.

Screen Shot 2022-03-07 at 10 48 10 AM

This creates a 500 error on the Front End, and forever loading on the CP pages collection.

Screen Shot 2022-03-07 at 10 48 35 AM

How to reproduce

  1. log into Control Panel
  2. edit Root page
  3. Set Root Page's parent to other page in tree
  4. Save the Root Page
  5. Reload the CP/font end

Logs

Root page cannot have children {"userId":"user-id","exception":"[object] (Exception(code: 0): Root page cannot have children at path/vendor/statamic/cms/src/Structures/Structure.php:93)

Versions

Version: 3.2.31

*tried updating to lates (3.2.36) and it did not solve the issue

Installation

Starter Kit using via CLI

Additional details

No response

splitmango-jenna avatar Mar 07 '22 19:03 splitmango-jenna

Confirmed - recorded a quick video to demonstrate:

https://www.loom.com/share/30b02f01cc06409fac224c4dfc7bfb44

duncanmcclean avatar Mar 11 '22 22:03 duncanmcclean

I accidentally stumbled upon this bug, any workaround?

gausoft avatar Apr 20 '22 13:04 gausoft

We just had a broken website with "Root page cannot have children" - are there plans to fix this?

mmodler avatar Aug 31 '22 06:08 mmodler

We had a similar issue. Not sure, if adding the root page as a child was the case here. There might be another way to accidentally break the site through the control panel. I would like to suggest that the CMS than maybe outputs a warning during stache:warm, but don't completely fail.

If the root page is not supposed to have children... ok. But maybe just remove them during the stache:warm process and display an error like "Root page can not have children. Statamic won't display them, make sure to move them to another parent element in the control panel." Failing completely in this case seems a little bit excessive here.

christianhanne avatar Sep 22 '22 11:09 christianhanne

I can confirm that setting the root page as parent when creating a new page results in this issue. This is a major issue as normal editor behaviour breaks the entire site.

tomhelmer avatar Oct 12 '22 11:10 tomhelmer

Thanks @tomhelmer ! We had broken sites because of this issue but we had no info how to reproduce. Now its clear.

mmodler avatar Oct 12 '22 12:10 mmodler

Yes we have the same issue, we can add an entry and add the root page as a parent and that breakes the site.

ThorbenG avatar Oct 20 '22 12:10 ThorbenG

I just repaired a broken production site with "Root page cannot have children". Any news on this?

mmodler avatar Nov 02 '22 13:11 mmodler