Problem/Motivation
I am seeing a problem where it looks like Task comments are not saving. But it seems like they are saving, but not rendering when you try to list them either on the "Comments" tab or the "All" tab.
It throws the following error when trying to see a comment(s) in either of the tabs.
InvalidArgumentException: "value" is an invalid render array key. Value should be an array but got a string. in Drupal\Core\Render\Element::children() (line 97 of /var/www/html/web/core/lib/Drupal/Core/Render/Element.php).
#0 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(471): Drupal\Core\Render\Element::children()
#1 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(230): Drupal\Core\Render\Renderer->doRender()
#2 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(605): Drupal\Core\Render\Renderer->render()
#3 /var/www/html/web/sites/default/files/php/twig/6a3caefbdb3ce_burndown-log-items.html.t_tw1dNnixQsDsvM6uH_p9gNcqf/3OZbuQ-fC49cYexNyuiO77G3ZzFX3pMPykCSEhDILGg.php(114): Drupal\Core\Template\TwigExtension->renderVar()
#4 /var/www/html/vendor/twig/twig/src/Template.php(411): __TwigTemplate_83e183ac6a6157acfc9e21e38bb00e63->doDisplay()
#5 /var/www/html/vendor/twig/twig/src/Template.php(394): Twig\Template->yield()
#6 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(51): Twig\Template->render()
#7 /var/www/html/web/core/lib/Drupal/Core/Template/TwigThemeEngine.php(35): Twig\TemplateWrapper->render()
#8 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(428): Drupal\Core\Template\TwigThemeEngine->renderTemplate()
#9 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(500): Drupal\Core\Theme\ThemeManager->render()
#10 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(230): Drupal\Core\Render\Renderer->doRender()
#11 /var/www/html/web/modules/contrib/burndown/src/Controller/TaskController.php(140): Drupal\Core\Render\Renderer->render()
#12 [internal function]: Drupal\burndown\Controller\TaskController->getTaskLog()
#13 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#14 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(634): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}()
#15 [internal function]: Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()
#16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(649): Fiber->resume()
#17 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#18 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#19 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}()
#20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#21 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#22 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#24 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#25 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(118): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#26 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(92): Drupal\page_cache\StackMiddleware\PageCache->pass()
#27 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#28 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#29 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#30 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(54): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#31 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(745): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#32 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#33 {main}
Steps to reproduce
Edit a task.
Add a comment
notice that the comments tab shows nothing
notice that "all" tab shows nothing.
Add a work entry
notice that it shows fine.
Proposed resolution
This seems to be caused by an empty comment having a different shape than a complete comment.
It seems like normalizing the shape of the data to be the same in either case would solve the problem.
Issue fork burndown-3606396
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
swirtComment #5
jeremylichtman commentedI'm going to merge this. I think there's at least one follow-on task (low priority) - not sure people should be able to enter a blank comment in the first place.
I'm also worried about anon-submitted comments. Is there any possibility of bad js or evil external links being submitted? I don't recall exactly how that all works; think there are custom AJAX endpoints, and I don't know how defensively I coded them...
Comment #6
jeremylichtman commentedComment #8
swirtGood questions.
empty comments: I am not sure how the empty comments got in the list in the first place, but it was preventing every task I had from showing comments. I don't know if it is a case of the comment form also getting submitted on Task save or something else that lead to the empty comments.
Anonymous comments: This is not so much about allowing anonymous to be created, but more preventing the thing from blowing up if a user gets deleted rather than blocked, and their comment still being rendered. It is a safety against an unlikely edge case that has bitten me before.
Comment #9
swirtThank you for reviewing and merging this so rapidly.
Separate note... you should definitely be crediting yourself for all these issues too. It takes time for you to review, discuss, merge and release.
Comment #10
jeremylichtman commentedThere's several types of "comment" that all get stored together (i.e. things like estimate changes). Only some of them will have contents in the comment field. I wonder if this is a display issue where it is pulling up all of them regardless of type.
It's been about 6 years since I touched any of that functionality, so going on pretty vague memory here.