BulkForm fails to redirect to the expected page if destination query parameter is set

Created on 10 April 2025, 14 days ago

Problem/Motivation

When a view displays bulk form field, we are able to do bulk actions on the listed content.
If the page has a destination query parameter set, some actions (which require an additional step like a confirm form for example) do not work anymore. The redirect to destination occurs before the redirect to $operation_definition['confirm_form_route_name'].

Steps to reproduce

  1. Install using Umami to have some content available
  2. Go to the content overview (admin/content)
  3. Add a destination parameter in the URL (eg. destination=/)
  4. Select one or more content
  5. Choose the "Delete content" action then "Apply to selected items"

Expected: a confirm form is displayed
Current: we are redirected on the destination

Proposed resolution

🐛 Allow form redirects to ignore ?destination query parameter Fixed introduced the \Drupal\Core\Form\FormStateInterface::setIgnoreDestination() helper. Call it before the redirect.

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

views.module

Created by

🇫🇷France duaelfr Montpellier, France

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

Merge Requests

Comments & Activities

  • Issue created by @duaelfr
  • 🇫🇷France duaelfr Montpellier, France

    Fix and tests pushed in a MR.
    Patch attached for composer. Applies on both 11.x and 10.4.x.

  • Pipeline finished with Failed
    14 days ago
    Total: 378s
    #470233
  • 🇮🇳India shivam_tiwari

    Need to work here as pipeline is failing related to test coverage.

  • 🇫🇷France duaelfr Montpellier, France

    Tests should be fixed now.

  • Pipeline finished with Failed
    9 days ago
    Total: 491s
    #473737
  • Pipeline finished with Failed
    9 days ago
    Total: 322s
    #473830
  • 🇳🇱Netherlands Lendude Amsterdam

    Since something somewhere would have added that destination to the URL, should we expect this to be passed on the the redirect? Might be out of scope a bit, since ignoring it is certainly better than what happens now.

  • 🇫🇷France duaelfr Montpellier, France

    @lendude destination is kept after the redirect. I believe it's been made that way in the original issue.

  • Pipeline finished with Failed
    9 days ago
    Total: 359s
    #474255
  • 🇳🇱Netherlands Lendude Amsterdam

    Ok that sounds good then :)

    The fails in Drupal\Tests\workspaces\Functional\WorkspaceViewsBulkForm feel like related failures, so moving back to needs work to check those

  • 🇫🇷France duaelfr Montpellier, France

    I think I found the issue with my test coverage! Crossing fingers ;)

  • Pipeline finished with Failed
    8 days ago
    Total: 446s
    #475185
  • 🇺🇸United States smustgrave

    Seems to be impacting workspaces, seems relevant to the change I believe

  • Pipeline finished with Failed
    7 days ago
    Total: 367s
    #475789
  • 🇫🇷France duaelfr Montpellier, France

    @lendude @smustgrave I'm out of ideas to fix the test. I cannot reproduce this failure locally. Do you have some clues for me?

    $ phpunit -c phpunit.xml core/modules/views/tests/src/Functional/BulkFormTest.php
    PHPUnit 10.5.45 by Sebastian Bergmann and contributors.
    
    Runtime:       PHP 8.3.15
    Configuration: /app/phpunit.xml
    
    ..                                                                  2 / 2 (100%)
    
    HTML output was generated.
    [...]
    
    Time: 00:18.124, Memory: 10.00 MB
    
    OK (2 tests, 79 assertions)
    
    $ phpunit -c phpunit.xml core/modules/workspaces/tests/src/Functional/WorkspaceViewsBulkFormTest.php
    PHPUnit 10.5.45 by Sebastian Bergmann and contributors.
    
    Runtime:       PHP 8.3.15
    Configuration: /app/phpunit.xml
    
    ..                                                                  2 / 2 (100%)
    
    HTML output was generated.
    [...]
    
    
    Time: 00:56.580, Memory: 10.00 MB
    
    OK (2 tests, 97 assertions)
    
Production build 0.71.5 2024