silverstripe / silverstripe-elemental

Create pages in Silverstripe CMS using content blocks
http://dna.co.nz
BSD 3-Clause "New" or "Revised" License
110 stars 115 forks source link

Elemental in-line editor never loads when extension is added to existing pages #496

Closed ScopeyNZ closed 5 years ago

ScopeyNZ commented 6 years ago

Affected Versions

4.x

Description

When adding the ElementalPageExtension to a page type after some pages have already been added the element editor on the CMS for the page will never load. This is because there is no ElementalArea in the database for that page.

Steps to reproduce

Notes

In this case GraphQL is kicking up a fuss because a null/zero ElementalAreaId is not considered valid.

I've listed this as medium impact because it's usually recommended that a page type is created specifically for elemental and then this issue would not occur - it's hard to create a page type for elemental and have a period where it's not using the elemental extension.

robbieaverill commented 6 years ago

You should probably run a dev/build as well as a flush in order to scaffold the elemental relationships for the page, but we can also probably build in some edge case handling for this as well

NightJar commented 5 years ago

PR https://github.com/dnadesign/silverstripe-elemental/pull/537 Needs tests. Maybe. Unsure.

ScopeyNZ commented 5 years ago

I was considering how to test this and I couldn't think of a good way. You'd need a behat test or something because you have to run a dev/build as a step within the test.

NightJar commented 5 years ago

I have been considering it for some time now, and am not sure it's worth testing. I updated the comment on the PR itself with my thoughts.

ScopeyNZ commented 5 years ago

Closed in #537