Problem/Motivation
This issue deleted the file core/lib/Drupal/Core/Render/Element/Ajax.php however, and left in a small piece of code in AjaxRenderer::renderResponse, which doesn't do anything since that's been deleted.
The block if (isset($main_content['#type']) && ($main_content['#type'] == 'ajax')) {
is essentially dead code by now and should be deleted.
Proposed resolution
Starting from the "if" code above, to the closing bracket, deleting a dozen lines.
Remaining tasks
There's nothing else to do. No need for tests or any such.
----------------------------------
Shout-out and thanks to @chx, who kindly suggested this novice ticket in the #first-contribution Slack channel.
Issue fork drupal-3549350
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 #2
igorgoncalves commentedThe Drupal Contribution Mentoring team is triaging issues for Drupalcon Vienna, and we are reserving this issue for Mentored Contribution during the event.
After 17th of October, this issue returns to being open to all. Thanks!
Comment #3
ankitv18 commentedComment #6
angel_devoeted commentedI’ve created MR !13431 which removes the unused AjaxRenderer code as described. Ready for review.
Comment #7
angel_devoeted commentedJust pushed a small update — removed the unused AlertCommand and cleaned up the imports.
This resolves the PHPCS warning reported in the previous pipeline.
The latest pipeline failed due to a known GitLab system issue (PodGC node cleanup), not related to the code.
This is my first Drupal core contribution — happy to get familiar with the process!
Comment #8
ankitv18 commentedTest is failing, please look into that.
Comment #9
igorgoncalves commentedHi @ankitv18 and @angel_devoeted thanks for your help.
But as per #2, this issue is reserved for Mentored Contribution during the Drupalcon Vienna next week.
After 17th of October, this issue returns to being open to all.
Thanks!
Comment #10
till79 commentedWe are working on that issue on DrupalCon Vienna with @jberghammer and @manuel-ranzmeir and @lostcarpark mentoring
Comment #11
till79 commentedwe reran the tests and all of them were green with @michael.j.gleeson, @jberghammer and @manuel-ranzmeir and @lostcarpark mentoring
Comment #12
till79 commentedMoving to "Needs review"
Comment #13
lostcarpark commentedRemoving igor from issue assignment.
Comment #14
danieazc commentedI'm currently working on this issue during DrupalCon Vienna 2025, under the mentorship of ChrisDarke.
Comment #15
ivan vargas commentedI'm currently working on this issue during DrupalCon Vienna 2025, under the mentorship of ChrisDarke.
Comment #16
humberto_luna commentedWorking on this issue in the #Vienna2025 Drupalcon under the menthorship if @chrisdarke
Comment #17
tim.plunkettAdding the *original* issue that introduced this.
Reviewed with @justafish at DC Vienna, I'm signing off on this as the AJAX subsystem maintainer.
Comment #18
ivan vargas commentedWorking alongside danieazc and humberto_luna, we confirmed with tim.plunkett and justafish that this merge request is good to go. I can confirm that the test passed and the removed of the code makes sense. This is a long-standing deprecated issue that no longer needs to be maintained in core.
Comment #19
humberto_luna commentedThank you @ivan-vargas and @danieazc, marking this as Reviewed and tested by the community
Comment #21
xjmWhenever we remove dead code, it's always a good idea to research the history of the issue to see how it became a dead code in the first place, to make sure we're not accidentally removing the last remnant of an intentional behavior or the last evidence of a bug.
In the case of this issue, I wanted to make sure that removing this condition was in fact a pure cleanup rather than some edgecase that still needed support, so I asked for signoff from either an Ajax subsystem maintainer or a frontend framework manager. Chris Darke checked with @tim.plunkett, who researched the history of this issue all the way back to 2013. Tim also reviewed the code side by side with @justafish who is one of the frontend framework managers.
I've also reviewed the code in context myself to confirm that it is indeed dead code since there is nothing in the caller tree to set
#typetoajax. (I'm not totally sure, but I think this may date back to a very old bug with Ajax responses being created within Ajax responses, which is why it got carried forward from very legacy code into modern Ajax response rendering.)In any case, based on the above signoffs, I'm comfortable committing this to 11.x HEAD.
Thanks everyone for your work on this issue!