Problem/Motivation
When adding blocks to the page I receive an AJAX error in the console and an error in the logs. The block does not appear in the layout section and the tray does not disappear.
However, if I refresh the page, the block will be there and I can move it and save the layout.
This is happening specifically with a views block that has no results sometimes, but I have seen it with other custom blocks in the past as well.
The first time I saw this issue installing the layout_builder_admin_theme module fixed the issue ( it existed on both bartik and our custom theme, but not seven).
Ajax error:
message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /layout_builder/add/block/overrides/node.3/0/content/goal_check_in?_wrapper_format=drupal_dialog.off_canvas&ajax_form=1\nStatusText: OK\nResponseText: "
name: "AjaxError"
stack: "@http://site.lndo.site/sites/default/files/js/js_cYXgoEW1m59yF277COwNKRUOm2M5DVGlxiYVwUl7QSA.js:1309:32\n@http://site.lndo.site/sites/default/files/js/js_cYXgoEW1m59yF277COwNKRUOm2M5DVGlxiYVwUl7QSA.js:1903:3\n"
PHP Error
TypeError: Argument 1 passed to Drupal\Core\Cache\CacheableMetadata::createFromRenderArray() must be of the type array, null given, called in /app/web/core/modules/layout_builder/src/EventSubscriber/BlockComponentRenderArray.php on line 110 in Drupal\Core\Cache\CacheableMetadata::createFromRenderArray() (line 149 of /app/web/core/lib/Drupal/Core/Cache/CacheableMetadata.php)
#0 /app/web/core/modules/layout_builder/src/EventSubscriber/BlockComponentRenderArray.php(110): Drupal\Core\Cache\CacheableMetadata::createFromRenderArray(NULL)
#1 [internal function]: Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender(Object(Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent), 'section_compone...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#2 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent), 'section_compone...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#3 /app/web/core/modules/layout_builder/src/SectionComponent.php(90): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('section_compone...', Object(Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent))
#4 /app/web/core/modules/layout_builder/src/Section.php(88): Drupal\layout_builder\SectionComponent->toRenderArray(Array, true)
#5 /app/web/core/modules/layout_builder/src/Element/LayoutBuilder.php(250): Drupal\layout_builder\Section->toRenderArray(Array, true)
#6 /app/web/core/modules/layout_builder/src/Element/LayoutBuilder.php(123): Drupal\layout_builder\Element\LayoutBuilder->buildAdministrativeSection(Object(Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage), 0)
#7 /app/web/core/modules/layout_builder/src/Element/LayoutBuilder.php(97): Drupal\layout_builder\Element\LayoutBuilder->layout(Object(Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage))
#8 [internal function]: Drupal\layout_builder\Element\LayoutBuilder->preRender(Array)
#9 /app/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(100): call_user_func_array(Array, Array)
#10 /app/web/core/lib/Drupal/Core/Render/Renderer.php(781): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'silenced_deprec...', 'Drupal\\Core\\Ren...')
#11 /app/web/core/lib/Drupal/Core/Render/Renderer.php(372): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#12 /app/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender(Array, true)
#13 /app/web/core/lib/Drupal/Core/Render/Renderer.php(144): Drupal\Core\Render\Renderer->render(Array, true)
#14 /app/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#15 /app/web/core/lib/Drupal/Core/Render/Renderer.php(145): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#16 /app/web/core/lib/Drupal/Core/Ajax/CommandWithAttachedAssetsTrait.php(36): Drupal\Core\Render\Renderer->renderRoot(Array)
#17 /app/web/core/lib/Drupal/Core/Ajax/ReplaceCommand.php(31): Drupal\Core\Ajax\InsertCommand->getRenderedContent()
#18 /app/web/core/lib/Drupal/Core/Ajax/AjaxResponse.php(43): Drupal\Core\Ajax\ReplaceCommand->render()
#19 /app/web/core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php(47): Drupal\Core\Ajax\AjaxResponse->addCommand(Object(Drupal\Core\Ajax\ReplaceCommand))
#20 /app/web/core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php(26): Drupal\layout_builder\Form\ConfigureBlockFormBase->rebuildLayout(Object(Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage))
#21 /app/web/core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php(242): Drupal\layout_builder\Form\ConfigureBlockFormBase->rebuildAndClose(Object(Drupal\layout_builder\Plugin\SectionStorage\OverridesSectionStorage))
#22 /app/web/core/lib/Drupal/Core/Ajax/AjaxFormHelperTrait.php(39): Drupal\layout_builder\Form\ConfigureBlockFormBase->successfulAjaxSubmit(Array, Object(Drupal\Core\Form\FormState))
#23 [internal function]: Drupal\layout_builder\Form\ConfigureBlockFormBase->ajaxSubmit(Array, Object(Drupal\Core\Form\FormState), Object(Symfony\Component\HttpFoundation\Request))
#24 /app/web/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php(69): call_user_func_array(Array, Array)
#25 /app/web/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php(109): Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse(Object(Symfony\Component\HttpFoundation\Request), Array, Object(Drupal\Core\Form\FormState), Array)
#26 [internal function]: Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#27 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#28 /app/vendor/symfony/http-kernel/HttpKernel.php(227): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exceptio...', Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent))
#29 /app/vendor/symfony/http-kernel/HttpKernel.php(79): Symfony\Component\HttpKernel\HttpKernel->handleException(Object(Drupal\Core\Form\FormAjaxException), Object(Symfony\Component\HttpFoundation\Request), 1)
#30 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /app/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#39 {main}
Steps to reproduce
- Enter layout section of a page
- Click add block
- Choose view block
- Click add block
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet