tomjn/Frontenberg

Does not Work with Page Post Type

Closed this issue · 8 comments

It works great with 'post' post type but when I am trying to use for page post type it does not work for logged out users on frontend.

It works for logged in users.

tomjn commented

@techjewel I can replicate with just the 5.0 block editor, I'm assuming you forgot to activate the gutenberg plugin? having ti working with the 5.0 built in block editor was never signed off as fully working

tomjn commented

@techjewel Having looked further in to it, I see no errors, no missing code on the frontend, or network traffic.

I cannot explain why this happens, and have no further leads of investigation, I can help no further.

Using the initialising JS, it does try to register the blocks etc, but for whatever reason it never creates the UI. Re-running it reports that the various blocks have already been created, but no change

I'm encountering this. For posts, it works fine. But for Pages, when logged in it works, but it errors out when logged out.

Error:

Uncaught TypeError: Cannot read property 'then' of undefined at (index):270

Here's a screenshot of the code:

screen shot 2019-02-26 at 9 45 41 pm

Encountered with fresh WP 5.1 install and no plugins.

Steps to replicate:

  1. Install Frontenberg theme
  2. Create and publish new page with any content
  3. Visit newly published page in incognito mode
tomjn commented

@bfintal are you sure that's the cause? I'm aware of that particular issue but it's been present long before pages stopped working, and it doesn't occur for me when I try to load a page

tomjn commented

@bfintal that code has nothing to do with the GB loading sequence, it's meant to intercept requests to the REST API to make changes and cancel them before they get sent, I've made adjustments in 7216a26 that fix a typo, add a guard for if it's undefined, and increase the timeout to 1s to run. Keep in mind that for it to work it requires a block editor, whereas the problem in this issue is that there is no block editor

Just checked again. The error is gone and doesn't show anything now :(

Seems it stopped working with 'post' post types as well! If you're not logged in user, you'll get the following error on WP 5.2.1:

HTTP401: DENIED - The requested resource requires user authentication.
(Fetch)GET - http://localhost/wordpress/wp-json/wp/v2/types?context=edit&_locale=user
{code: "rest_cannot_view",  message: "Sorry, you are not allowed to edit posts in this post type."}
tomjn commented

It works fine with Gutenberg 5.8 here on posts

Just remember, Frontenberg is not a frontend editor, and it isn't something I support as such. If you're trying to use this for client work, I consider that a mistake, and would strongly advise against it.

It was never intended to be production ready, or as a means of editing posts on the frontend. Only as a way for users to test out the editor in a sandbox without installing the plugin on a site. I make no guarantees that it is safe or secure for that use. Use at your own risk.

Since this doesn't affect frontenberg.tomjn.com I'm going to close this out. If anybody finds a solution feel free to make a PR.

Otherwise, if you want to do things with blocks on the frontend, use the BlockList and BlockProvider components