Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching Error in Preview if InnerBlock has too much content #144

Closed
rocketluz opened this issue Jun 28, 2023 · 3 comments
Closed

Fetching Error in Preview if InnerBlock has too much content #144

rocketluz opened this issue Jun 28, 2023 · 3 comments

Comments

@rocketluz
Copy link

Bug summary

If a page hast one or more genesis-custom-blocks (gcb) and one of them has an innerBlock with too much content, all gcb will be shown as offline (preview not shown). The reason for it is, that the content of the innerBlock is added as query parameter (inner_blocks) to the query URL. In some cases, this query parameter gets too long.

Steps to reproduce

  1. Create a gcb with the field type innerBlock
  2. As preview you can add any Text or just add {{ $inner_block }}
  3. Add this gcb to the page and add a lot of content to it
  4. Now the preview is not showing up. Instead a php-warning is shown
  5. If you add some other gcb, then save and reload the page -> all previews of gcb failed
  6. when you edit a gcp (not the gcb from section 1), the preview is now shown for this gcb

Expected behavior

  1. the preview for all gcb is showing up correctly
  2. for gcb with an innerBlock in the preview is shown the content or give a hint that it is only visible in edit-mode (if too much content)

Actual behavior

image

JS Console

image

Additional information

  • Problem occurs with the introduction of the new Feature "Allow previewing InnerBlocks in the block editor" (plugin v1.4.1)
    Allow previewing InnerBlocks in the block editor #114
  • My suggestion is to limit the length of the query parameter inner_block and if it is reached, add a hint that the content is not visible in the preview

Suspected cause (optional)

  • some server has restrictions of url length or query length

Versions

  • WordPress version: 6.2.2
  • Genesis Custom Blocks version: v1.5.1
  • Browser: Google Chrome
image
@rocketluz
Copy link
Author

Here is an actual workaround I made to handle it.

genesis-custom-blocks-pro_innerblock-workaround.zip

@kienstra
Copy link
Contributor

Hi @rocketluz,
Thanks for opening this, and you're right that it's a bug, and one that a lot of people have found.

But I don't see a clean fix to it.

@rocketluz
Copy link
Author

Hi @kienstra

I understand, I haven't found a clever solution myself that works in every case. However, I have a suggestion for a solution. With the help of a checkbox in the settings of the inner block, you could define whether the content should be displayed in the preview or whether a note should be displayed. It would be even better if, instead of the checkbox, you could define a maximum content length that is displayed in the preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants