Problem/Motivation
All other Drupal sessionStorage and localStorage items are namespaced like "Drupal.[module].storageTokenName" but not "escapeAdminPath".
https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/tool...
/**
* @file
* Replaces the home link in toolbar with a back to site link.
*/
(function ($, Drupal, drupalSettings) {
const pathInfo = drupalSettings.path;
const escapeAdminPath = sessionStorage.getItem('escapeAdminPath');
const windowLocation = window.location;
Steps to reproduce
Proposed resolution
1.- Namespace it.
- const escapeAdminPath = sessionStorage.getItem('escapeAdminPath');
+ const escapeAdminPath = sessionStorage.getItem('Drupal.toolbar.escapeAdminPath');
2.- Consider cleaning up the old un-namespaced item pollution.
Is there a policy for clearing old variable names from js app storage?
Remaining tasks
- write patch.
- review.
User interface changes
n/a
API changes
n/a
Data model changes
n/a
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | interdiff-7_9.txt | 487 bytes | gauravvvv |
| #9 | 3205499-9.patch | 877 bytes | gauravvvv |
| #7 | 3205499-7.patch | 609 bytes | gauravvvv |
Issue fork drupal-3205499
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 #7
gauravvvv commentedI have attached patch for same, please review
Comment #8
smustgrave commentedSeems to have some failures.
Comment #9
gauravvvv commentedTried fixing failures, attached interdiff for same
Comment #10
smustgrave commentedSeems fine.
Comment #11
lauriiiLooks like there are couple contrib modules using this session storage entry. Should we deprecate the old key before removing it?
Comment #12
smustgrave commentedSeems minor but probably the safest route
Comment #13
yash.rode commentedHow can we apply javascript deprecation on top of this session storage key?
Comment #15
yash.rode commentedComment #16
utkarsh_33 commentedJust a small change.
Comment #17
yash.rode commentedComment #18
smustgrave commentedDeprecation key seems straight forward. But should the message include a link to a CR or mention what should be used instead?
Comment #19
utkarsh_33 commentedAdded the CR.Thanks!
Comment #20
smustgrave commentedShort and to the point!
Kernel failure appeared to be random, re-ran the tests all are green.
Believe this one is good to go.
Comment #21
nod_CR was a bit too short, added a bit of context :) Since this is sessionStorage there is no need to get rid of the old variable, it will be deleted when the tab closes.
I know it's now in the toolbar module but it's something that is used in gin, will be used by the navigation module eventually, and the toolbar module will be deprecated/removed at some point. So not sure it's necessary to namespace it in the toolbar. We'd need to do another deprecation later and we don't need to go through that I think.
Can we do
Drupal.escapeAdminPathinstead?