When using the ajax framework, drupalSettings is updated (to update ajaxPageState mainly) but currently interferes with some values like currentPath.

The patch removes a few variables from the settings that are sent back to the browser to avoid overriding them. If we get #1979468: ".active" from linkGenerator(), l() and theme_links() forces an upper limit of per-page caching for all content containing links somewhere we'll only need to remove the path key from $settings and that'll work.

This is a valid (didn't say pretty) patch because ajax requests won't change a page URL. If you're thinking of PJAX, well there will be a custom ajax command for that anyway and that custom command can mess with drupalSettings.currentPath all it want. It's just that by default, path settings won't be updated.

CommentFileSizeAuthor
core-ajax-currentPath-update.patch659 bytesnod_
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Hrm… this indeed solves the problem for now. But at the same time, it is indeed also a mind-bogglingly bizarre/weird/hacky solution to the problem.

I'm fine with this being committed as an intermediate solution, but only if a clear plan is laid out to solve this cleanly afterwards.

Wim Leers’s picture

Status: Needs review » Closed (duplicate)

This was apparently caused by #1691394: Drupal settings gets broken by AJAX requests, and at #27 of that issue, post-commit and post-backport-to-D7 sadly, it was noted that this really is introducing a critical bug.

Marking this issue as a duplicate.