Problem/Motivation

On Drupal 11.3.10, switching language via the dropdown_language block redirects to the first visited page(after cache clear) instead of the current page in the selected language.

Proposed resolution

The fix is to implement CacheOptionalInterface on the DropdownLanguage block class, identical to how Drupal core's own LanguageBlock was updated in https://www.drupal.org/project/drupal/issues/2232375, so that cache keys are never assigned and the block always renders fresh with the correct current page URL.

Drupal core's own LanguageBlock:

https://git.drupalcode.org/project/drupal/-/blob/11.3.11/core/modules/la...

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

cbuvaneswaran created an issue. See original summary.

cbuvaneswaran’s picture

Status: Active » Needs review

Hi,

I updated the CacheOptionalInterface logic same as core language switcher block. Please validate the MR and merge.

https://git.drupalcode.org/project/dropdown_language/-/merge_requests/38

Regards,
Buvaneswaran

skaught’s picture

Assigned: cbuvaneswaran » Unassigned
skaught’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
kieran.cott’s picture

Status: Needs work » Needs review

I've added test coverage for the above changes in MR 38, and addressed the remainder of the pipeline failures in the linked issue.

kieran.cott’s picture

I've pulled in the newly merged changes from #3593003 and made a couple of additional tweaks - pipelines on MR 38 now pass.

skaught’s picture

Assigned: Unassigned » skaught

@kieran.cott. -- awesome!
i'll be taking this in shortly..

  • skaught committed 3b20cb07 on 3349246-fix-no-route-match
    #3593252 setup for composer.  remove dated install step (internal)....
skaught’s picture

Issue summary: View changes
skaught’s picture

Issue summary: View changes

  • skaught committed 3b20cb07 on 4.1.x
    #3593252 setup for composer.  remove dated install step (internal)....
skaught’s picture

Status: Needs review » Fixed

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

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

Maintainers, credit people who helped resolve this issue.

kieran.cott’s picture

Thanks for merging @skaught - now this is fixed, would you be able to review assigned contributions?

skaught’s picture

cheers

Status: Fixed » Closed (fixed)

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