Wp-calypso: Full Site Editing: new page WSOD on Simple Sites

Created on 17 Jul 2019  ·  8Comments  ·  Source: Automattic/wp-calypso

Trying the recently deployed version of FSE on Simple sites produces WSOD when trying to edit a new page.

Note that you'll need to assign correct taxonomy terms to your CPTs manually. This is expected since we still haven't merged the automated data population functionality on Dotcom, so they would refuse to render otherwise.

screenshot-2019-06-12-at-17 46 11
screenshot-2019-06-12-at-17 46 25

This can be added in Gutenberg's sidebar manually:

Screenshot 2019-07-17 at 00 23 42

After that is set up, the rendering and editing should work correctly for exiting pages.
However, when trying to create a new page I'm running into WSOD with the following error:

Uncaught (in promise) TypeError: Cannot read property 'attributes' of undefined
    at ke (index.js?m=1562960750h&ver=1562960750:2)
    at index.js?m=1562960750h&ver=1562960750:2
    at c (lodash.min.js?m=1540208548h&ver=4.17.11:6)
    at ru (lodash.min.js?m=1540208548h&ver=4.17.11:67)
    at gn (index.js?m=1562960750h&ver=1562960750:2)
    at index.js?m=1562960749h&ver=1562960749:17
    at tryCatch (wp-polyfill.min.js?m=1550600082h&ver=7.0.0:3)
    at Generator.invoke [as _invoke] (wp-polyfill.min.js?m=1550600082h&ver=7.0.0:3)
    at Generator.t.<computed> [as next] (wp-polyfill.min.js?m=1550600082h&ver=7.0.0:3)
    at index.js?m=1562960748h&ver=1562960748:1

I've noted this issue before on self-hosted setup here: https://github.com/Automattic/wp-calypso/issues/34481 and tracked it down to a PR that seemed to introduce it there, but I couldn't repro it in that environment since.

[Goal] Full Site Editing [Pri] Normal [Type] Bug

All 8 comments

As @mmtr found out:

I patched that function on my sandbox to return a single line string (<!-- wp:a8c/template {"templateId":1657} /--><!-- wp:a8c/post-content /--><!-- wp:a8c/template {"templateId":1658} /-->) and I don't get the WOSD anymore

So the WSOD is caused by having spaces or new lines in the page template content. This seems to be related to the fact that we are still inserting this content manually on Dotcom, which in the end produces these spaces in get_template_content.

Decreased the priority since this will be likely solved once we have the automated data population functionality on WP.com.

Decreased the priority since this will be likely solved once we have the automated data population functionality on WP.com.

@mmtr based on my latest testing I'm not sure if this will be the case. I've executed the same data population method on my Dotcom test site to try to replicate the content without spaces (e.g. not manually entered one), and I still get the WSOD when trying to create a new page.

@mmtr based on my latest testing I'm not sure if this will be the case. I've executed the same data population method on my Dotcom test site to try to replicate the content without spaces (e.g. not manually entered one), and I still get the WSOD when trying to create a new page.

Does that mean that you created the data manually from the editor without entering new lines in between? I tried the same and even though the new lines were added automatically (not sure why, maybe wpautop?). Can you debug what A8C_WP_Template::get_template_content is returning on your testing?

If I add the data programmatically (after applying https://github.com/Automattic/themes/pull/1062 to my sandbox), A8C_WP_Template::get_template_content doesn't return any extra line and I don't get the WSOD.

Does that mean that you created the data manually from the editor without entering new lines in between? I tried the same and even though the new lines were added automatically (not sure why, maybe wpautop?). Can you debug what A8C_WP_Template::get_template_content is returning on your testing?

No, I executed the code that FSE provides for that - https://github.com/Automattic/wp-calypso/blob/4612c223c8224d832687fb0cc3f51b9e0682bd78/apps/full-site-editing/full-site-editing-plugin/full-site-editing/utils/class-a8c-wp-template-data-inserter.php#L15 on plugin initialization (manually edited the code on my sandbox just for this test run).

Here's the dump of my A8C_WP_Template::get_template_content:

'<!-- wp:a8c/template {"templateId":31,"align":"full"} /-->

<!-- wp:a8c/post-content {"align":"full"} /-->

<!-- wp:a8c/template {"templateId":32,"align":"full"} /-->'

Still seems to be returning newlines - not sure why it populated data differently in this case. 🤔 Maybe some preprocessing (e.g. wpautop) is not happening on theme switch.

I merged the following PRs:

https://github.com/Automattic/wp-calypso/pull/34640
https://github.com/Automattic/themes/pull/1062

Based on https://github.com/Automattic/wp-calypso/issues/34689#issuecomment-512056222 I'm going to close this. I'll reopen it if it turn out that automatic data population by themes doesn't resolve it.

@mmtr I verified that this is now working as expected with new theme approach in D30622-code.

Was this page helpful?
0 / 5 - 0 ratings