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

Command icon 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

igorgoncalves created an issue. See original summary.

igorgoncalves’s picture

The 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!

ankitv18’s picture

Issue summary: View changes

angel_devoeted made their first commit to this issue’s fork.

angel_devoeted’s picture

Assigned: Unassigned » angel_devoeted
Status: Active » Needs review

I’ve created MR !13431 which removes the unused AjaxRenderer code as described. Ready for review.

angel_devoeted’s picture

Just 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!

ankitv18’s picture

Status: Needs review » Needs work

Test is failing, please look into that.

igorgoncalves’s picture

Hi @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!

till79’s picture

We are working on that issue on DrupalCon Vienna with @jberghammer and @manuel-ranzmeir and @lostcarpark mentoring

till79’s picture

we reran the tests and all of them were green with @michael.j.gleeson, @jberghammer and @manuel-ranzmeir and @lostcarpark mentoring

till79’s picture

Status: Needs work » Needs review

Moving to "Needs review"

lostcarpark’s picture

Assigned: igorgoncalves » Unassigned

Removing igor from issue assignment.

danieazc’s picture

I'm currently working on this issue during DrupalCon Vienna 2025, under the mentorship of ChrisDarke.

ivan vargas’s picture

I'm currently working on this issue during DrupalCon Vienna 2025, under the mentorship of ChrisDarke.

humberto_luna’s picture

Working on this issue in the #Vienna2025 Drupalcon under the menthorship if @chrisdarke

tim.plunkett’s picture

Adding the *original* issue that introduced this.
Reviewed with @justafish at DC Vienna, I'm signing off on this as the AJAX subsystem maintainer.

ivan vargas’s picture

Working 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.

humberto_luna’s picture

Status: Needs review » Reviewed & tested by the community

Thank you @ivan-vargas and @danieazc, marking this as Reviewed and tested by the community

  • xjm committed 698d0af4 on 11.x
    Issue #3549350 by igorgoncalves, angel_devoeted, till79, lostcarpark,...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Whenever 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 #typeto ajax. (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!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

xjm changed the visibility of the branch 3549350-remove-useless-code to hidden.

pdureau changed the visibility of the branch 11.x to active.

xjm changed the visibility of the branch 11.x to hidden.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.