Ajax comment sometimes doesn't get rendered after rendering

Created on 24 January 2020, over 5 years ago
Updated 29 April 2025, 8 days ago

Problem/Motivation

Ajax comment sometimes doesn't get rendered after rendering.

How to reproduce
This is unclear, it happened to me twice on the demo content from the Distro. Once with admin and another time with user Michelle Clark. Both on the same event node (3). After a page reload the new comment is visible.
The error below seems to be the reason why, but haven't been able to find the cause of it.

Error: Call to a member function getComponent() on null in Drupal\ajax_comments\Controller\AjaxCommentsController->renderCommentField() (line 136 of /var/www/html/modules/contrib/ajax_comments/src/Controller/AjaxCommentsController.php) #0 /var/www/html/modules/contrib/ajax_comments/src/Controller/AjaxCommentsController.php(194): Drupal\ajax_comments\Controller\AjaxCommentsController->renderCommentField(Object(Drupal\social_node\Entity\Node), 'field_topic_com...') #1 /var/www/html/modules/contrib/ajax_comments/src/Controller/AjaxCommentsController.php(618): Drupal\ajax_comments\Controller\AjaxCommentsController->buildCommentFieldResponse(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Ajax\AjaxResponse), Object(Drupal\social_node\Entity\Node), 'field_topic_com...') #2 [internal function]: Drupal\ajax_comments\Controller\AjaxCommentsController->add(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\social_node\Entity\Node), 'field_topic_com...', '0') #3 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #4 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #5 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #6 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #7 /var/www/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #8 /var/www/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #9 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #10 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(694): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #18 {main}.
🐛 Bug report
Status

Fixed

Version

10.0

Component

Code (back-end)

Created by

🇳🇱Netherlands royharink

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024