statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.8k stars 517 forks source link

Root Page can be added as a child in editor #5426

Closed splitmango-jenna closed 1 year ago

splitmango-jenna commented 2 years ago

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

duncanmcclean commented 2 years ago

Confirmed - recorded a quick video to demonstrate:

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

gausoft commented 2 years ago

I accidentally stumbled upon this bug, any workaround?

mmodler commented 2 years ago

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

christianhanne commented 2 years ago

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.

tomhelmer commented 1 year ago

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.

mmodler commented 1 year ago

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

ThorbenG commented 1 year ago

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

mmodler commented 1 year ago

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