Problem/Motivation
Follow up to #[3620504]. Once active-link.js stops reading drupalSettings.path.currentQuery, nothing in core sets or reads it for a reason. SystemHooks::jsSettingsAlter() still embeds $request->query->all() straight into drupalSettings on every page with a query string, with no cache context attached.
Found investigating #3011426: Page cache size is unlimited when arbitrary query parameters are requested. Keeping this around is a standing liability for anyone trying to reason about whether a page's output actually depends on the query string (e.g. contrib #3610948: Automatically cache pages that don't vary by query args, or a core equivalent) since it's an untracked dependency.
Steps to reproduce
grep core for "currentQuery". Only write site: SystemHooks::jsSettingsAlter. Only read site was active-link.js, removed in #3620504: Stop relying on drupalSettings.path.currentQuery, read from window.location instead.
Proposed resolution
Stop setting path.currentQuery by default in SystemHooks::jsSettingsAlter. Document the change.
Remaining tasks
- First merge #3620504: Stop relying on drupalSettings.path.currentQuery, read from window.location instead so that currentQuery is no longer used
- Then this issue (the 'draft' MR is a combination of this and 3620504)
Make the change + change record to note in currentQuery removal that contrib/custom JS relying on it needs to switch to window.location.search.
User interface changes
None.
Introduced terminology
None.
API changes
drupalSettings.path.currentQuery deprecated.
Data model changes
None.
Release notes snippet
drupalSettings.path.currentQuery is deprecated. Read the current query string from window.location instead.
Issue fork drupal-3620505
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
scott_euser commentedComment #5
scott_euser commentedComment #6
scott_euser commentedComment #7
mstrelan commentedLet's postpone on #3620504: Stop relying on drupalSettings.path.currentQuery, read from window.location instead then. Wasn't sure which MR to comment on, but the @see link will need to point to the CR instead of this issue.