open-y-subprojects/openy_map

openy_map_lb: A stray renderRoot() invocation is causing bubbling of attached assets to break

Closed this issue · 1 comments

Hi,

I took a look at the layout builder submodule and noticed an issue when submitting the Configure block form for the Location finder for Layout Builder block. I appreciate the submodule might not be ready yet, just thought it'd be helpful to report.

I'm not sure what a fix might look like. On my site it seems we can get away with using a normal render() call, but I'm not sure where/how else \Drupal\openy_map\OpenyMapDataWrapper::getPins() is used. Maybe it would make sense to return a render array and allow the caller to determine how to render? No idea myself (:

Thanks

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /layout_builder/update/block/overrides/node.5435/0/content/3a5a0950-cd01-4469-bcd2-1d55cd649bbe?destination=/node/5435/layout&_wrapper_format=drupal_dialog.off_canvas&ajax_form=1
StatusText: error
ResponseText: The website encountered an unexpected error. Please try again later.LogicException: A stray renderRoot() invocation is causing bubbling of attached assets to break. in Drupal\Core\Render\Renderer->renderRoot() (line 142 of core/lib/Drupal/Core/Render/Renderer.php). Drupal\openy_map\OpenyMapDataWrapper->getPins('branch') (Line: 98)
Drupal\openy_data_wrapper\DataWrapper->getLocationPins()
call_user_func_array(Array, Array) (Line: 70)
Drupal\openy_socrates\OpenySocratesFacade->__call('getLocationPins', Array) (Line: 75)
Drupal\openy_map_lb\Plugin\Block\LocationFinder->build() (Line: 106)
Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender(Object, 'section_component.build.render_array', Object)
call_user_func(Array, Object, 'section_component.build.render_array', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'section_component.build.render_array') (Line: 90)
Drupal\layout_builder\SectionComponent->toRenderArray(Array, 1) (Line: 88)
Drupal\layout_builder\Section->toRenderArray(Array, 1) (Line: 240)
Drupal\layout_builder\Element\LayoutBuilder->buildAdministrativeSection(Object, 0) (Line: 124)
Drupal\layout_builder\Element\LayoutBuilder->layout(Object) (Line: 98)
Drupal\layout_builder\Element\LayoutBuilder->preRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 148)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 149)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 36)
Drupal\Core\Ajax\InsertCommand->getRenderedContent() (Line: 31)
Drupal\Core\Ajax\ReplaceCommand->render() (Line: 43)
Drupal\Core\Ajax\AjaxResponse->addCommand(Object) (Line: 47)
Drupal\layout_builder\Form\ConfigureBlockFormBase->rebuildLayout(Object) (Line: 26)
Drupal\layout_builder\Form\ConfigureBlockFormBase->rebuildAndClose(Object) (Line: 242)
Drupal\layout_builder\Form\ConfigureBlockFormBase->successfulAjaxSubmit(Array, Object) (Line: 39)
Drupal\layout_builder\Form\ConfigureBlockFormBase->ajaxSubmit(Array, Object, Object)
call_user_func_array(Array, Array) (Line: 69)
Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse(Object, Array, Object, Array) (Line: 109)
Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object, 'kernel.exception', Object)
call_user_func(Array, Object, 'kernel.exception', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.exception') (Line: 229)
Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 92)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 52)
Drupal\openy_block_date\StackMiddleware\BlockDateCacheInvalidator->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I believe this was fixed by #42.